summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netdissect.h2
-rw-r--r--print-pppoe.c21
-rw-r--r--print.c6
3 files changed, 17 insertions, 12 deletions
diff --git a/netdissect.h b/netdissect.h
index 6c384439..2c2ad061 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -516,7 +516,7 @@ extern void ppi_if_print IF_PRINTER_ARGS;
extern u_int ppp_bsdos_if_print IF_PRINTER_ARGS;
extern u_int ppp_hdlc_if_print IF_PRINTER_ARGS;
extern u_int ppp_if_print IF_PRINTER_ARGS;
-extern u_int pppoe_if_print IF_PRINTER_ARGS;
+extern void pppoe_if_print IF_PRINTER_ARGS;
extern u_int prism_if_print IF_PRINTER_ARGS;
extern void raw_if_print IF_PRINTER_ARGS;
extern void sl_bsdos_if_print IF_PRINTER_ARGS;
diff --git a/print-pppoe.c b/print-pppoe.c
index 28b80fc8..9452b19e 100644
--- a/print-pppoe.c
+++ b/print-pppoe.c
@@ -86,24 +86,29 @@ 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
pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length)
{
uint16_t pppoe_ver, pppoe_type, pppoe_code, pppoe_sessionid;
- u_int pppoe_length;
+ u_int pppoe_length, caplen;
const u_char *pppoe_packet, *pppoe_payload;
ndo->ndo_protocol = "pppoe";
+ caplen = ndo->ndo_snapend - bp;
+ if (caplen < PPPOE_HDRLEN) {
+ nd_print_trunc(ndo);
+ return caplen;
+ }
if (length < PPPOE_HDRLEN) {
- ND_PRINT("truncated-pppoe %u", length);
- return (length);
+ nd_print_trunc(ndo);
+ return length;
}
length -= PPPOE_HDRLEN;
pppoe_packet = bp;
@@ -192,7 +197,7 @@ 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(" ");
@@ -201,5 +206,5 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length)
trunc:
nd_print_trunc(ndo);
- return (PPPOE_HDRLEN);
+ return PPPOE_HDRLEN;
}
diff --git a/print.c b/print.c
index 7f644e08..0eef3bb0 100644
--- a/print.c
+++ b/print.c
@@ -80,9 +80,6 @@ static const struct uint_printer uint_printers[] = {
#ifdef DLT_HDLC
{ chdlc_if_print, DLT_HDLC },
#endif
-#ifdef DLT_PPP_ETHER
- { pppoe_if_print, DLT_PPP_ETHER },
-#endif
#if defined(DLT_PFLOG) && defined(HAVE_NET_IF_PFLOG_H)
{ pflog_if_print, DLT_PFLOG },
#endif
@@ -229,6 +226,9 @@ static const struct void_printer void_printers[] = {
#ifdef DLT_PPI
{ ppi_if_print, DLT_PPI },
#endif
+#ifdef DLT_PPP_ETHER
+ { pppoe_if_print, DLT_PPP_ETHER },
+#endif
{ raw_if_print, DLT_RAW },
#ifdef DLT_IPV4
{ raw_if_print, DLT_IPV4 },