IP数据包内的tcp段区域错误?
Error in the tcp segment area inside a IP packet?
IP 网络内部正在使用 IPv4 协议。当数据报通过网络传输时 (TTL=2),在包含带有网页地址的 TCP 段的字段内发生错误。路由器读取这样的数据报会有什么反应?
我已经为这个问题苦苦挣扎了两天。
我知道的:
路由器只读取数据报的报头,如果校验和失败,数据报将被路由器丢弃,
如果报头校验和正确,路由器总是将 TTL 减 1,在 -1 之后,数据报正在转发到网络中的下一个路由器
基于这两点,我得出结论,数据报将走得更远,TTL将为1,路由器将计算新的校验和。
然而,还有 三个其他 问题的可能答案:
- 路由器向源发送 ICMP 错误
- 路由器根据报头校验和修复错误,然后转发数据报
- 路由器将数据报发送出网络(丢弃数据报)
对解决这个问题有什么帮助吗?
IPv4 路由器必须实施的确切算法在 RFC 1812 - Requirements for IP Version 4 Routers. According to the IETF RFC Index 中有所描述,它仍然适用(“状态:当前最佳实践”)。
转发算法见Section 5.2.1。确定步骤之间依赖关系的约束是(引用):
(1) A router MUST verify the IP header, as described in section
[5.2.2], before performing any actions based on the contents of
the header. This allows the router to detect and discard bad
packets before the expenditure of other resources.
(2) Processing of certain IP options requires that the router
insert
its IP address into the option. [...]
(3) The router cannot check and decrement the TTL before checking
whether the packet should be delivered to the router itself, for
reasons mentioned in Section [4.2.2.9].
(4) More generally, when a packet is delivered locally to the
router,
its IP header MUST NOT be modified in any way [...].
接收数据包时执行的实际步骤是(引用):
(1) The router receives the IP packet (plus additional information
about it, as described in Section [3.1]) from the Link Layer.
(2) The router validates the IP header, as described in Section
[5.2.2]. Note that IP reassembly is not done, except on IP
fragments to be queued for local delivery in step (4).
(3) The router performs most of the processing of any IP options.
As
described in Section [5.2.4], some IP options require additional
processing after the routing decision has been made.
(4) The router examines the destination IP address of the IP
datagram, as described in Section [5.2.3], to determine how it
should continue to process the IP datagram. There are three
possibilities:
o The IP datagram is destined for the router, and should be
queued for local delivery, doing reassembly if needed.
o The IP datagram is not destined for the router, and should be
queued for forwarding.
o The IP datagram should be queued for forwarding, but (a copy)
must also be queued for local delivery.
所以很明显首先执行IPv4 header 的校验和验证。 Section 5.2.2 IP Header Validation 中描述了具体步骤,但此处并不重要。重要的是只检查 IP header,不检查内容。因此路由器无法检测到错误。
Based on this two points I conclude that the datagram will go further and TTL will be 1 and new checksum will be calculated by the router.
正确。
至于其他选项:
- The router sends ICMP to source with the error
没有,没有超时错误。至于其他 ICMP 错误,有 none 表示发送方数据包损坏。因此,即使路由器可以检测到数据包损坏(假设损坏位在 IP header 中),它仍然不会发送 ICMP 消息。
- The router repairs the mistake based on the header checksum and then forward the datagram
不,在 IPv4 和 TCP 中执行的校验和仅允许错误检测,而不是纠正。
- The router sends the datagram out of the network (discards the datagram)
它不会丢弃它,因为它没有检测到错误。
关于我在评论中所说的link层错误检测,在传输过程中通常有两个错误来源:(1)来自传输介质(干扰,电缆损坏,插头连接不当等。 ) 和 (2) 来自转发设备本身(有缺陷的存储芯片、固件错误、宇宙射线撞击芯片等)。 link 层通常可以检测甚至可以纠正 (1) 中的错误,但显然不能来自 (2) 中的错误。因此,如果设备故障损坏了数据包内容,问题中描述的场景确实是可能的。
IP 网络内部正在使用 IPv4 协议。当数据报通过网络传输时 (TTL=2),在包含带有网页地址的 TCP 段的字段内发生错误。路由器读取这样的数据报会有什么反应?
我已经为这个问题苦苦挣扎了两天。 我知道的:
路由器只读取数据报的报头,如果校验和失败,数据报将被路由器丢弃,
如果报头校验和正确,路由器总是将 TTL 减 1,在 -1 之后,数据报正在转发到网络中的下一个路由器
基于这两点,我得出结论,数据报将走得更远,TTL将为1,路由器将计算新的校验和。
然而,还有 三个其他 问题的可能答案:
- 路由器向源发送 ICMP 错误
- 路由器根据报头校验和修复错误,然后转发数据报
- 路由器将数据报发送出网络(丢弃数据报)
对解决这个问题有什么帮助吗?
IPv4 路由器必须实施的确切算法在 RFC 1812 - Requirements for IP Version 4 Routers. According to the IETF RFC Index 中有所描述,它仍然适用(“状态:当前最佳实践”)。
转发算法见Section 5.2.1。确定步骤之间依赖关系的约束是(引用):
(1) A router MUST verify the IP header, as described in section [5.2.2], before performing any actions based on the contents of the header. This allows the router to detect and discard bad packets before the expenditure of other resources.
(2) Processing of certain IP options requires that the router insert its IP address into the option. [...]
(3) The router cannot check and decrement the TTL before checking whether the packet should be delivered to the router itself, for reasons mentioned in Section [4.2.2.9].
(4) More generally, when a packet is delivered locally to the router, its IP header MUST NOT be modified in any way [...].
接收数据包时执行的实际步骤是(引用):
(1) The router receives the IP packet (plus additional information about it, as described in Section [3.1]) from the Link Layer.
(2) The router validates the IP header, as described in Section [5.2.2]. Note that IP reassembly is not done, except on IP fragments to be queued for local delivery in step (4).
(3) The router performs most of the processing of any IP options. As described in Section [5.2.4], some IP options require additional processing after the routing decision has been made.
(4) The router examines the destination IP address of the IP datagram, as described in Section [5.2.3], to determine how it should continue to process the IP datagram. There are three possibilities:
o The IP datagram is destined for the router, and should be queued for local delivery, doing reassembly if needed.
o The IP datagram is not destined for the router, and should be queued for forwarding.
o The IP datagram should be queued for forwarding, but (a copy) must also be queued for local delivery.
所以很明显首先执行IPv4 header 的校验和验证。 Section 5.2.2 IP Header Validation 中描述了具体步骤,但此处并不重要。重要的是只检查 IP header,不检查内容。因此路由器无法检测到错误。
Based on this two points I conclude that the datagram will go further and TTL will be 1 and new checksum will be calculated by the router.
正确。
至于其他选项:
- The router sends ICMP to source with the error
没有,没有超时错误。至于其他 ICMP 错误,有 none 表示发送方数据包损坏。因此,即使路由器可以检测到数据包损坏(假设损坏位在 IP header 中),它仍然不会发送 ICMP 消息。
- The router repairs the mistake based on the header checksum and then forward the datagram
不,在 IPv4 和 TCP 中执行的校验和仅允许错误检测,而不是纠正。
- The router sends the datagram out of the network (discards the datagram)
它不会丢弃它,因为它没有检测到错误。
关于我在评论中所说的link层错误检测,在传输过程中通常有两个错误来源:(1)来自传输介质(干扰,电缆损坏,插头连接不当等。 ) 和 (2) 来自转发设备本身(有缺陷的存储芯片、固件错误、宇宙射线撞击芯片等)。 link 层通常可以检测甚至可以纠正 (1) 中的错误,但显然不能来自 (2) 中的错误。因此,如果设备故障损坏了数据包内容,问题中描述的场景确实是可能的。