mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-27 12:03:44 +08:00
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).
This commit is contained in:
parent
fcbbfeacd8
commit
b5e3ba55d0
1
CREDITS
1
CREDITS
@ -40,6 +40,7 @@ Additional people who have contributed patches:
|
||||
Lennert Buytenhek <buytenh@gnu.org>
|
||||
Love Hörnquist-Åstrand <lha@stacken.kth.se>
|
||||
Marko Kiiskila <carnil@cs.tut.fi>
|
||||
Martin Husemann <martin@netbsd.org>
|
||||
Michael Madore <mmadore@turbolinux.com>
|
||||
Michael Shalayeff <mickey@openbsd.org>
|
||||
Michael T. Stolarchuk <mts@off.to>
|
||||
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.161 2001-06-18 08:52:52 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.162 2001-06-20 07:40:44 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_interface_h
|
||||
@ -237,6 +237,8 @@ extern void ppp_hdlc_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern void ppp_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern void pppoe_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern int vjc_print(register const char *, register u_int, u_short);
|
||||
extern void raw_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void rip_print(const u_char *, u_int);
|
||||
|
@ -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
|
||||
@ -93,15 +93,33 @@ 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");
|
||||
|
@ -24,7 +24,7 @@ static const char copyright[] =
|
||||
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.163 2001-06-18 08:52:54 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.164 2001-06-20 07:40:45 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -131,6 +131,9 @@ static struct printer printers[] = {
|
||||
#ifdef DLT_PPP_SERIAL
|
||||
{ ppp_hdlc_if_print, DLT_PPP_SERIAL },
|
||||
#endif
|
||||
#ifdef DLT_PPP_ETHER
|
||||
{ pppoe_if_print, DLT_PPP_ETHER },
|
||||
#endif
|
||||
#ifdef DLT_LINUX_SLL
|
||||
{ sll_if_print, DLT_LINUX_SLL },
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user