]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-sll.c
When checking for pcap_if_t, add $V_INCLS to CFLAGS, so we look at the
[tcpdump] / print-sll.c
index ccb94fb53cc850a4a19ac3a1d08c0b13f28b46d8..8c3d4b3da491a2084238703e53b8503b34f8a065 100644 (file)
@@ -19,8 +19,8 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 #ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.11 2002-12-18 09:41:18 guy Exp $ (LBL)";
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.15 2004-03-17 23:24:38 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -89,23 +89,18 @@ sll_print(register const struct sll_header *sllp, u_int length)
 /*
  * This is the top level routine of the printer.  'p' points to the
  * Linux "cooked capture" header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
-void
-sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
+u_int
+sll_if_print(const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int caplen = h->caplen;
        u_int length = h->len;
-       const u_char *orig_p;
-       u_int orig_caplen;
        register const struct sll_header *sllp;
        u_short ether_type;
        u_short extracted_ethertype;
 
-       ++infodelay;
-       ts_print(&h->ts);
-
        if (caplen < SLL_HDR_LEN) {
                /*
                 * XXX - this "can't happen" because "pcap-linux.c" always
@@ -113,7 +108,7 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
                 * cooked socket capture.
                 */
                printf("[|sll]");
-               goto out;
+               return (caplen);
        }
 
        sllp = (const struct sll_header *)p;
@@ -121,20 +116,6 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
        if (eflag)
                sll_print(sllp, length);
 
-       /*
-        * 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;
-
-       /*
-        * Save the information for the full packet, so we can print
-        * everything if "-e" and "-x" are both specified.
-        */
-       orig_p = p;
-       orig_caplen = caplen;
-
        /*
         * Go past the cooked-mode header.
         */
@@ -193,11 +174,6 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
                if (!xflag && !qflag)
                        default_print(p, caplen);
        }
-       if (xflag)
-               default_print_packet(orig_p, orig_caplen, SLL_HDR_LEN);
- out:
-       putchar('\n');
-       --infodelay;
-       if (infoprint)
-               info(0);
+
+       return (SLL_HDR_LEN);
 }