]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Don't dissect a header with a version field != 4.
authorGuy Harris <[email protected]>
Fri, 19 Dec 2014 06:21:23 +0000 (22:21 -0800)
committerGuy Harris <[email protected]>
Fri, 19 Dec 2014 06:21:23 +0000 (22:21 -0800)
Also, clean up the message printed when it's 6.

print-ip.c

index f178fef359df5e598c3e0fe8cc82ce95e4af77ef..71c7559b25f98f1c1e6ad78054b9765807825072 100644 (file)
@@ -529,9 +529,10 @@ 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 */
-           ND_PRINT((ndo, "IP%u ", IP_V(ipds->ip)));
+           ND_PRINT((ndo, "IP%u", IP_V(ipds->ip)));
            if (IP_V(ipds->ip) == 6)
              ND_PRINT((ndo, ", wrong link-layer encapsulation"));
+           return;
        }
        else if (!ndo->ndo_eflag)
                ND_PRINT((ndo, "IP "));