jessLAND notes - udp
UDP - User Datagram Protocol
****************************
1. Gral. Info
2. UDP stimulus - response
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^ TOP ^
1. Gral. Info
=============
- RFC 768: UDP Protocol Specification
- UDP Datagram format:
0 16 32
+---------------------------------------------------------------+
| SRC PORT | DST PORT |
|---------------------------------------------------------------|
| UDP datagram length (inc. hdr)| UDP checksum |
|---------------------------------------------------------------|
~ OPTIONAL DATA |
+---------------------------------------------------------------+
+ Maximum UDP Datagram size
· theoretical limit: 65,535 bytes (16-bit length field)
with 20b IP hdr + 8b UDP hdr = 65,507b of user data
· two limits: - sockets API limites size of send and receive buffer;
generally 8 kbytes, but you can call a routine to
change this.
- TCP/IP implementation - Stevens found various limits
to the sizes - even with loopback interface
(see Stevens, Vol. 1, pg. 159)
· Hosts are required to handle at least 576 byte IP datagrams,
thus lots of protocols limit themselves to 512 bytes or less of data
( DNS, TFTP, BOOTP, and SNMP ).
+ UDP checksum:
· UDP doesn't require a checksum to be computed, but it's highly recommended
· The algorithm divides the data to be checksummed into 16-bit fields.
· Each 16-bit field has a 1's complement operation done on it and each of
these 1's complements values are added.
· Validated by the destination host only.
· If checksum is wrong, the datagram is discarded silently.
· The checksum is calculated over the payload (padded to 2-byte boundary)
and a pseudo hdr:
[ src IP (4b) | dst IP (4b) | 0x00 (1b), proto (1b), udp-length (2b) ]
[ src port (2b), dst port (2b) | udp length (2b), udp chksum (2b) ]
[ data (2-byte padded) ]
- Characteristics:
+ Unreliable: there is no guarantee that the datagrams ever
reach destination
+ Not connection oriented (no sequence numbers)
- UDP is IP protocol number 17.
- UDP Ports: 0 -> 65535 [0 -> 1024: Priviledged]
(Windows systems do not have the priviledged port concept)
...............................................................................
^ TOP ^
2. UDP stimulus - response
==========================
[c = client] [s = server] [r = router] [S = SYN] [R = RESET] [A = ACK]
+ open port: request [c->s] / reply [s->c]
+ closed port: request [c->s] / ICMP port unreachable [s->c]
+ host does not exist: request [c->s] / ICMP host unreachable [r->c]
+ port blocked by router: request [c->s] / ICMP host unreachable - admin
prohibited filter [r->c]
+ port blocked by silent router: S [c->s] / -
Last Updated: 01/09/2003-06:41:31 - © Copyright 2004, Jess García