]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Stop processing IPPROTO_ values once we hit IPPROTO_IPCOMP.
authorGuy Harris <[email protected]>
Sun, 5 Jul 2015 01:45:11 +0000 (18:45 -0700)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 18 Jan 2017 08:16:37 +0000 (09:16 +0100)
It's not like, for example, AH or ESP, where, following the header for
that protocol, there's another protocol with its own payload.

configure
configure.in
netdissect.h
print-ip.c
print-ip6.c
print-ipcomp.c

index 0a0dfdc12d83f346aab2d5f68bf23a8aee273d9c..03c69c582cabfac417c65ff69961dfce88ad665e 100755 (executable)
--- a/configure
+++ b/configure
@@ -5451,7 +5451,6 @@ fi
 
 
 
-
                 LBL_LIBS="$LIBS"
     pfopen=/usr/examples/packetfilter/pfopen.c
     if test -f $pfopen ; then
index d7484ede34bfe34b9982eec63b8335d91568db1f..a78a12666347f6871966c8a1b209e82fa3f66a57 100644 (file)
@@ -418,9 +418,6 @@ dnl Some platforms may need -lnsl for getrpcbynumber.
 AC_SEARCH_LIBS(getrpcbynumber, nsl,
     AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
 
-dnl AC_CHECK_LIB(z, uncompress)
-dnl AC_CHECK_HEADERS(zlib.h)
-
 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
 
 #
index 3bba2cb1af85d64b1a0fa4a86911e98df37affeb..ea77e74d4632acfc992fdae46e482702e162605f 100644 (file)
@@ -524,7 +524,7 @@ extern void ip6_print(netdissect_options *, const u_char *, u_int);
 extern void ipN_print(netdissect_options *, const u_char *, u_int);
 extern void ip_print(netdissect_options *, const u_char *, u_int);
 extern void ip_print_inner(netdissect_options *, const u_char *, u_int, u_int nh, const u_char *);
-extern int ipcomp_print(netdissect_options *, register const u_char *, int *);
+extern void ipcomp_print(netdissect_options *, register const u_char *);
 extern void ipx_netbios_print(netdissect_options *, const u_char *, u_int);
 extern void ipx_print(netdissect_options *, const u_char *, u_int);
 extern void isakmp_print(netdissect_options *, const u_char *, u_int, const u_char *);
index 38cc2315e81a03d6cfc94989f8fc4c44de57d82c..bb1554f9d133479e8381494b1a4c379acd4e1b6a 100644 (file)
@@ -358,14 +358,14 @@ again:
 
        case IPPROTO_IPCOMP:
        {
-               int enh;
-               ipds->advance = ipcomp_print(ndo, ipds->cp, &enh);
-               if (ipds->advance <= 0)
-                       break;
-               ipds->cp += ipds->advance;
-               ipds->len -= ipds->advance;
-               ipds->nh = enh & 0xff;
-               goto again;
+               ipcomp_print(ndo, ipds->cp);
+               /*
+                * Either this has decompressed the payload and
+                * printed it, in which case there's nothing more
+                * to do, or it hasn't, in which case there's
+                * nothing more to do.
+                */
+               break;
        }
 
        case IPPROTO_SCTP:
index c58113006f693e507f9d3494fd10237b6e7e3d68..2e1803f05d5155cf0ce6d1d1825f92ab40a26480 100644 (file)
@@ -353,9 +353,14 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
                    }
                case IPPROTO_IPCOMP:
                    {
-                       int enh;
-                       advance = ipcomp_print(ndo, cp, &enh);
-                       nh = enh & 0xff;
+                       ipcomp_print(ndo, cp);
+                       /*
+                        * Either this has decompressed the payload and
+                        * printed it, in which case there's nothing more
+                        * to do, or it hasn't, in which case there's
+                        * nothing more to do.
+                        */
+                       advance = -1;
                        break;
                    }
 
index 354eef3551e128da4e53e33742f25e50495cfcb6..291caa97d81de5d465008fcbe1957a7cd3930700 100644 (file)
@@ -33,49 +33,37 @@ struct ipcomp {
        uint16_t comp_cpi;      /* Compression parameter index */
 };
 
-#if defined(HAVE_LIBZ) && defined(HAVE_ZLIB_H)
-#include <zlib.h>
-#endif
-
 #include "netdissect.h"
 #include "extract.h"
 
-int
-ipcomp_print(netdissect_options *ndo, register const u_char *bp, int *nhdr _U_)
+void
+ipcomp_print(netdissect_options *ndo, register const u_char *bp)
 {
        register const struct ipcomp *ipcomp;
        uint16_t cpi;
-#if defined(HAVE_LIBZ) && defined(HAVE_ZLIB_H)
-       int advance;
-#endif
 
        ipcomp = (const struct ipcomp *)bp;
-       ND_TCHECK(ipcomp->comp_cpi);
+       ND_TCHECK(*ipcomp);
        cpi = EXTRACT_16BITS(&ipcomp->comp_cpi);
 
        ND_PRINT((ndo, "IPComp(cpi=0x%04x)", cpi));
 
-#if defined(HAVE_LIBZ) && defined(HAVE_ZLIB_H)
-       if (1)
-               goto fail;
-
        /*
-        * We may want to decompress the packet here.  Packet buffer
-        * management is a headache (if we decompress, packet will become
-        * larger).
+        * XXX - based on the CPI, we could decompress the packet here.
+        * Packet buffer management is a headache (if we decompress,
+        * packet will become larger).
+        *
+        * We would decompress the packet and then call a routine that,
+        * based on ipcomp->comp_nxt, dissects the decompressed data.
+        *
+        * Until we do that, however, we just return -1, so that
+        * the loop that processes "protocol"/"next header" types
+        * stops - there's nothing more it can do with a compressed
+        * payload.
         */
-       if (nhdr)
-               *nhdr = ipcomp->comp_nxt;
-       advance = sizeof(struct ipcomp);
+       return;
 
-       ND_PRINT((ndo, ": "));
-       return advance;
-
-#endif
 trunc:
        ND_PRINT((ndo, "[|IPCOMP]"));
-#if defined(HAVE_LIBZ) && defined(HAVE_ZLIB_H)
-fail:
-#endif
-       return -1;
+       return;
 }