gpt4 book ai didi

networking - 解析包含未知扩展的 IPv6 扩展 header

转载 作者:行者123 更新时间:2023-12-03 04:41:31 24 4
gpt4 key购买 nike

我正在编写一个非常简单的网络过滤器,并到达我想要解析 IPv6 header 的位置以匹配 ICMPv6 类型、TCP/UDP 端口号等内容。

所以我正在阅读有关 IPv6 packet format 的内容深入地讲,我有点像……嗯……我不得不一遍又一遍地阅读它,以确保我实际上读得正确。在我看来,你必须从 40 字节的固定 header 开始,然后查看它的下一个 header 字段。然后你还要查看下一个 header 的下一个 header 字段,以此类推,就像链表一样,直到到达末尾。如果有有效负载,它就会跟随。

问题在于固定 header 或扩展 header 中都没有长度字段。您必须有一个扩展 header 类型及其大小的表格,以便您可以追踪此链接列表到底。

这让我觉得这是一个奇怪的、甚至可能是愚蠢的设计。如果遇到无法识别的扩展 header 类型怎么办?我该怎么办?我不知道它的长度。我想我必须扔掉数据包并阻止它,因为在网络过滤器中允许数据包通过将允许攻击者通过包含虚假 header 类型来逃避网络过滤器。 但这意味着,如果协议(protocol)进行了扩展,那么如果要使用新的扩展,曾经编写的每一个 IPv6 header 解析软件都必须同时更新。

如果我不知道他们使用的扩展,我该如何解析 IPv6 header ?由于我不知道未知扩展名的长度,如何跳过它的 header ?

最佳答案

What if I encounter an unrecognized extension header type?

来自RFC 2460 :

If, as a result of processing a header, a node is required to proceedto the next header but the Next Header value in the current header isunrecognized by the node, it should discard the packet and send anICMP Parameter Problem message to the source of the packet, with anICMP Code value of 1 ("unrecognized Next Header type encountered")and the ICMP Pointer field containing the offset of the unrecognizedvalue within the original packet. The same action should be taken ifa node encounters a Next Header value of zero in any header otherthan an IPv6 header.

关于networking - 解析包含未知扩展的 IPv6 扩展 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17518951/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com