]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Add support for NetBSD DLT_PPP_ETHER; adapted from NetBSD changes by
authorguy <guy>
Wed, 20 Jun 2001 07:40:44 +0000 (07:40 +0000)
committerguy <guy>
Wed, 20 Jun 2001 07:40:44 +0000 (07:40 +0000)
Martin Husemann <[email protected]>.

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).

CREDITS
interface.h
print-pppoe.c
tcpdump.c

diff --git a/CREDITS b/CREDITS
index c2e1d3bdb28c6d30f454f69ba2f6c613021c6c36..2c48fd11efe40c2e797abccabcb003974d9b0e8f 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -40,6 +40,7 @@ Additional people who have contributed patches:
        Lennert Buytenhek               <[email protected]>
        Love Hörnquist-Ã…strand          <[email protected]>
        Marko Kiiskila                  <[email protected]>
+       Martin Husemann                 <[email protected]>
        Michael Madore                  <[email protected]>
        Michael Shalayeff               <[email protected]>
        Michael T. Stolarchuk           <[email protected]>
index 7aae65343bcff5f4301c3e4d78b35634be05f4d0..21f2481f67c58c1edf516ae38a43b2de4a7b8a83 100644 (file)
@@ -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);
index dd1e1dfaad51c1275d0752c72326f7cfc57a8d40..5369a9834859dda18d4e029f64ccb23d465b27c7 100644 (file)
@@ -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");
index 2a2c106cb43daa652a1b72e970b6749b17904ba5..9bd2d4fc2104d2802078de632cdc6b78ae938cf7 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -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