Transport Udp Error Detection
Transport Udp Error Detection
Srinivas Narayana
1
Transport
IP
Network
TCP UDP
Transport: provide guarantees to apps
IP
Network application
data
(message)
Link layer
UDP segment structure
…
Source IP address
Applications Destination IP address
…
source port # dest port #
Transport
length checksum
Network application
data
(message)
Link layer
Review: UDP demultiplexing
…
Port 1 Source IP address
Port 2
IP 1 1
Machine
Destination IP address
… …
… source port # dest port #
…
Machine
Port144262 length checksum
…
Port 65535
application
IP 2 1
Machine
data
socket() Ports (message)
UDP packets
• A small demo
CS 352
UDP: Error Detection
Srinivas Narayana
10
UDP: Best Effort Service
• Simple and low overhead transport: connectionless
• Data may be lost
• Data may be corrupted along the way (e.g., 1 -> 0)
• Data may be reordered
• However, simple error detection is possible.
UDP Error Detection
• Key idea: have sender compute a function over the data
• Store the result in the packet
• Receiver can check the function’s value in received packet
• Your idea: weigh the package; stamp the weight on the package
• Have the recipient weigh the package and cross-check the weight with
the stamped value
Error detection function
• Function must be easy to compute
• Function must capture the likely changes to the packet
• If the packet was corrupted through these likely changes, the function
value must change
• Function must be easy to verify
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
15
From the UDP specification (RFC 768)
• Checksum is the 16-bit one's complement of the one's
complement sum of a pseudo header of information from the IP
header, the UDP header, and the data, padded with zero octets
at the end (if necessary) to make a multiple of two octets.
• Checksums are part of the packet; they can get corrupted too
• The receiver will just declare an error if it finds an error
• However, checksums don’t enable the receiver to detect where the error lies
or correct the error(s)
• Checksum is an error detection mechanism; not a correction mechanism.
Some observations on checksums
• Checksums are insufficient for reliable data delivery
• If a packet is lost, so is its checksum