]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Make "snap_print()" take an argument specifying the padding for bridged
authorguy <guy>
Thu, 11 Jul 2002 08:27:03 +0000 (08:27 +0000)
committerguy <guy>
Thu, 11 Jul 2002 08:27:03 +0000 (08:27 +0000)
LAN frames; it's 0 bytes for Frame Relay and 2 bytes for ATM.

interface.h
print-fr.c
print-llc.c

index 56d507d99a947e60cbe5d3da8d21259a1fceed44..6848d2f1a4c05a8ba321a8f0ed34656210c151ea 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.188 2002-07-11 08:09:46 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.189 2002-07-11 08:27:03 guy Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -198,7 +198,7 @@ extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
 extern int llc_print(const u_char *, u_int, u_int, const u_char *,
        const u_char *, u_short *);
 extern int snap_print(const u_char *, u_int, u_int, const u_char *,
-       const u_char *, u_short *, u_int32_t, u_short);
+       const u_char *, u_short *, u_int32_t, u_short, u_int);
 extern void aarp_print(const u_char *, u_int);
 extern void arp_print(const u_char *, u_int, u_int);
 extern void atalk_print(const u_char *, u_int);
index cdd490630888704024487e5b37608fa9d3561a9d..47eb3ea7d738c94097ba0ceaad828ef56c4b6eb2 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.1 2002-07-11 08:09:47 guy Exp $ (LBL)";
+       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.2 2002-07-11 08:27:03 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -269,7 +269,7 @@ fr_if_print(u_char *user, const struct pcap_pkthdr *h,
                et = EXTRACT_16BITS(p + 3);
                if (snap_print((const u_char *)(p + 5), length - 5,
                           caplen - 5, NULL, NULL,
-                          &extracted_ethertype, orgcode, et) == 0) {
+                          &extracted_ethertype, orgcode, et, 0) == 0) {
                        /* ether_type not known, print raw packet */
                        if (!eflag)
                                fr_hdr_print(p - layer2_len, length + layer2_len);
index 14c30064195d3ffeaaeeb382fdff945caf69b871..1deb7c9160cb613dfbc0e94809566bd965391d72 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.46 2002-07-11 08:09:47 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.47 2002-07-11 08:27:03 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -193,8 +193,13 @@ llc_print(const u_char *p, u_int length, u_int caplen,
 
                orgcode = EXTRACT_24BITS(&llc.llc_orgcode[0]);
                et = EXTRACT_16BITS(&llc.llc_ethertype[0]);
+               /*
+                * XXX - what *is* the right bridge pad value here?
+                * Does anybody ever bridge one form of LAN traffic
+                * over a networking type that uses 802.2 LLC?
+                */
                ret = snap_print(p, length, caplen, esrc, edst,
-                   extracted_ethertype, orgcode, et);
+                   extracted_ethertype, orgcode, et, 2);
                if (ret)
                        return (ret);
        }
@@ -287,7 +292,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
 int
 snap_print(const u_char *p, u_int length, u_int caplen,
     const u_char *esrc, const u_char *edst, u_short *extracted_ethertype,
-    u_int32_t orgcode, u_short et)
+    u_int32_t orgcode, u_short et, u_int bridge_pad)
 {
        register int ret;
 
@@ -342,9 +347,9 @@ snap_print(const u_char *p, u_int length, u_int caplen,
                        /*
                         * Skip the padding.
                         */
-                       caplen -= 2;
-                       length -= 2;
-                       p += 2;
+                       caplen -= bridge_pad;
+                       length -= bridge_pad;
+                       p += bridge_pad;
 
                        /*
                         * What remains is an Ethernet packet.
@@ -362,9 +367,9 @@ snap_print(const u_char *p, u_int length, u_int caplen,
                         * Skip the padding, but not the Access
                         * Control field.
                         */
-                       caplen -= 2;
-                       length -= 2;
-                       p += 2;
+                       caplen -= bridge_pad;
+                       length -= bridge_pad;
+                       p += bridge_pad;
 
                        /*
                         * What remains is an 802.5 Token Ring
@@ -382,9 +387,9 @@ snap_print(const u_char *p, u_int length, u_int caplen,
                        /*
                         * Skip the padding.
                         */
-                       caplen -= 3;
-                       length -= 3;
-                       p += 3;
+                       caplen -= bridge_pad + 1;
+                       length -= bridge_pad + 1;
+                       p += bridge_pad + 1;
 
                        /*
                         * What remains is an FDDI packet.