CSCI 5273 Computer Networks Stevens, Chapter 11 - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

CSCI 5273 Computer Networks Stevens, Chapter 11

Description:

Fragmented packets are not reassembled until they reach their final destination ... ICMP type 'destination unreachable' (type 3) ... – PowerPoint PPT presentation

Number of Views:77
Avg rating:3.0/5.0
Slides: 29
Provided by: DirkGr8
Category:

less

Transcript and Presenter's Notes

Title: CSCI 5273 Computer Networks Stevens, Chapter 11


1
CSCI 5273Computer NetworksStevens, Chapter 11
12UDP with supplemental informationon the
POSIX interfaceBroadcast Multicast
  • Dirk GrunwaldAssoc. ProfessorDept. of Computer
    ScienceUniversity of Colorado, Boulder

2
Overview
  • Basic UDP protocol
  • IP Fragmentation reassembly
  • Path MTU discovery
  • ICMP Source Quench
  • POSIX interface pragmatics

3
UDP Protocol
IP Datagram
UDP Datagram
IPHeader
UDPHeader
UDPData
20 bytes
8 bytes
4
UDP Header
16-bit Destination Port
16-bit Source Port
16-bit UDP Checksum (opt)
16-bit UDP Length
Data (if any)
5
UDP Header
IPHeader
UDPHeader
UDPData
6
UDP Checksum
IPHeader
UDPHeader
UDPData
IPPesudo-Header
7
IP Pseudo-Header
32-bit Source IP address
32-bit Destination IP address
MBZ
Protocol
16-bit UDP Length
16-bit Destination Port
16-bit Source Port
16-bit UDP Checksum (opt)
16-bit UDP Length
Data (if any)
Possible odd byte
PAD
8
UDP Checksum
  • Checksum calculated like IP checksum, but use
    pseudo-IP header to insure packet arrived at
    proper host
  • If transmitted checksum field is zero, it means
    sender didnt compute the checksum.
  • If the computed checksum would be zero, its
    represented as 65535
  • No packets with checksum errors are not reported

9
IP Fragmentation
  • When a router transits a packet that is too large
    for the MTU of the outgoing link, the packet is
    fragmented
  • Fragmented packets are not reassembled until they
    reach their final destination
  • Fragments may also be fragmented
  • Fragments are identified using the datagram
    sequence
  • Typically, if any fragment is lost, a router will
    discard all fragments. Routers usually only
    discover fragment loss if they drop the fragment
    themselves.
  • The endpoint assumes fragments are lost after
    30-60 seconds

10
Packets vs. Datagrams
  • An IP datagram is the unit of end-to-end
    transmission at the IP layer (before
    fragmentation after reassembly)
  • A packet is the unit of data passed between the
    IP layer and the link layer.
  • A packet can be a complete IP datagram or a
    fragment

11
IP Fragmentation
Payload
IP Header
Payload
IP Header
Payload
IP Header
More Fragementsis Set
Payload
IP Header
More Fragementsis NOT Set
12
IP Fragmentation - Identifying Information
Payload
IP Header
Payload
IP Header
13
IP Fragmentation
Payload
IP Header
Payload
IP Header
14
IP Fragmentation Of Non-Final Fragments
Payload
IP Header
Payload
IP Header
Payload
IP Header
More Fragementsis Set
IP Header
Payload
Payload
IP Header
15
IP Fragmentation Of Final Fragment
Payload
IP Header
Payload
IP Header
Payload
IP Header
Payload
IP Header
More Fragementsis Set
IP Header
More Fragementsis NOT Set
IP Header
16
Dont Fragment
  • Hosts must be able to receive packets of 576
    bytes, which means a 512-byte datagram wont be
    fragmented
  • One of the IPv4 header flags specifies that this
    packet should be fragmented

16-bit Packet Identification
Fragment Offset
Reserved
Dont Fragment
MoreFragments
17
ICMP Unreachable Error
  • Attempting to fragment a fragment with dont
    fragment set generates an ICMP error packet
  • ICMP type destination unreachable (type 3)
  • code fragmentation required but dont fragment
    set (code 4)

Type (3)
Code (4)
Checksum
MTU of next network hop
MBZ
IP Header (including options)and first 8 bytes
of original IP datagram data
18
MTU Discovery UsingDont Fragment Packets
19
ICMP Source Quench
  • If a router / host discards datagrams due to
    buffer overflows, it may send a ICMP source
    quench message
  • I tried for 15 minutes to generate this on a slow
    host was unable to do so
  • More likely to occur when e.g., routing to a
    dialup, but even that failed.
  • Can be used by a protocol to slow down
    transmission rate (e.g., TCP)

20
UDP Pragmatics (review from code)
  • UDP port and TCP ports are separate name spaces
  • UDP port 80 doesnt mean the same thing as TCP
    port 80
  • UDP ports are unique to a specific interface
  • port 80 on loopback is not the same as port 80 on
    eth0
  • Most POSIX/UNIX systems let you specify
    wildcards
  • IPADDR_ANY is a special address (0.0.0.0) that is
    a wild card interface address

21
Using netstat to see ports
current-45 netstat -n -a Active Internet
connections (including servers) Proto Recv-Q
Send-Q Local Address Foreign Address
State tcp 0 0 128.138.202.9222
128.138.241.121813 ESTABLISHED tcp
0 0 0.0.0.06000 0.0.0.0
LISTEN tcp 0 0 0.0.0.022
0.0.0.0 LISTEN tcp
0 0 0.0.0.01024 0.0.0.0
LISTEN tcp 0 0 0.0.0.0758
0.0.0.0 LISTEN tcp
0 0 0.0.0.025 0.0.0.0
LISTEN tcp 0 0 0.0.0.0113
0.0.0.0 LISTEN tcp
0 0 0.0.0.079 0.0.0.0
LISTEN tcp 0 0 0.0.0.0512
0.0.0.0 LISTEN tcp
0 0 0.0.0.0513 0.0.0.0
LISTEN tcp 0 0 0.0.0.0514
0.0.0.0 LISTEN tcp
0 0 0.0.0.023 0.0.0.0
LISTEN tcp 0 0 0.0.0.021
0.0.0.0 LISTEN tcp
0 0 0.0.0.037 0.0.0.0
LISTEN tcp 0 0 0.0.0.013
0.0.0.0 LISTEN tcp
0 0 0.0.0.0111 0.0.0.0
LISTEN udp 0 0 0.0.0.08000
0.0.0.0 udp 0 0
0.0.0.0768 0.0.0.0 udp 0
0 0.0.0.0770 0.0.0.0 udp
0 0 0.0.0.0177 0.0.0.0
22
Using netstat to see interfaces
current-45 netstat -n -a . udp 0
0 128.138.202.928000 0.0.0.0 udp 0
0 127.0.0.18000 0.0.0.0 udp
0 0 0.0.0.0769 0.0.0.0 udp
0 0 0.0.0.0768 0.0.0.0
23
System Calls Used
  • Socket
  • Create an endpoint on the local system
  • Bind
  • Specify the local interface and port for the
    endpoint
  • Connection
  • Specify the remote interface and port for the
    endpoint
  • setsockopt / getsockopt
  • Modify various default properties

24
Bound Connected Sockets
  • Until bind is called, a socket is not bound
  • Cant receive messages (havent specified port)
  • When you send using an unbound socket, its
    bound to an ephemeral port
  • Until connect is called, a socket is not
    connected
  • Sending messages on an unconnected socket
    requires that you specify the destination address
    each time.
  • If you do call connect, you can only receive
    messages on the connected socket from that the
    specified remote endpoint

25
POSIX socket interface
  • send
  • Send a message on a connected socket
  • sendto
  • Send a datagram to a specified IP address. The
    socket can be unconnected.
  • recv
  • Receive a datagram from a bound socket
  • recvfrom
  • Receive a datagram and record the source IP
    address
  • recvmsg
  • Essentially like recvfrom, but arguments packed
    in a struct

26
One Last POSIX call - select
  • Select lets you wait on multiple file descriptors
    to become available, or for a timeout to occur
  • include ltsys/time.hgt
  • int select(
  • int nfds,
  • fd_set readfds,
  • fd_set writefds,
  • fd_set exceptfds,
  • struct timeval timeout)
  • Youll need this for next homework!

27
Common UDP Server Pattern
socket
recvfrom
setsockopt
sendto
bind
28
Common UDP Server Pattern
socket
sendto
setsockopt
recvfrom
Write a Comment
User Comments (0)
About PowerShow.com