What is the Significance of Pseudo Header used in

2019-01-25 06:01发布

Why is the Pseudo header prepended to the UDP datagram for the computation of the UDP checksum? What's the rational behind this?

4条回答
别忘想泡老子
2楼-- · 2019-01-25 06:29

The nearest you will get to an answer "straight from the horse's mouth", is from David P. Reed at the following link.

http://www.postel.org/pipermail/end2end-interest/2005-February/004616.html

The short version of the answer is, "the pseudo header exists for historical reasons".

Originally, TCP/IP was a single monolithic protocol (called just TCP). When they decided to split it up into TCP and IP (and others), they didn't separate the two all that cleanly: the IP addresses were still thought of as part of TCP, but they were just "inherited" from the IP layer rather than repeated in the TCP header. The reason why the TCP checksum operates over parts of the IP header (including the IP addresses) is because they intended to use cryptography to encrypt and authenticate the TCP payload, and they wanted the IP addresses and other TCP parameters in the pseudo header to be protected by the authentication code. That would make it infeasible for a man in the middle to tamper with the IP source and destination addresses: intermediate routers wouldn't notice the tampering, but the TCP end-point would when it attempted to verify the signature.

For various reasons, none of that grand cryptographic plan came to pass, but the TCP checksum which took its place still operates over the pseudo header as though it were a useful thing to do. Yes, it gives you a teensy bit of extra protection against random errors, but that's not why it exists. Frankly, we'd be better off without it: the coupling between TCP and IP means that you have to redefine TCP when you change IP. Thus, the definition of IPv6 includes a new definition for the TCP and UDP pseudo header (see RFC 2460, s8.1). Why the IPv6 designers chose to perpetuate this coupling rather than take the chance to abolish it is beyond me.

查看更多
聊天终结者
3楼-- · 2019-01-25 06:38

From the TCP or UDP point of view, the packet does not contain IP addresses. (IP being the layer beneath them.)

Thus, to do a proper checksum, a "pseudo header" is included. It's "pseudo", because it is not actaully part of the UDP datagram. It contains the most important parts of the IP header, that is, source and destination address, protocol number and data length.

This is to ensure that the UDP checksum takes into account these fields.

查看更多
爷的心禁止访问
4楼-- · 2019-01-25 06:38

"The purpose of using a pseudo-header is to verify that the UDP datagram has reached its correct destination. The key to understanding the pseudo-header lies in realizing that the correct destination consists of a specific machine and a specific protocol port within that machine. The UDP header itself specifies only the protocol port number. Thus, to verify the destination, UDP on the sending machine computes a checksum that covers the destination IP address as well as the UDP datagram. The pseudo-header is not transmitted with the UDP datagram, nor is it included in the length."

E. Comer - Internetworking with TCP/IP 4th edition.

查看更多
闹够了就滚
5楼-- · 2019-01-25 06:47

When these protocols were being designed, a serious concern of theirs was a host receiving a packet thinking it was theirs when it was not. If a few bits were flipped in the IP header during transit and a packet changed course (but the IP checksum was still correct), the TCP/UDP stack of the redirected receiver can still know to reject the packet.

Though the pseudo-header broke the separation of layers idiom, it was deemed acceptable for the increased reliability.

查看更多
登录 后发表回答