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)
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:
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);
void
ipN_print(netdissect_options *ndo, register const u_char *bp, register u_int length)
{
- struct ip hdr;
-
- if (length < 4) {
+ if (length < 1) {
ND_PRINT((ndo, "truncated-ip %d", length));
return;
}
- memcpy (&hdr, bp, 4);
- switch (IP_V(&hdr)) {
- case 4:
+
+ ND_TCHECK(*bp);
+ switch (*bp & 0xF0) {
+ case 0x40:
ip_print (ndo, bp, length);
- return;
- case 6:
+ break;
+ case 0x60:
ip6_print (ndo, bp, length);
- return;
+ break;
default:
- ND_PRINT((ndo, "unknown ip %d", IP_V(&hdr)));
- return;
+ ND_PRINT((ndo, "unknown ip %d", (*bp & 0xF0) >> 4));
+ break;
}
+ return;
+
+trunc:
+ ND_PRINT((ndo, "%s", tstr));
+ return;
}
/*