]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IPv4/IPv6 demux: ICMPv6 in IPv4 is invalid
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 11 Apr 2020 13:50:32 +0000 (15:50 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 11 Apr 2020 13:50:32 +0000 (15:50 +0200)
"  Every ICMPv6 message is preceded by an IPv6 header and zero or more
   IPv6 extension headers.  The ICMPv6 header is identified by a Next
   Header value of 58 in the immediately preceding header."
(RFC 4443)

print-ip-demux.c

index b6d6b7066850d3babbd26569fadd5bef73c912a2..d3f03b66d292ffeb63ff9af41231a4e85e95bb15 100644 (file)
@@ -109,7 +109,13 @@ again:
                break;
 
        case IPPROTO_ICMPV6:
-               icmp6_print(ndo, bp, length, iph, fragmented);
+               if (ver == 6)
+                       icmp6_print(ndo, bp, length, iph, fragmented);
+               else {
+                       ND_PRINT("[%s requires IPv6]",
+                                tok2str(ipproto_values,"unknown",nh));
+                       nd_print_invalid(ndo);
+               }
                break;
 
        case IPPROTO_PIGP: