X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/7885cfa165458a05ef818c34ee03affc79f03725..b51a0dafc7861eb31d21524ec067d7c529a664b8:/print-pppoe.c diff --git a/print-pppoe.c b/print-pppoe.c index 28b80fc8..65518dff 100644 --- a/print-pppoe.c +++ b/print-pppoe.c @@ -31,6 +31,7 @@ #include "netdissect-ctype.h" +#define ND_LONGJMP_FROM_TCHECK #include "netdissect.h" #include "extract.h" @@ -86,11 +87,11 @@ static const struct tok pppoetag2str[] = { #define PPPOE_HDRLEN 6 #define MAXTAGPRINT 80 -u_int +void pppoe_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { - ndo->ndo_protocol = "pppoe_if"; - return (pppoe_print(ndo, p, h->len)); + ndo->ndo_protocol = "pppoe"; + ndo->ndo_ll_hdr_len += pppoe_print(ndo, p, h->len); } u_int @@ -102,8 +103,8 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length) ndo->ndo_protocol = "pppoe"; if (length < PPPOE_HDRLEN) { - ND_PRINT("truncated-pppoe %u", length); - return (length); + ND_PRINT(" (length %u < %u)", length, PPPOE_HDRLEN); + goto invalid; } length -= PPPOE_HDRLEN; pppoe_packet = bp; @@ -145,7 +146,6 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length) * tag_type is previous tag or 0xffff for first iteration */ while (tag_type && p < pppoe_payload + pppoe_length) { - ND_TCHECK_4(p); tag_type = GET_BE_U_2(p); tag_len = GET_BE_U_2(p + 2); p += 4; @@ -192,14 +192,15 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length) p += tag_len; /* p points to next tag */ } - return (0); + return PPPOE_HDRLEN; } else { /* PPPoE data */ ND_PRINT(" "); return (PPPOE_HDRLEN + ppp_print(ndo, pppoe_payload, pppoe_length)); } + /* NOTREACHED */ -trunc: - nd_print_trunc(ndo); - return (PPPOE_HDRLEN); +invalid: + nd_print_invalid(ndo); + return 0; }