]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ip6.c
Regenerate config files.
[tcpdump] / print-ip6.c
index c58113006f693e507f9d3494fd10237b6e7e3d68..9f590f2af4e1a8763a31b64e2330f7d57868d801 100644 (file)
@@ -293,15 +293,19 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
                switch (nh) {
                case IPPROTO_HOPOPTS:
                        advance = hbhopt_print(ndo, cp);
+                       if (advance < 0)
+                               return;
                        nh = *cp;
                        break;
                case IPPROTO_DSTOPTS:
                        advance = dstopt_print(ndo, cp);
+                       if (advance < 0)
+                               return;
                        nh = *cp;
                        break;
                case IPPROTO_FRAGMENT:
                        advance = frag6_print(ndo, cp, (const u_char *)ip6);
-                       if (ndo->ndo_snapend <= cp + advance)
+                       if (advance < 0 || ndo->ndo_snapend <= cp + advance)
                                return;
                        nh = *cp;
                        fragmented = 1;
@@ -353,9 +357,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;
                    }