gpt4 book ai didi

ICMP 类型 11 数据包有效载荷的大小

转载 作者:行者123 更新时间:2023-12-04 14:47:58 26 4
gpt4 key购买 nike

当类型为 11 时,即超出时间,ICMP 数据包负载的大小是多少?
由于它包含一个 IP header 和生成 ICMP 消息的 IP 数据包有效载荷的前 8 个字节,我认为它的大小是 20 + 8 = 28。

我正在使用 TTL=1 重放一些常见的用户流量。在我转储的 ICMP 消息中,我注意到:

  • UDP 数据包生成的所有 ICMP 数据包的有效负载大小为 28 字节
  • 所有由 TCP 数据包生成的有效载荷大小为 40 字节

  • 由于我需要通过比较这些字节来将 ICMP 超时消息与触发它们的数据包进行匹配,因此这条信息必不可少,但我无法弄清楚为什么会发生这种情况。

    最佳答案

    问题是您引用了来自 RFC 792, Page 4 的 8 字节 header 负载。 ,但要求已被 RFC 1812 更改...

    Time Exceeded Message (in RFC 792)

    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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Type | Code | Checksum |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | unused |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Internet Header + 64 bits of Original Data Datagram |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    RFC 1812, Section 4.3.2.3显着增加 ICMP 错误消息中允许的有效负载(强调我的):

    4.3.2.3 Original Message Header

    Historically, every ICMP error message has included the Internetheader and at least the first 8 data bytes of the datagram thattriggered the error. This is no longer adequate, due to the use ofIP-in-IP tunneling and other technologies. Therefore, the ICMPdatagram SHOULD contain as much of the original datagram as possiblewithout the length of the ICMP datagram exceeding 576 bytes. Thereturned IP header (and user data) MUST be identical to that whichwas received, except that the router is not required to undo anymodifications to the IP header that are normally performed inforwarding that were performed before the error was detected (e.g.,decrementing the TTL, or updating options).


    您从 Scapy 数据包生成的 ICMP 错误应包含来自原始数据包的 IP 和 TCP 层的所有信息。

    关于ICMP 类型 11 数据包有效载荷的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11798250/

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