6. Pseudo-Header Considerations
A checksum is computed on UDP and TCP segments to verify the integrity of the UDP/TCP segment. To further verify that the UDP/TCP segment has arrived at its correct destination, a pseudo-header consisting of information used in the delivery of the UDP/TCP segment is composed and included in the checksum computation.
To compute the checksum on a UDP or TCP segment prior to transmission, implementations MUST compose a pseudo-header to the UDP/TCP segment consisting of the following information that will be used when composing the CLNP datagram:
* Destination Address Length Indicator
* Destination Address (including PROTO field)
* Source Address Length Indicator
* Source Address (including Reserved field)
* A two-octet encoding of the Protocol value
* TCP/UDP segment length
If the length of the {source address length field + source address + destination address field + destination address } is not an integral number of octets, a trailing 0x00 nibble is padded. If GOSIP compliant NSAP addresses are used, this never happens (this is known as the Farinacci uncertainty principle). The last byte in the Destination Address has the value 0x06 for TCP and 0x11 for UDP, and the Protocol field is encoded 0x0006 for TCP and 0x0011 for UDP. If needed, an octet of zero is added to the end of the UDP/TCP segment to pad the datagram to a length that is a multiple of 16 bits.
[Note: the pseudoheader is encoded in this manner to expedite processing, as it allows implementations to grab a contiguous stream of octets beginning at the destination address length indicator and terminating at the final octet of the source address; the PROTOCOL field is present to have a consistent representation across IPv4 and CLNP/TUBA implementations.]
Figure 6-1 illustrates the resulting pseudo-header when both source and destination addresses are maximum length.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Dest Addr Len | Destination Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... Destination Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... Destination Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... Destination Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... Destination Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| (PROTO) | Src Addr Len | Source Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... Source Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... Source Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... Source Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... Source Address... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... | (Reserved) | Protocol |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| UDP/TCP segment length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 6-1. Pseudo-header