c - IPV6 数据包的伪报头字段

标签 c network-programming ipv6

我正在计算 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/

相关文章:

C桶字符串

c - 如何从文件描述符获取 FILE* 流?

network-programming - Linux 上 C 语言的默认网关

c++ - 为什么 GetQueuedCompletionStatus() 不返回操作类型?

c# - Xamarin iOS(WebClient IPv6 拒绝)

c++ - 寻找免费的源代码分析器(函数依赖树)

c - 传递了指向函数的指针,但该函数似乎无法更改它

java - Java 8 中 InetAddress.getLocalHost().getHostName() 的不良行为

c# - 从 C# 中 IPv6 安全的 IP 字符串中删除端口

c - 套接字编程,ipv6客户端程序不工作