X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/6a66f110963d96a92de4f4d2e757ef2893c3c3ee..b5068d5380c73e02bc35a96f641cad18d9b03f3d:/print-ip-demux.c diff --git a/print-ip-demux.c b/print-ip-demux.c index b6d6b706..7df0f709 100644 --- a/print-ip-demux.c +++ b/print-ip-demux.c @@ -105,11 +105,23 @@ 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: - 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: @@ -149,7 +161,13 @@ again: break; case IPPROTO_IGMP: - igmp_print(ndo, bp, length); + if (ver == 4) + igmp_print(ndo, bp, length); + else { + ND_PRINT("[%s requires IPv4]", + tok2str(ipproto_values,"unknown",nh)); + nd_print_invalid(ndo); + } break; case IPPROTO_IPV4: