Add support for decoding PPPoE packages on an ethernet interface.

This commit is contained in:
tron 2001-05-06 07:57:08 +00:00
parent 1cf95850b2
commit 90eb7ba34c
3 changed files with 22 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: interface.h,v 1.19 2001/04/14 12:31:34 martin Exp $ */ /* $NetBSD: interface.h,v 1.20 2001/05/06 07:57:08 tron Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@ -240,7 +240,9 @@ extern void ospf_print(const u_char *, u_int, const u_char *);
extern void igmp_pim_print(const u_char *, u_int); extern void igmp_pim_print(const u_char *, u_int);
extern void pim_print(const u_char *, u_int); extern void pim_print(const u_char *, u_int);
extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); extern void ppp_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 void pppoe_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void pppoe_encap_print(const u_char *, u_int, u_int);
extern void ppp_bsdos_if_print(u_char *, const struct pcap_pkthdr *, extern void ppp_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *); const u_char *);
extern void ppp_netbsd_serial_if_print(u_char *, const struct pcap_pkthdr *, extern void ppp_netbsd_serial_if_print(u_char *, const struct pcap_pkthdr *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: print-ether.c,v 1.8 2000/07/26 10:48:15 ad Exp $ */ /* $NetBSD: print-ether.c,v 1.9 2001/05/06 07:57:08 tron Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@ -26,7 +26,7 @@
static const char rcsid[] = static const char rcsid[] =
"@(#) Header: print-ether.c,v 1.44 97/05/26 17:18:13 leres Exp (LBL)"; "@(#) Header: print-ether.c,v 1.44 97/05/26 17:18:13 leres Exp (LBL)";
#else #else
__RCSID("$NetBSD: print-ether.c,v 1.8 2000/07/26 10:48:15 ad Exp $"); __RCSID("$NetBSD: print-ether.c,v 1.9 2001/05/06 07:57:08 tron Exp $");
#endif #endif
#endif #endif
@ -230,6 +230,10 @@ ether_encap_print(u_short ethertype, const u_char *p,
} }
return (1); return (1);
case ETHERTYPE_PPPOE:
pppoe_encap_print(p, length, caplen);
return (1);
case ETHERTYPE_LAT: case ETHERTYPE_LAT:
case ETHERTYPE_SCA: case ETHERTYPE_SCA:
case ETHERTYPE_MOPRC: case ETHERTYPE_MOPRC:

View File

@ -1,4 +1,4 @@
/* $NetBSD: print-pppoe.c,v 1.2 2001/04/29 10:27:03 martin Exp $ */ /* $NetBSD: print-pppoe.c,v 1.3 2001/05/06 07:57:08 tron Exp $ */
/* /*
* Copied from print-ppp.c, slightly modified to work with the temporary * Copied from print-ppp.c, slightly modified to work with the temporary
@ -32,7 +32,7 @@
static const char rcsid[] = static const char rcsid[] =
"@(#) Header: print-ppp.c,v 1.26 97/06/12 14:21:29 leres Exp (LBL)"; "@(#) Header: print-ppp.c,v 1.26 97/06/12 14:21:29 leres Exp (LBL)";
#else #else
__RCSID("$NetBSD: print-pppoe.c,v 1.2 2001/04/29 10:27:03 martin Exp $"); __RCSID("$NetBSD: print-pppoe.c,v 1.3 2001/05/06 07:57:08 tron Exp $");
#endif #endif
#endif #endif
@ -73,16 +73,23 @@ struct rtentry;
#define PPP_SHORT_HDRLEN 2 #define PPP_SHORT_HDRLEN 2
/* PPPoE printer */ /* PPPoE printer */
void void
pppoe_if_print(u_char *user, const struct pcap_pkthdr *h, pppoe_if_print(u_char *user, const struct pcap_pkthdr *h,
register const u_char *p) register const u_char *p)
{ {
register u_int length = h->len; register u_int length = h->len;
register u_int caplen = h->caplen; register u_int caplen = h->caplen;
const struct ip *ip;
u_int proto;
ts_print(&h->ts); ts_print(&h->ts);
pppoe_encap_print(p, length, caplen);
}
void
pppoe_encap_print(const u_char *p, u_int length, u_int caplen)
{
const struct ip *ip;
u_int proto;
if (caplen < PPPOE_HDRLEN+PPP_SHORT_HDRLEN) { if (caplen < PPPOE_HDRLEN+PPP_SHORT_HDRLEN) {
printf("[|pppoe]"); printf("[|pppoe]");