X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/bef667db65b15c89ec6f1cf325b76acd3c0b8748..0181656313fbe514928263f4061d42d338a5bb7c:/print-ip-demux.c diff --git a/print-ip-demux.c b/print-ip-demux.c index 4cab6acc..7df0f709 100644 --- a/print-ip-demux.c +++ b/print-ip-demux.c @@ -37,7 +37,7 @@ #include "ipproto.h" void -ip_print_demux(netdissect_options *ndo, +ip_demux_print(netdissect_options *ndo, const u_char *bp, u_int length, u_int ver, int fragmented, u_int ttl_hl, uint8_t nh, const u_char *iph) @@ -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,14 +161,18 @@ 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: /* ipv4-in-ip encapsulation */ ip_print(ndo, bp, length); - if (! ndo->ndo_vflag) - ND_PRINT(" (ipip-proto-4)"); break; case IPPROTO_IPV6: