]> The Tcpdump Group git mirrors - tcpdump/commitdiff
We no longer use "packetp" for anything, so eliminate it. (If any
authorguy <guy>
Wed, 18 Dec 2002 08:53:18 +0000 (08:53 +0000)
committerguy <guy>
Wed, 18 Dec 2002 08:53:18 +0000 (08:53 +0000)
dissector really needs source and destination MAC addresses, we should
make global pointers to them - which would be null for packets lacking
MAC addresses, so dissectors that need them will need to do something
sensible if those pointers are null.)

Don't fake up an Ethernet header if there aren't any MAC addresses to
use when faking it up.

"bp_chaddr" in "print-bootp.c" is an array, so "bp->bp_chaddr" cannot be
null, and there's no need to test for it not being null.

20 files changed:
interface.h
print-802_11.c
print-arcnet.c
print-atm.c
print-bootp.c
print-chdlc.c
print-cip.c
print-ether.c
print-fddi.c
print-fr.c
print-ipfc.c
print-lane.c
print-null.c
print-pflog.c
print-ppp.c
print-pppoe.c
print-raw.c
print-sl.c
print-sll.c
print-token.c

index e48cf7edc0efb82779ed96876eec3d30b4ef0c8e..36e9229c93d8eea21d1d8e2d8275bcda94e549bb 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.200 2002-12-13 00:40:34 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.201 2002-12-18 08:53:18 guy Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -129,8 +129,7 @@ extern char *program_name;  /* used to generate self-identifying messages */
 extern int32_t thiszone;       /* seconds offset from gmt to local time */
 
 extern int snaplen;
-/* global pointers to beginning and end of current packet (during printing) */
-extern const u_char *packetp;
+/* global pointer to end of current packet (during printing) */
 extern const u_char *snapend;
 
 /*
index cf414d435bcd4f2b0980d54865dc266ecba210b5..1650912d8b836c7bb7f6836f1b2ab658bb492c61 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.16 2002-12-17 09:13:45 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.17 2002-12-18 08:53:19 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -590,7 +590,9 @@ static int ctrl_body_print(u_int16_t fc, const u_char *p)
  *    1    |  1      |  RA    | TA     | DA     | SA
  */
 
-static void data_header_print(u_int16_t fc, const u_char *p)
+static void
+data_header_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
+    const u_int8_t **dstp)
 {
 #define ADDR1  (p + 4)
 #define ADDR2  (p + 10)
@@ -598,23 +600,49 @@ static void data_header_print(u_int16_t fc, const u_char *p)
 #define ADDR4  (p + 24)
 
        if (!FC_TO_DS(fc)) {
-               if (!FC_FROM_DS(fc))
+               if (!FC_FROM_DS(fc)) {
+                       if (srcp != NULL)
+                               *srcp = ADDR2;
+                       if (dstp != NULL)
+                               *dstp = ADDR1;
+                       if (!eflag)
+                               return;
                        printf("DA:%s SA:%s BSSID:%s ",
                            etheraddr_string(ADDR1), etheraddr_string(ADDR2),
                            etheraddr_string(ADDR3));
-               else
+               } else {
+                       if (srcp != NULL)
+                               *srcp = ADDR3;
+                       if (dstp != NULL)
+                               *dstp = ADDR1;
+                       if (!eflag)
+                               return;
                        printf("DA:%s BSSID:%s SA:%s ",
                            etheraddr_string(ADDR1), etheraddr_string(ADDR2),
                            etheraddr_string(ADDR3));
+               }
        } else {
-               if (!FC_FROM_DS(fc))
+               if (!FC_FROM_DS(fc)) {
+                       if (srcp != NULL)
+                               *srcp = ADDR2;
+                       if (dstp != NULL)
+                               *dstp = ADDR3;
+                       if (!eflag)
+                               return;
                        printf("BSSID:%s SA:%s DA:%s ",
                            etheraddr_string(ADDR1), etheraddr_string(ADDR2),
                            etheraddr_string(ADDR3));
-               else
+               } else {
+                       if (srcp != NULL)
+                               *srcp = ADDR4;
+                       if (dstp != NULL)
+                               *dstp = ADDR3;
+                       if (!eflag)
+                               return;
                        printf("RA:%s TA:%s DA:%s SA:%s ",
                            etheraddr_string(ADDR1), etheraddr_string(ADDR2),
                            etheraddr_string(ADDR3), etheraddr_string(ADDR4));
+               }
        }
 
 #undef ADDR1
@@ -624,17 +652,35 @@ static void data_header_print(u_int16_t fc, const u_char *p)
 }
 
 
-static void mgmt_header_print(const u_char *p)
+static void
+mgmt_header_print(const u_char *p, const u_int8_t **srcp,
+    const u_int8_t **dstp)
 {
        const struct mgmt_header_t *hp = (const struct mgmt_header_t *) p;
 
+       if (srcp != NULL)
+               *srcp = hp->sa;
+       if (dstp != NULL)
+               *dstp = hp->da;
+       if (!eflag)
+               return;
+
        printf("BSSID:%s DA:%s SA:%s ",
            etheraddr_string((hp)->bssid), etheraddr_string((hp)->da),
            etheraddr_string((hp)->sa));
 }
 
-static void ctrl_header_print(u_int16_t fc, const u_char *p)
+static void
+ctrl_header_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
+    const u_int8_t **dstp)
 {
+       if (srcp != NULL)
+               *srcp = NULL;
+       if (dstp != NULL)
+               *dstp = NULL;
+       if (!eflag)
+               return;
+
        switch (FC_SUBTYPE(fc)) {
        case CTRL_PS_POLL:
                printf("BSSID:%s TA:%s ",
@@ -666,6 +712,7 @@ static void ctrl_header_print(u_int16_t fc, const u_char *p)
                break;
        default:
                printf("(H) Unknown Ctrl Subtype");
+               break;
        }
 }
 
@@ -718,27 +765,32 @@ static int GetHeaderLength(u_int16_t fc)
 }
 
 /*
- * Print the 802.11 MAC header
+ * Print the 802.11 MAC header if eflag is set, and set "*srcp" and "*dstp"
+ * to point to the source and destination MAC addresses in any case if
+ * "srcp" and "dstp" aren't null.
  */
 static inline void
-ieee_802_11_hdr_print(u_int16_t fc, const u_char *p)
+ieee_802_11_hdr_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
+    const u_int8_t **dstp)
 {
        switch (FC_TYPE(fc)) {
        case T_MGMT:
-               mgmt_header_print(p);
+               mgmt_header_print(p, srcp, dstp);
                break;
 
        case T_CTRL:
-               ctrl_header_print(fc, p);
+               ctrl_header_print(fc, p, srcp, dstp);
                break;
 
        case T_DATA:
-               data_header_print(fc, p);
+               data_header_print(fc, p, srcp, dstp);
                break;
 
        default:
                printf("(header) unknown IEEE802.11 frame type (%d)",
                    FC_TYPE(fc));
+               *srcp = NULL;
+               *dstp = NULL;
                break;
        }
 }
@@ -748,6 +800,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
 {
        u_int16_t fc;
        u_int HEADER_LENGTH;
+       const u_int8_t *src, *dst;
        u_short extracted_ethertype;
 
        if (caplen < IEEE802_11_FC_LEN) {
@@ -763,15 +816,13 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
                return;
        }
 
-       if (eflag)
-               ieee_802_11_hdr_print(fc, p);
+       ieee_802_11_hdr_print(fc, p, &src, &dst);
 
        /*
-        * Some printers want to get back at the ethernet 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        length -= HEADER_LENGTH;
@@ -780,8 +831,8 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
 
        switch (FC_TYPE(fc)) {
        case T_MGMT:
-               if (!mgmt_body_print(fc, (const struct mgmt_header_t *)packetp,
-                   p)) {
+               if (!mgmt_body_print(fc,
+                   (const struct mgmt_header_t *)(p - HEADER_LENGTH), p)) {
                        printf("[|802.11]");
                        return;
                }
@@ -802,14 +853,15 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
                                return;
                        }
                } else {
-                       if (llc_print(p, length, caplen, packetp + 10,
-                           packetp + 4, &extracted_ethertype) == 0) {
+                       if (llc_print(p, length, caplen, dst, src,
+                           &extracted_ethertype) == 0) {
                                /*
                                 * Some kinds of LLC packet we cannot
                                 * handle intelligently
                                 */
                                if (!eflag)
-                                       ieee_802_11_hdr_print(fc, p - HEADER_LENGTH);
+                                       ieee_802_11_hdr_print(fc, p - HEADER_LENGTH,
+                                           NULL, NULL);
                                if (extracted_ethertype) {
                                        printf("(LLC %s) ",
                                            etherproto_string(htons(extracted_ethertype)));
index 56f7f1e3bce25653acdd9b184406dd4f7a141949..30e42a814e3dca2b3cffef111122b5bbb1d41a05 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.10 2002-09-05 21:25:37 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.11 2002-12-18 08:53:19 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -168,11 +168,10 @@ arcnet_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
                arcnet_print(p, length, phds, flag, seqid);
 
        /*
-        * Some printers want to get back at the ethernet 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        length -= archdrlen;
index b1e59850e04ab1d68f916c2bf6bd8d0adef9b0a9..77977b256c19a27eb635ae5489c63793567b15f7 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.30 2002-12-11 06:55:08 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.31 2002-12-18 08:53:19 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -49,27 +49,9 @@ static const char rcsid[] =
 static void
 atm_llc_print(const u_char *p, int length, int caplen)
 {
-       struct ether_header ehdr;
        u_short extracted_ethertype;
 
-       /*
-        * Fake up an Ethernet header for the benefit of printers that
-        * insist on "packetp" pointing to an Ethernet header.
-        */
-       memset(&ehdr, '\0', sizeof ehdr);
-
-       /*
-        * Some printers want to get back at the ethernet addresses.
-        * Rather than pass it all the way down, we set this global.
-        *
-        * Actually, the only printers that use packetp are print-arp.c
-        * and print-bootp.c, and they assume that packetp points to an
-        * Ethernet header.  The right thing to do is to fix them to know
-        * which link type is in use when they excavate. XXX
-        */
-       packetp = (u_char *)&ehdr;
-
-       if (!llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
+       if (!llc_print(p, length, caplen, NULL, NULL,
            &extracted_ethertype)) {
                /* ether_type not known, print raw packet */
                if (extracted_ethertype) {
index ed7c76ab904aa34d33b870d7412da4b270c21da3..ebf4739d660aceb8c6fb302483270192570dd98d 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.68 2002-12-11 07:13:58 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.69 2002-12-18 08:53:20 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -123,19 +123,8 @@ bootp_print(register const u_char *cp, u_short sport, u_short dport, u_int lengt
 
        /* Client's Ethernet address */
        if (bp->bp_htype == 1 && bp->bp_hlen == 6) {
-               register const struct ether_header *eh;
-               register const char *e;
-
                TCHECK2(bp->bp_chaddr[0], 6);
-               eh = (const struct ether_header *)packetp;
-               if (bp->bp_op == BOOTREQUEST)
-                       e = (const char *)ESRC(eh);
-               else if (bp->bp_op == BOOTREPLY)
-                       e = (const char *)EDST(eh);
-               else
-                       e = NULL;
-               if ( bp->bp_chaddr != NULL )
-                    printf("\n\t  Client Ethernet Address: %s", etheraddr_string(bp->bp_chaddr));
+               printf("\n\t  Client Ethernet Address: %s", etheraddr_string(bp->bp_chaddr));
        }
 
        TCHECK2(bp->bp_sname[0], 1);            /* check first char only */
index f958ca4f7a060b5aaa427bb2f27fec1a7c2224da..41a4d521beff38aaf156a0ca387dec3c64ff5b2c 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.24 2002-12-11 07:13:58 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.25 2002-12-18 08:53:20 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -54,11 +54,10 @@ chdlc_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
        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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        chdlc_print(p, length, caplen);
index e986e52c1cdc1ff2d7329e5ac728df64836f4fa5..27986986bcc4e878231065aaa64009aba54ffc6f 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.19 2002-09-05 21:25:38 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.20 2002-12-18 08:53:20 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -85,11 +85,10 @@ cip_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
                cip_print(length);
 
        /*
-        * Some printers want to get back at the ethernet 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        if (memcmp(rfcllc, p, sizeof(rfcllc)) == 0) {
index 5909f4c61223c8760d19f4d8c70d875cd626437d..2d39273006aed43d557b5339e28e73b01632c075 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.73 2002-09-05 21:25:40 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.74 2002-12-18 08:53:21 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -38,7 +38,6 @@ static const char rcsid[] =
 
 #include "ether.h"
 
-const u_char *packetp;
 const u_char *snapend;
 
 static inline void
@@ -76,11 +75,10 @@ ether_print(const u_char *p, u_int length, u_int caplen)
                ether_hdr_print(p, length);
 
        /*
-        * Some printers want to get back at the ethernet 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        length -= ETHER_HDRLEN;
index c97134a6126e6c42b58c903cf58ba66669e51c17..762feaca9f380648e90ef90d5be4c6752e62317d 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.58 2002-09-05 21:25:40 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.59 2002-12-18 08:53:21 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -249,23 +249,18 @@ fddi_print(const u_char *p, u_int length, u_int caplen)
                printf("[|fddi]");
                return;
        }
+
        /*
         * Get the FDDI addresses into a canonical form
         */
        extract_fddi_addrs(fddip, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
+
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
        snapend = p + caplen;
-       /*
-        * Actually, the only printers that use packetp are print-arp.c
-        * and print-bootp.c, and they assume that packetp points to an
-        * Ethernet header.  The right thing to do is to fix them to know
-        * which link type is in use when they excavate. XXX
-        */
-       packetp = (u_char *)&ehdr;
 
        if (eflag)
                fddi_hdr_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
index 13dc8f9b7022d8a2b70a4ce8b09c49c3ffc4f9ed..f639dc620541e34f0b0e0f4f05b35d3d61c29507 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.8 2002-12-11 07:14:00 guy Exp $ (LBL)";
+       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.9 2002-12-18 08:53:21 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -231,11 +231,10 @@ fr_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
        }
 
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        if (eflag)
index bcad6c39cf64cb738224ae5ee91545e47228aec9..a33cfbdf49444bf13311cdbc76f99abaf847f998 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.1 2002-10-18 09:17:48 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.2 2002-12-18 08:53:21 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -92,19 +92,13 @@ ipfc_print(const u_char *p, u_int length, u_int caplen)
         * Get the network addresses into a canonical form
         */
        extract_ipfc_addrs(ipfcp, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
+
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
        snapend = p + caplen;
-       /*
-        * Actually, the only printers that use packetp are print-arp.c
-        * and print-bootp.c, and they assume that packetp points to an
-        * Ethernet header.  The right thing to do is to fix them to know
-        * which link type is in use when they excavate. XXX
-        */
-       packetp = (u_char *)&ehdr;
 
        if (eflag)
                ipfc_hdr_print(ipfcp, length, ESRC(&ehdr), EDST(&ehdr));
index c319e30daeda078f5cb60819f6550e5efa3ef6ed..fe0afb4b718ec8d425a3b0e11c4d1125d367be66 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.17 2002-12-11 07:14:04 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.18 2002-12-18 08:53:22 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -122,11 +122,10 @@ lane_print(const u_char *p, u_int length, u_int caplen)
                lane_hdr_print(p, length);
 
        /*
-        * Some printers want to get back at the ethernet 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p + 2;        /* skip the LECID */
        snapend = p + caplen;
 
        length -= sizeof(struct lecdatahdr_8023);
index cfd41e665706f374a0b573092ce27bafa607e490..cdbb3734bcd02428a9251a29dbba0e8158785319 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.44 2002-09-05 21:25:44 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.45 2002-12-18 08:53:22 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -121,11 +121,10 @@ null_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
                family = SWAPLONG(family);
 
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        length -= NULL_HDRLEN;
index b8485ea5ea299a7a22aabaa5b2b93ec4d4446199..f122a5a33c72371261790deb68a1a6d782fb752f 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.4 2002-09-05 21:25:44 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.5 2002-12-18 08:53:22 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -113,11 +113,10 @@ pflog_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
        }
 
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        hdr = (const struct pfloghdr *)p;
index 8b418a14c21c92334f984fe0a499827696f222e9..6103be4b5830707f7c51b21c67675a95f22d5823 100644 (file)
@@ -31,7 +31,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.77 2002-11-03 23:04:07 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.78 2002-12-18 08:53:23 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1056,11 +1056,10 @@ ppp_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
        }
 
        /*
-        * 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;
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
+        */
        snapend = p + caplen;
 
 #if 0
@@ -1141,11 +1140,10 @@ ppp_hdlc_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
        }
 
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        switch (p[0]) {
@@ -1222,11 +1220,10 @@ ppp_bsdos_if_print(u_char *user _U_, const struct pcap_pkthdr *h _U_,
        }
 
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
        hdrlength = 0;
 
index 3456225bd33d771b74871463528ab2aa0783b53a..3d78f4ceb9ba44f50ca662a203319a9bad8eeebe 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.18 2002-09-05 21:25:45 guy Exp $ (LBL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.19 2002-12-18 08:53:23 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -101,11 +101,10 @@ pppoe_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
        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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        hdr_len = pppoe_print(p, length);
index c8cba8f74394ba35c2381e1671d7e169ab9403d4..88a276f63379610faea7880c32a32ee71faa54ce 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.37 2002-09-05 21:25:46 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.38 2002-12-18 08:53:23 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -51,11 +51,10 @@ raw_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
        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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        if (eflag)
index 4fec3d0906c2d1dcac03513bbd217d456233f77f..7505646270da3e8174fa88c1c237d2f1c0a9fd55 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.59 2002-09-05 21:25:47 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.60 2002-12-18 08:53:24 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -62,12 +62,12 @@ sl_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
                printf("[|slip]");
                goto out;
        }
+
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        length -= SLIP_HDRLEN;
@@ -114,12 +114,12 @@ sl_bsdos_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p
                printf("[|slip]");
                goto out;
        }
+
        /*
-        * 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
-       packetp = p;
        snapend = p + caplen;
 
        length -= SLIP_HDRLEN;
index 7454d334a5c12a5bb6ae80bd0fd50d7dcbf6293e..2cd90f72ace1673f2f37230236bdcaac21c974bc 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.9 2002-09-05 21:25:48 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.10 2002-12-18 08:53:24 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -98,8 +98,6 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
        u_int caplen = h->caplen;
        u_int length = h->len;
        register const struct sll_header *sllp;
-       u_short pkttype;
-       struct ether_header ehdr;
        u_short ether_type;
        u_short extracted_ethertype;
 
@@ -118,61 +116,15 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
 
        sllp = (const struct sll_header *)p;
 
-       /*
-        * Fake up an Ethernet header for the benefit of printers that
-        * insist on "packetp" pointing to an Ethernet header.
-        */
-       pkttype = ntohs(sllp->sll_pkttype);
-
-       /* The source address is in the packet header */
-       memcpy(ehdr.ether_shost, sllp->sll_addr, ETHER_ADDR_LEN);
-
-       if (pkttype != LINUX_SLL_OUTGOING) {
-               /*
-                * We received this packet.
-                *
-                * We don't know the destination address, so
-                * we fake it - all 0's except that the
-                * bottommost bit of the bottommost octet
-                * is set for a unicast packet, all 0's except
-                * that the bottommost bit of the uppermost
-                * octet is set for a multicast packet, all
-                * 1's for a broadcast packet.
-                */
-               if (pkttype == LINUX_SLL_BROADCAST)
-                       memset(ehdr.ether_dhost, 0xFF, ETHER_ADDR_LEN);
-               else {
-                       memset(ehdr.ether_dhost, 0, ETHER_ADDR_LEN);
-                       if (pkttype == LINUX_SLL_MULTICAST)
-                               ehdr.ether_dhost[0] = 1;
-                       else
-                               ehdr.ether_dhost[ETHER_ADDR_LEN-1] = 1;
-               }
-       } else {
-               /*
-                * We sent this packet; we don't know whether it's
-                * broadcast, multicast, or unicast, so just make
-                * the destination address all 0's.
-                */
-               memset(ehdr.ether_dhost, 0, ETHER_ADDR_LEN);
-       }
-
        if (eflag)
                sll_print(sllp, length);
 
        /*
-        * Some printers want to get back at the ethernet 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
        snapend = p + caplen;
-       /*
-        * Actually, the only printers that use packetp are print-arp.c
-        * and print-bootp.c, and they assume that packetp points to an
-        * Ethernet header.  The right thing to do is to fix them to know
-        * which link type is in use when they excavate. XXX
-        */
-       packetp = (u_char *)&ehdr;
 
        length -= SLL_HDR_LEN;
        caplen -= SLL_HDR_LEN;
@@ -203,8 +155,8 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
                         * 802.2.
                         * Try to print the LLC-layer header & higher layers.
                         */
-                       if (llc_print(p, length, caplen, ESRC(&ehdr),
-                           EDST(&ehdr), &extracted_ethertype) == 0)
+                       if (llc_print(p, length, caplen, NULL, NULL,
+                           &extracted_ethertype) == 0)
                                goto unknown;   /* unknown LLC type */
                        break;
 
index 81a3024945ba9a75dec69c8b32b2b2f110816018..5070e5b97ca6aa1acdcdae63737473593dcbf3ae 100644 (file)
@@ -25,7 +25,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.19 2002-09-05 21:25:50 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.20 2002-12-18 08:53:24 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -112,23 +112,18 @@ token_print(const u_char *p, u_int length, u_int caplen)
                printf("[|token-ring]");
                return hdr_len;
        }
+
        /*
         * Get the TR addresses into a canonical form
         */
        extract_token_addrs(trp, (char*)ESRC(&ehdr), (char*)EDST(&ehdr));
+
        /*
-        * Some printers want to get back at the ethernet 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.
+        * Some printers want to check that they're not walking off the
+        * end of the packet.
+        * Rather than pass it all the way down, we set this global.
         */
        snapend = p + caplen;
-       /*
-        * Actually, the only printers that use packetp are print-arp.c
-        * and print-bootp.c, and they assume that packetp points to an
-        * Ethernet header.  The right thing to do is to fix them to know
-        * which link type is in use when they excavate. XXX
-        */
-       packetp = (u_char *)&ehdr;
 
        /* Adjust for source routing information in the MAC header */
        if (IS_SOURCE_ROUTED(trp)) {