]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Only print the incorporated IP packet if there is one.
authorGuy Harris <[email protected]>
Fri, 19 Dec 2014 09:58:26 +0000 (01:58 -0800)
committerGuy Harris <[email protected]>
Fri, 19 Dec 2014 09:58:26 +0000 (01:58 -0800)
Check for the ICMP types that *do* include an IP packet, rather than
checking for a set that doesn't.  This does a better job of handling
unknown ICMP types.

print-icmp.c

index a86c7f011d9cd65093a844374848fb194d1cd9ed..47ba58924aa4ffdb67100d74183413419c247227 100644 (file)
@@ -145,12 +145,10 @@ struct icmp {
 
 #define        ICMP_MAXTYPE            18
 
-#define        ICMP_INFOTYPE(type) \
-       ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
-       (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
-       (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
-       (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
-       (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+#define ICMP_ERRTYPE(type) \
+       ((type) == ICMP_UNREACH || (type) == ICMP_SOURCEQUENCH || \
+       (type) == ICMP_REDIRECT || (type) == ICMP_TIMXCEED || \
+       (type) == ICMP_PARAMPROB)
 #define        ICMP_MPLS_EXT_TYPE(type) \
        ((type) == ICMP_UNREACH || \
          (type) == ICMP_TIMXCEED || \
@@ -576,7 +574,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
          * print the remnants of the IP packet.
          * save the snaplength as this may get overidden in the IP printer.
          */
-       if (ndo->ndo_vflag >= 1 && !ICMP_INFOTYPE(dp->icmp_type)) {
+       if (ndo->ndo_vflag >= 1 && ICMP_ERRTYPE(dp->icmp_type)) {
                bp += 8;
                ND_PRINT((ndo, "\n\t"));
                ip = (struct ip *)bp;