我正在计算 IPV6 数据包的校验和值。
在扩展头的情况下,如何计算伪地址的目标地址和长度字段的值?
最佳答案
RFC 2460 section 8.1指定这一切。一些亮点:
当使用更改目标地址的扩展 header 确定伪 header 目标地址时,您使用收件人将看到的目标地址:
If the IPv6 packet contains a Routing header, the Destination Address used in the pseudo-header is that of the final destination. At the originating node, that address will be in the last element of the Routing header; at the recipient(s), that address will be in the Destination Address field of the IPv6 header.
在确定上层数据包长度时,您不计算任何扩展 header ,只计算最终(上层) header 及其数据:
The Upper-Layer Packet Length in the pseudo-header is the length of the upper-layer header and data (e.g., TCP header plus TCP data). Some upper-layer protocols carry their own length information (e.g., the Length field in the UDP header); for such protocols, that is the length used in the pseudo-header. Other protocols (such as TCP) do not carry their own length information, in which case the length used in the pseudo-header is the Payload Length from the IPv6 header, minus the length of any extension headers present between the IPv6 header and the upper-layer header.
关于c - IPV6 数据包的伪报头字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17541898/