]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ip.c
fix a typo in a comment
[tcpdump] / print-ip.c
index f96ba55973ea32b58905ce69784a1578e89ce23a..bb1554f9d133479e8381494b1a4c379acd4e1b6a 100644 (file)
@@ -330,6 +330,10 @@ again:
        switch (ipds->nh) {
 
        case IPPROTO_AH:
+               if (!ND_TTEST(*ipds->cp)) {
+                       ND_PRINT((ndo, "[|AH]"));
+                       break;
+               }
                ipds->nh = *ipds->cp;
                ipds->advance = ah_print(ndo, ipds->cp);
                if (ipds->advance <= 0)
@@ -354,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:
@@ -526,13 +530,14 @@ ip_print(netdissect_options *ndo,
 
        ipds->ip = (const struct ip *)bp;
        ND_TCHECK(ipds->ip->ip_vhl);
-       if (IP_V(ipds->ip) != 4) { /* print version if != 4 */
+       if (IP_V(ipds->ip) != 4) { /* print version and fail if != 4 */
            if (IP_V(ipds->ip) == 6)
              ND_PRINT((ndo, "IP6, wrong link-layer encapsulation "));
            else
              ND_PRINT((ndo, "IP%u ", IP_V(ipds->ip)));
+           return;
        }
-       else if (!ndo->ndo_eflag)
+       if (!ndo->ndo_eflag)
                ND_PRINT((ndo, "IP "));
 
        ND_TCHECK(*ipds->ip);