]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IPv4/IPv6 demux: ICMPv4 in IPv6 is invalid
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 11 Apr 2020 14:02:13 +0000 (16:02 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 11 Apr 2020 14:02:13 +0000 (16:02 +0200)
"  ICMP messages are sent using the basic IP header.
   ...
   Version

      4"
(RFC 792)

print-ip-demux.c

index d3f03b66d292ffeb63ff9af41231a4e85e95bb15..9d562d775ee9df54a4d0c88b63c659462defed32 100644 (file)
@@ -105,7 +105,13 @@ again:
                break;
 
        case IPPROTO_ICMP:
-               icmp_print(ndo, bp, length, iph, fragmented);
+               if (ver == 4)
+                       icmp_print(ndo, bp, length, iph, fragmented);
+               else {
+                       ND_PRINT("[%s requires IPv4]",
+                                tok2str(ipproto_values,"unknown",nh));
+                       nd_print_invalid(ndo);
+               }
                break;
 
        case IPPROTO_ICMPV6: