]> The Tcpdump Group git mirrors - libpcap/commitdiff
Add a "netbeui" keyword, which selects NetBEUI packets (LLC packets with
authorguy <guy>
Sun, 28 Jan 2001 09:44:48 +0000 (09:44 +0000)
committerguy <guy>
Sun, 28 Jan 2001 09:44:48 +0000 (09:44 +0000)
0xf0 as the DSAP and SSAP).

Let "ipx" work on non-Ethernet 802.2 frames - we assume they're always
frames with the IPX DSAP.

gencode.c
gencode.h
grammar.y
llc.h
scanner.l

index 65d18ec9a2928d022ad01c63df240e807c34ec02..711acfc1fd505f50301aa69be6b9697fe29b6462 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -21,7 +21,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.146 2001-01-15 00:03:40 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.147 2001-01-28 09:44:48 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -721,6 +721,20 @@ gen_linktype(proto)
                        gen_and(b0, b1);
                        return b1;
 
+               case LLCSAP_NETBEUI:
+                       /*
+                        * NetBEUI always uses 802.2 encapsulation.
+                        * XXX - should we check both the DSAP and the
+                        * SSAP, like this, or should we check just the
+                        * DSAP?
+                        */
+                       b0 = gen_cmp_gt(off_linktype, BPF_H, ETHERMTU);
+                       gen_not(b0);
+                       b1 = gen_cmp(off_linktype + 2, BPF_H, (bpf_int32)
+                                    ((LLCSAP_NETBEUI << 8) | LLCSAP_NETBEUI));
+                       gen_and(b0, b1);
+                       return b1;
+
                case LLCSAP_IPX:
                        /*
                         * Check for;
@@ -879,6 +893,18 @@ gen_linktype(proto)
                        return gen_cmp(off_linktype, BPF_H, (long)
                                     ((LLCSAP_ISONS << 8) | LLCSAP_ISONS));
 
+               case LLCSAP_NETBEUI:
+                       return gen_cmp(off_linktype, BPF_H, (long)
+                                    ((LLCSAP_NETBEUI << 8) | LLCSAP_NETBEUI));
+
+               case LLCSAP_IPX:
+                       /*
+                        * XXX - are there ever SNAP frames for IPX on
+                        * non-Ethernet 802.x networks?
+                        */
+                       return gen_cmp(off_linktype, BPF_B,
+                           (bpf_int32)LLCSAP_IPX);
+
                case ETHERTYPE_ATALK:
                        /*
                         * 802.2-encapsulated ETHERTYPE_ATALK packets are
@@ -950,6 +976,19 @@ gen_linktype(proto)
                        gen_and(b0, b1);
                        return b1;
 
+               case LLCSAP_NETBEUI:
+                       /*
+                        * NetBEUI always uses 802.2 encapsulation.
+                        * XXX - should we check both the DSAP and the
+                        * LSAP, like this, or should we check just the
+                        * DSAP?
+                        */
+                       b0 = gen_cmp(off_linktype, BPF_H, LINUX_SLL_P_802_2);
+                       b1 = gen_cmp(off_linktype + 2, BPF_H, (bpf_int32)
+                                    ((LLCSAP_NETBEUI << 8) | LLCSAP_NETBEUI));
+                       gen_and(b0, b1);
+                       return b1;
+
                case LLCSAP_IPX:
                        /*
                         *      Ethernet_II frames, which are Ethernet
@@ -1712,6 +1751,9 @@ gen_host(addr, mask, proto, dir)
        case Q_IPX:
                bpf_error("IPX host filtering not implemented");
 
+       case Q_NETBEUI:
+               bpf_error("'netbeui' modifier applied to host");
+
        default:
                abort();
        }
@@ -1810,6 +1852,9 @@ gen_host6(addr, mask, proto, dir)
        case Q_IPX:
                bpf_error("IPX host filtering not implemented");
 
+       case Q_NETBEUI:
+               bpf_error("'netbeui' modifier applied to host");
+
        default:
                abort();
        }
@@ -2020,6 +2065,10 @@ gen_proto_abbrev(proto)
                b1 = gen_linktype(LLCSAP_IPX);
                break;
 
+       case Q_NETBEUI:
+               b1 = gen_linktype(LLCSAP_NETBEUI);
+               break;
+
        default:
                abort();
        }
@@ -2682,6 +2731,9 @@ gen_proto(v, proto, dir)
        case Q_IPX:
                bpf_error("'ipx proto' is bogus");
 
+       case Q_NETBEUI:
+               bpf_error("'netbeui proto' is bogus");
+
        default:
                abort();
                /* NOTREACHED */
index c451426040d8f43405a42920f41fdfa61d155a09..fa76fcbfaf342cf6d3797456959f0224315d1bbd 100644 (file)
--- a/gencode.h
+++ b/gencode.h
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.49 2001-01-14 07:57:48 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.50 2001-01-28 09:44:49 guy Exp $ (LBL)
  */
 
 /* Address qualifiers. */
@@ -69,6 +69,8 @@
 
 #define Q_IPX          27
 
+#define Q_NETBEUI      28
+
 /* Directional qualifiers. */
 
 #define Q_SRC          1
index 3e9025205e165a7dfe5004371256766d92eb1b0b..3b26e27002b7dc23e8bf28b5b5067b863f8dadd9 100644 (file)
--- a/grammar.y
+++ b/grammar.y
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.66 2001-01-14 07:57:48 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.67 2001-01-28 09:44:50 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -120,6 +120,7 @@ pcap_parse()
 %token  ISO ESIS ISIS CLNP
 %token  STP
 %token  IPX
+%token  NETBEUI
 
 %type  <s> ID
 %type  <e> EID
@@ -267,6 +268,7 @@ pname:        LINK                  { $$ = Q_LINK; }
        | CLNP                  { $$ = Q_CLNP; }
        | STP                   { $$ = Q_STP; }
        | IPX                   { $$ = Q_IPX; }
+       | NETBEUI               { $$ = Q_NETBEUI; }
        ;
 other:   pqual TK_BROADCAST    { $$ = gen_broadcast($1); }
        | pqual TK_MULTICAST    { $$ = gen_multicast($1); }
diff --git a/llc.h b/llc.h
index f07452338d6194d5f57b9354feeaef4a14948c30..b8c221fa0bf53b3ce6c696fb715267be44812fe3 100644 (file)
--- a/llc.h
+++ b/llc.h
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/libpcap/llc.h,v 1.1 2001-01-14 21:26:53 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/llc.h,v 1.2 2001-01-28 09:44:50 guy Exp $ (LBL)
  */
 
 /*
 #ifndef LLCSAP_SNAP
 #define        LLCSAP_SNAP             0xaa
 #endif
-#ifndef LLCSAP_ISONS
-#define        LLCSAP_ISONS            0xfe
-#endif
 #ifndef LLCSAP_IPX
 #define LLCSAP_IPX             0xe0
 #endif
+#ifndef LLCSAP_NETBEUI
+#define LLCSAP_NETBEUI         0xf0
+#endif
+#ifndef LLCSAP_ISONS
+#define        LLCSAP_ISONS            0xfe
+#endif
index 4ef4803b51a2c8bf199150149316ed521c82f808..b6ed45accfdefa53907aa8cca4f2e9b679e519ed 100644 (file)
--- a/scanner.l
+++ b/scanner.l
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.72 2001-01-14 07:57:49 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.73 2001-01-28 09:44:50 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -201,6 +201,8 @@ stp         return STP;
 
 ipx            return IPX;
 
+netbeui                return NETBEUI;
+
 host           return HOST;
 net            return NET;
 mask           return MASK;