IP Header Fields in the UDP Pseudo-Header

The UDP pseudo-header is a conceptual data structure used exclusively during the calculation of the UDP checksum. Rather than transmitting this data across the network, both the sender and receiver construct it in memory to verify that a datagram has reached its correct destination without corruption. This article provides a straightforward breakdown of the specific Internet Protocol (IP) header fields borrowed to construct the UDP pseudo-header for both IPv4 and IPv6 networks.

Purpose of the Pseudo-Header

The User Datagram Protocol (UDP) operates at the transport layer, while the Internet Protocol operates at the network layer. To protect against misrouted packets—such as those delivered to the wrong host due to routing table corruption or bit errors—the UDP checksum includes key addressing and protocol information from the IP header.

IPv4 Header Fields in the UDP Pseudo-Header

When calculating the UDP checksum over an IPv4 network, the pseudo-header is 12 bytes (96 bits) long and includes the following fields directly from the IPv4 header:

Additional IPv4 Pseudo-Header Fields

Along with the fields taken from the IPv4 header, the pseudo-header contains: * Zero Padding (8 bits / 1 byte): A byte set entirely to zeros placed immediately before the Protocol field to align the structure to 16-bit boundaries. * UDP Length (16 bits / 2 bytes): The total length of the UDP header plus the UDP data (copied from the UDP header itself, not the IPv4 Total Length field).


IPv6 Header Fields in the UDP Pseudo-Header

In IPv6, calculating the UDP checksum is mandatory. The IPv6 pseudo-header is 40 bytes long and extracts the following fields from the IPv6 base and extension headers:

Additional IPv6 Pseudo-Header Fields

Summary

The IP fields included in the UDP pseudo-header are the Source IP Address, the Destination IP Address, and the Protocol / Next Header field. These network-layer fields, combined with the transport layer’s UDP Length, ensure that any error in addressing or transport identification invalidates the checksum and causes the corrupted datagram to be discarded.