]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ip-demux.c
rsvp: fetch a 32-bit quantity into a 32-bit variable.
[tcpdump] / print-ip-demux.c
index 4cab6acce360ad2cb7cdccdfa7d3e3c4924b338a..7df0f7095d72b0a8fb61d6c44120cff49c151a7d 100644 (file)
@@ -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: