Since ICMP and ICMPv6 have different IP protocol numbers, it's technically possible for an IPv4 host to receive an ICMPv6 packet or for an IPv6 host to receive an ICMP packet. Is the host's behavior in this case specified by any standard? I haven't seen anything in any RFC.
-
You cannot put ICMPv6 in an IPv4 packet because you cannot create the ICMPv6 pseudo-header for the required ICMPv6 checksum (the ICMP checksum is optional for IPv4, but required for IPv6) with an IPv4 packet header.– Ron Maupin ♦Commented May 4, 2019 at 21:02
-
Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.– Ron Maupin ♦Commented Dec 27, 2020 at 1:37
2 Answers
RFC 8200 states that the "next header" field in IPv6 uses the same values as the "protocol" field in IPv4.
However, RFC 4443 states:
Every ICMPv6 message is preceded by an IPv6 header ... The ICMPv6 header is identified by a Next Header value of 58 ...
And RFC 792 states:
ICMP messages are sent using the basic IP header.
...
Version
4
I interpret these two statements in the way that ICMP packets are not only identified by the "protocol" or "next header" field, but that this protocol is identified by a logical AND
combination of IP version and "protocol" / "next header" number.
This would mean that a "protocol" value of 58 in an IPv4 packet does not mean ICMPv6 and a "next header" value of 1 in an IPv6 packet does not mean ICMP(v4).
If this interpretation is true, you have to react the same way as if you received a packet with an unknown "protocol" or "next header" number.
ICMPv4 is encapsulated in an IPv4 packet, and ICMPv6 in IPv6. There is no way an IPv4-only host would receive and parse an IPv6 packet (and vice versa).
-
That's not true. The IP protocol number space is shared by both IPv4 and IPv6. While a legal host or router should never generate ICMP-in-IPv6 or ICMPv6-in-IPv4, a misbehaving host or router could, and a host implementation would still need to be able to handle that case.– joshlfCommented May 4, 2019 at 19:38
-
You can't even address an IPv6 packet for an IPv4 destination - how is it supposed to receive the packet? Encapsulating ICMPv6 in IPv4 doesn't make sense.– Zac67 ♦Commented May 4, 2019 at 19:47
-
Let me be more concrete: What happens if I receive an IPv4 packet whose protocol number is set to 58?– joshlfCommented May 4, 2019 at 19:50
-
1Likely, there's no protocol handler registered and the packet is dropped as unknown protocol.– Zac67 ♦Commented May 4, 2019 at 19:55
-
1Given that practically all IPv6 hosts also support IPv4, ICMPv4 in IPv6 could potentially be parsed. However, this is host-specific and becoming off-topic here.– Zac67 ♦Commented May 4, 2019 at 20:20