diff options
author | guy <guy> | 2001-06-20 07:40:44 +0000 |
---|---|---|
committer | guy <guy> | 2001-06-20 07:40:44 +0000 |
commit | b5e3ba55d0c289e07a5e44d5aff9cdd776126bda (patch) | |
tree | 8ba107225db850180bc342ab48ce9a441fd4767b /print-pppoe.c | |
parent | fcbbfeacd86b39cc3e8982e23c8a76f5172e6457 (diff) | |
download | tcpdump-b5e3ba55d0c289e07a5e44d5aff9cdd776126bda.tar.gz |
Add support for NetBSD DLT_PPP_ETHER; adapted from NetBSD changes by
Martin Husemann <martin@netbsd.org>.
Clean up PPPoE dissector - get rid of unused variable, and have it just
use its first argument as a pointer to the PPPoE packet (which may also
make it work if, for example, you have PPPoE packets wrapped inside VLAN
headers).
Diffstat (limited to 'print-pppoe.c')
-rw-r--r-- | print-pppoe.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/print-pppoe.c b/print-pppoe.c index dd1e1dfa..5369a983 100644 --- a/print-pppoe.c +++ b/print-pppoe.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = -"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.13 2001-06-15 07:24:51 itojun Exp $ (LBL)"; +"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.14 2001-06-20 07:40:44 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -94,14 +94,32 @@ static struct tok pppoetag2str[] = { #define PPPOE_HDRLEN 6 void +pppoe_if_print(u_char *user, const struct pcap_pkthdr *h, + register const u_char *p) +{ + register u_int length = h->len; + register u_int caplen = h->caplen; + + ts_print(&h->ts); + + /* + * Some printers want to get back at the link level addresses, + * and/or check that they're not walking off the end of the packet. + * Rather than pass them all the way down, we set these globals. + */ + packetp = p; + snapend = p + caplen; + + pppoe_print(p, length); +} + +void pppoe_print(register const u_char *bp, u_int length) { - const struct ether_header *eh; u_short pppoe_ver, pppoe_type, pppoe_code, pppoe_sessionid, pppoe_length; const u_char *pppoe_packet, *pppoe_payload; - eh = (struct ether_header *)packetp; - pppoe_packet = packetp + ETHER_HDRLEN; + pppoe_packet = bp; if (pppoe_packet > snapend) { printf("[|pppoe]"); return; @@ -112,7 +130,7 @@ pppoe_print(register const u_char *bp, u_int length) pppoe_code = pppoe_packet[1]; pppoe_sessionid = EXTRACT_16BITS(pppoe_packet + 2); pppoe_length = EXTRACT_16BITS(pppoe_packet + 4); - pppoe_payload = pppoe_packet + 6; + pppoe_payload = pppoe_packet + PPPOE_HDRLEN; if (snapend < pppoe_payload) { printf(" truncated PPPoE"); |