X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e3b8b6f5cb34b8a39f7bb105ca42b9589e454593..a10ab62bf4f611c63b479df48ab8c9192fa0b281:/print-ip-demux.c diff --git a/print-ip-demux.c b/print-ip-demux.c index d3f03b66..a0a6fbd1 100644 --- a/print-ip-demux.c +++ b/print-ip-demux.c @@ -27,8 +27,6 @@ #include "netdissect-stdinc.h" -#include - #include "netdissect.h" #include "addrtoname.h" #include "extract.h" @@ -105,7 +103,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: @@ -155,7 +159,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: @@ -188,7 +198,7 @@ again: if (ndo->ndo_packettype == PT_CARP) { carp_print(ndo, bp, length, ttl_hl); } else { - vrrp_print(ndo, bp, length, iph, ttl_hl); + vrrp_print(ndo, bp, length, iph, ttl_hl, ver); } break; @@ -196,6 +206,16 @@ again: pgm_print(ndo, bp, length, iph); break; + case IPPROTO_ETHERNET: + if (ver == 6) + ether_print(ndo, bp, length, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL); + else { + ND_PRINT("[%s requires IPv6]", + tok2str(ipproto_values,"unknown",nh)); + nd_print_invalid(ndo); + } + break; + case IPPROTO_NONE: ND_PRINT("no next header"); break;