diff options
author | Florian Fainelli <florian@openwrt.org> | 2008-07-07 14:41:48 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2008-07-07 14:41:48 +0000 |
commit | 13758896aa6a11711205d715c67ef308e4851b8f (patch) | |
tree | 914b7e1c27c3d2a345328089c78455b1613cbae5 /package/libpcap | |
parent | 83095aef7c709a9b9b9b5bddf2ec3ea3015a8f98 (diff) | |
download | upstream-13758896aa6a11711205d715c67ef308e4851b8f.tar.gz upstream-13758896aa6a11711205d715c67ef308e4851b8f.tar.bz2 upstream-13758896aa6a11711205d715c67ef308e4851b8f.zip |
Update libpcap to 0.9.8 (#3571)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11742 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/libpcap')
-rw-r--r-- | package/libpcap/Makefile | 6 | ||||
-rw-r--r-- | package/libpcap/patches/100-shared-lib.patch | 22 | ||||
-rw-r--r-- | package/libpcap/patches/101-cross-compile-fix.patch | 8 | ||||
-rw-r--r-- | package/libpcap/patches/102-alt-ether.patch | 20 | ||||
-rw-r--r-- | package/libpcap/patches/103-flex_workaround.patch | 8 | ||||
-rw-r--r-- | package/libpcap/patches/104-no_rej_files.patch | 469 |
6 files changed, 496 insertions, 37 deletions
diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index d7956a61b8..ed048a4ed3 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap -PKG_VERSION:=0.9.4 +PKG_VERSION:=0.9.8 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.tcpdump.org/release/ -PKG_MD5SUM:=79025766e8027df154cb1f32de8a7974 +PKG_MD5SUM:=5208f24d0328ee7c20b52c43eaa9aa0e include $(INCLUDE_DIR)/package.mk @@ -26,7 +26,7 @@ define Package/libpcap endef define Package/libpcap/description - This package contains a system-independent library for user-level network + This package contains a system-independent library for user-level network packet capture. endef diff --git a/package/libpcap/patches/100-shared-lib.patch b/package/libpcap/patches/100-shared-lib.patch index 2ca9f51bd1..aae77f8e72 100644 --- a/package/libpcap/patches/100-shared-lib.patch +++ b/package/libpcap/patches/100-shared-lib.patch @@ -1,14 +1,12 @@ -Index: libpcap-0.9.4/Makefile.in -=================================================================== ---- libpcap-0.9.4.orig/Makefile.in 2007-06-04 13:22:03.547316008 +0200 -+++ libpcap-0.9.4/Makefile.in 2007-06-04 13:22:03.614305824 +0200 +--- a/Makefile.in ++++ b/Makefile.in @@ -37,6 +37,15 @@ srcdir = @srcdir@ VPATH = @srcdir@ +# some defines for shared library compilation +MAJ=0.9 -+MIN=4 ++MIN=8 +VERSION=$(MAJ).$(MIN) +LIBNAME=pcap +LIBRARY=lib$(LIBNAME).a @@ -18,7 +16,7 @@ Index: libpcap-0.9.4/Makefile.in # # You shouldn't need to edit anything below. # -@@ -50,6 +59,7 @@ +@@ -52,6 +61,7 @@ # Standard CFLAGS CFLAGS = $(CCOPT) $(INCLS) $(DEFS) @@ -26,7 +24,7 @@ Index: libpcap-0.9.4/Makefile.in INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -70,7 +80,12 @@ +@@ -72,7 +82,12 @@ .c.o: @rm -f $@ $(CC) $(CFLAGS) -c $(srcdir)/$*.c @@ -39,7 +37,7 @@ Index: libpcap-0.9.4/Makefile.in PSRC = pcap-@V_PCAP@.c FSRC = fad-@V_FINDALLDEVS@.c SSRC = @SSRC@ -@@ -84,6 +99,7 @@ +@@ -86,6 +101,7 @@ # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot # hack the extra indirection OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) @@ -47,7 +45,7 @@ Index: libpcap-0.9.4/Makefile.in HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \ ethertype.h gencode.h gnuc.h GENHDR = \ -@@ -95,15 +111,23 @@ +@@ -97,15 +113,23 @@ TAGFILES = \ $(SRC) $(HDR) $(TAGHDR) @@ -73,7 +71,7 @@ Index: libpcap-0.9.4/Makefile.in shared: libpcap.$(DYEXT) # -@@ -129,6 +153,10 @@ +@@ -131,6 +155,10 @@ scanner.o: scanner.c tokdefs.h $(CC) $(CFLAGS) -c scanner.c @@ -84,7 +82,7 @@ Index: libpcap-0.9.4/Makefile.in pcap.o: version.h tokdefs.h: grammar.c -@@ -142,9 +170,16 @@ +@@ -144,9 +172,16 @@ @rm -f $@ $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c @@ -101,7 +99,7 @@ Index: libpcap-0.9.4/Makefile.in snprintf.o: $(srcdir)/missing/snprintf.c $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c -@@ -170,10 +205,17 @@ +@@ -172,10 +207,17 @@ bpf_filter.o: bpf_filter.c $(CC) $(CFLAGS) -c bpf_filter.c diff --git a/package/libpcap/patches/101-cross-compile-fix.patch b/package/libpcap/patches/101-cross-compile-fix.patch index e73b4c9c24..2f166c8491 100644 --- a/package/libpcap/patches/101-cross-compile-fix.patch +++ b/package/libpcap/patches/101-cross-compile-fix.patch @@ -1,8 +1,6 @@ -Index: libpcap-0.9.4/Makefile.in -=================================================================== ---- libpcap-0.9.4.orig/Makefile.in 2007-06-04 13:22:03.614305824 +0200 -+++ libpcap-0.9.4/Makefile.in 2007-06-04 13:22:03.799277704 +0200 -@@ -117,7 +117,7 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -119,7 +119,7 @@ libpcap.a: $(OBJ) @rm -f $@ diff --git a/package/libpcap/patches/102-alt-ether.patch b/package/libpcap/patches/102-alt-ether.patch index 5f356ca990..e9cc15ff36 100644 --- a/package/libpcap/patches/102-alt-ether.patch +++ b/package/libpcap/patches/102-alt-ether.patch @@ -1,7 +1,5 @@ -Index: libpcap-0.9.4/nametoaddr.c -=================================================================== ---- libpcap-0.9.4.orig/nametoaddr.c 2007-06-04 13:22:03.499323304 +0200 -+++ libpcap-0.9.4/nametoaddr.c 2007-06-04 13:22:03.986249280 +0200 +--- a/nametoaddr.c ++++ b/nametoaddr.c @@ -410,7 +410,7 @@ e = ep = (u_char *)malloc(6); @@ -11,19 +9,17 @@ Index: libpcap-0.9.4/nametoaddr.c s += 1; d = xdtoi(*s++); if (isxdigit((unsigned char)*s)) { -Index: libpcap-0.9.4/scanner.l -=================================================================== ---- libpcap-0.9.4.orig/scanner.l 2007-06-04 13:22:03.506322240 +0200 -+++ libpcap-0.9.4/scanner.l 2007-06-04 13:22:03.987249128 +0200 +--- a/scanner.l ++++ b/scanner.l @@ -80,6 +80,7 @@ N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) B ([0-9A-Fa-f][0-9A-Fa-f]?) W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?) +X [0-9A-Fa-f] - %a 16000 - %o 19000 -@@ -306,7 +307,7 @@ + %a 18400 + %o 21500 +@@ -310,7 +311,7 @@ {N} { yylval.i = stoi((char *)yytext); return NUM; } ({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { yylval.s = sdup((char *)yytext); return HID; } @@ -32,7 +28,7 @@ Index: libpcap-0.9.4/scanner.l return EID; } {V6} { #ifdef INET6 -@@ -324,6 +325,7 @@ +@@ -328,6 +329,7 @@ #endif /*INET6*/ } {B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } diff --git a/package/libpcap/patches/103-flex_workaround.patch b/package/libpcap/patches/103-flex_workaround.patch index 19848979b4..014c624d4a 100644 --- a/package/libpcap/patches/103-flex_workaround.patch +++ b/package/libpcap/patches/103-flex_workaround.patch @@ -1,10 +1,8 @@ Copyright (C) 2006 Markus Wigge -Index: libpcap-0.9.4/Makefile.in -=================================================================== ---- libpcap-0.9.4.orig/Makefile.in 2007-06-04 13:22:03.799277704 +0200 -+++ libpcap-0.9.4/Makefile.in 2007-06-04 13:22:04.181219640 +0200 +--- a/Makefile.in ++++ b/Makefile.in @@ -53,7 +53,7 @@ CC = @CC@ CCOPT = @V_CCOPT@ @@ -12,5 +10,5 @@ Index: libpcap-0.9.4/Makefile.in -DEFS = @DEFS@ @V_DEFS@ +DEFS = -D_BSD_SOURCE @DEFS@ @V_DEFS@ LIBS = @V_LIBS@ + DAGLIBS = @DAGLIBS@ DYEXT = @DYEXT@ - diff --git a/package/libpcap/patches/104-no_rej_files.patch b/package/libpcap/patches/104-no_rej_files.patch new file mode 100644 index 0000000000..d3ae58c0ad --- /dev/null +++ b/package/libpcap/patches/104-no_rej_files.patch @@ -0,0 +1,469 @@ +diff -urN libpcap-0.9.8/gencode.c.rej libpcap-0.9.8.new/gencode.c.rej +--- libpcap-0.9.8/gencode.c.rej 2007-07-10 21:38:15.000000000 +0200 ++++ libpcap-0.9.8.new/gencode.c.rej 1970-01-01 01:00:00.000000000 +0100 +@@ -1,465 +0,0 @@ +-*************** +-*** 24,29 **** +- "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.51 2007/06/14 20:54:12 gianluca Exp $ (LBL)";
+- #endif
+-
+- #ifdef HAVE_CONFIG_H
+- #include "config.h"
+- #endif
+---- 24,31 ---- +- "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.51 2007/06/14 20:54:12 gianluca Exp $ (LBL)";
+- #endif
+-
+-+ #define ENABLE_WLAN_FILTERING_PATCH +-+ +- #ifdef HAVE_CONFIG_H
+- #include "config.h"
+- #endif
+-*************** +-*** 144,150 **** +- OR_NET, /* relative to the network-layer header */
+- OR_NET_NOSNAP, /* relative to the network-layer header, with no SNAP header at the link layer */
+- OR_TRAN_IPV4, /* relative to the transport-layer header, with IPv4 network layer */
+-- OR_TRAN_IPV6 /* relative to the transport-layer header, with IPv6 network layer */
+- };
+-
+- /*
+---- 146,153 ---- +- OR_NET, /* relative to the network-layer header */
+- OR_NET_NOSNAP, /* relative to the network-layer header, with no SNAP header at the link layer */
+- OR_TRAN_IPV4, /* relative to the transport-layer header, with IPv4 network layer */
+-+ OR_TRAN_IPV6, /* relative to the transport-layer header, with IPv6 network layer */ +-+ OR_LINK_AFTER_WIRELESS_HDR /* After the 802.11 variable length header */ +- };
+-
+- /*
+-*************** +-*** 199,204 **** +- static struct block *gen_linktype(int);
+- static struct block *gen_snap(bpf_u_int32, bpf_u_int32, u_int);
+- static struct block *gen_llc_linktype(int);
+- static struct block *gen_hostop(bpf_u_int32, bpf_u_int32, int, int, u_int, u_int);
+- #ifdef INET6
+- static struct block *gen_hostop6(struct in6_addr *, struct in6_addr *, int, int, u_int, u_int);
+---- 202,208 ---- +- static struct block *gen_linktype(int);
+- static struct block *gen_snap(bpf_u_int32, bpf_u_int32, u_int);
+- static struct block *gen_llc_linktype(int);
+-+ static struct block *gen_802_11_llc_linktype(int); +- static struct block *gen_hostop(bpf_u_int32, bpf_u_int32, int, int, u_int, u_int);
+- #ifdef INET6
+- static struct block *gen_hostop6(struct in6_addr *, struct in6_addr *, int, int, u_int, u_int);
+-*************** +-*** 242,247 **** +- static struct slist *xfer_to_a(struct arth *);
+- static struct block *gen_mac_multicast(int);
+- static struct block *gen_len(int, int);
+-
+- static struct block *gen_ppi_dlt_check();
+- static struct block *gen_msg_abbrev(int type);
+---- 246,252 ---- +- static struct slist *xfer_to_a(struct arth *);
+- static struct block *gen_mac_multicast(int);
+- static struct block *gen_len(int, int);
+-+ static struct block *gen_check_802_11_data_frame(); +-
+- static struct block *gen_ppi_dlt_check();
+- static struct block *gen_msg_abbrev(int type);
+-*************** +-*** 1345,1350 **** +- return s;
+- }
+-
+-
+- /*
+- * Load a value relative to the beginning of the specified header.
+---- 1350,1487 ---- +- return s;
+- }
+-
+-+ /* +-+ * Load a value relative to the beginning of the link-layer header after the 802.11 +-+ * header, i.e. LLC_SNAP. +-+ * The link-layer header doesn't necessarily begin at the beginning +-+ * of the packet data; there might be a variable-length prefix containing +-+ * radio information. +-+ */ +-+ static struct slist * +-+ gen_load_ll_after_802_11_rel(offset, size) +-+ u_int offset, size; +-+ { +-+ struct slist *s, *s_load_fc; +-+ struct slist *sjset_qos; +-+ struct slist *s_load; +-+ struct slist *s_ld_a_2; +-+ struct slist *s_add_a_x; +-+ struct slist *s_a_to_x; +-+ struct slist *sjset_data_frame_1; +-+ struct slist *sjset_data_frame_2; +-+ struct slist *s_load_x_0; +-+ +-+ /* +-+ * This code is not compatible with the optimizer, as +-+ * we are generating jmp instructions within a normal +-+ * slist of instructions +-+ * +-+ */ +-+ no_optimize = 1; +-+ +-+ s = gen_llprefixlen(); +-+ +-+ /* +-+ * If "s" is non-null, it has code to arrange that the X register +-+ * contains the length of the prefix preceding the link-layer +-+ * header. +-+ * +-+ * Otherwise, the length of the prefix preceding the link-layer +-+ * header is "off_ll". +-+ */ +-+ if (s != NULL) { +-+ /* +-+ * There's a variable-length prefix preceding the +-+ * link-layer header. "s" points to a list of statements +-+ * that put the length of that prefix into the X register. +-+ * do an indirect load, to use the X register as an offset. +-+ */ +-+ +-+ /* +-+ * Load the Frame Control field +-+ */ +-+ s_load_fc = new_stmt(BPF_LD|BPF_IND|BPF_B); +-+ s_load_fc->s.k = 0; +-+ } else { +-+ /* +-+ * There is no variable-length header preceding the +-+ * link-layer header; add in off_ll, which, if there's +-+ * a fixed-length header preceding the link-layer header, +-+ * is the length of that header. +-+ */ +-+ +-+ /* +-+ * We need to load the Frame control directly, and +-+ * then load X with a fake 0, i.e. the length of the +-+ * non-existing prepended header +-+ */ +-+ +-+ /* +-+ * TODO GV: I'm not sure if 0 is the right constant in this +-+ * case. If the link layer has a fixed length prepended header, +-+ * that should be the value that we put here +-+ */ +-+ +-+ /* Load 0 into X */ +-+ s_load_x_0 = new_stmt(BPF_LDX|BPF_IMM); +-+ s_load_x_0->s.k = 0; +-+ +-+ /* +-+ * TODO GV: I'm not sure if 0 is the right constant in this +-+ * case. If the link layer has a fixed length prepended header, +-+ * that should be the value that we put here +-+ */ +-+ +-+ /* +-+ * load the Frame Control with absolute access +-+ */ +-+ s_load_fc = new_stmt(BPF_LD|BPF_ABS|BPF_B); +-+ s_load_fc->s.k = 0; +-+ s = s_load_x_0; +-+ } +-+ +-+ /* +-+ * Generate the common instructions to check if it's a data frame +-+ * and if so compute the 802.11 header length +-+ */ +-+ sjset_data_frame_1 = new_stmt(JMP(BPF_JSET)); // b3 should be 1 +-+ sjset_data_frame_1->s.k = 0x8; +-+ +-+ sjset_data_frame_2 = new_stmt(JMP(BPF_JSET)); // b2 should be 0 +-+ sjset_data_frame_2->s.k = 0x04; +-+ +-+ sjset_qos = new_stmt(JMP(BPF_JSET)); +-+ sjset_qos->s.k = 0x80; //QOS bit +-+ +-+ s_ld_a_2 = new_stmt(BPF_LD|BPF_IMM); +-+ s_ld_a_2->s.k = 2; +-+ +-+ s_add_a_x = new_stmt(BPF_ALU|BPF_ADD|BPF_X); +-+ s_a_to_x = new_stmt(BPF_MISC|BPF_TAX); +-+ +-+ s_load = new_stmt(BPF_LD|BPF_IND|size); +-+ s_load->s.k = offset; +-+ +-+ sjset_data_frame_1->s.jt = sjset_data_frame_2; +-+ sjset_data_frame_1->s.jf = s_load; +-+ +-+ sjset_data_frame_2->s.jt = s_load; +-+ sjset_data_frame_2->s.jf = sjset_qos; +-+ +-+ sjset_qos->s.jt = s_ld_a_2; +-+ sjset_qos->s.jf = s_load; +-+ +-+ sappend(s, s_load_fc); +-+ sappend(s_load_fc, sjset_data_frame_1); +-+ sappend(sjset_data_frame_1, sjset_data_frame_2); +-+ sappend(sjset_data_frame_2, sjset_qos); +-+ sappend(sjset_qos, s_ld_a_2); +-+ sappend(s_ld_a_2, s_add_a_x); +-+ sappend(s_add_a_x,s_a_to_x); +-+ sappend(s_a_to_x, s_load); +-+ +-+ return s; +-+ } +-
+- /*
+- * Load a value relative to the beginning of the specified header.
+-*************** +-*** 1367,1372 **** +- s = gen_load_llrel(offset, size);
+- break;
+-
+- case OR_NET:
+- s = gen_load_llrel(off_nl + offset, size);
+- break;
+---- 1504,1525 ---- +- s = gen_load_llrel(offset, size);
+- break;
+-
+-+ #ifdef ENABLE_WLAN_FILTERING_PATCH +-+ +-+ case OR_LINK_AFTER_WIRELESS_HDR: +-+ if (linktype != DLT_IEEE802_11_RADIO +-+ && linktype != DLT_PPI +-+ && linktype != DLT_IEEE802_11 +-+ && linktype != DLT_PRISM_HEADER +-+ && linktype != DLT_IEEE802_11_RADIO_AVS) +-+ { +-+ abort(); +-+ return NULL; +-+ } +-+ s = gen_load_ll_after_802_11_rel(offset + 24, size); +-+ break; +-+ #endif /* ENABLE_WLAN_FILTERING_PATCH */ +-+ +- case OR_NET:
+- s = gen_load_llrel(off_nl + offset, size);
+- break;
+-*************** +-*** 2163,2173 **** +- break;
+-
+- case DLT_PPI:
+- case DLT_FDDI:
+- case DLT_IEEE802:
+-- case DLT_IEEE802_11:
+- case DLT_IEEE802_11_RADIO_AVS:
+-- case DLT_IEEE802_11_RADIO:
+- case DLT_PRISM_HEADER:
+- case DLT_ATM_RFC1483:
+- case DLT_ATM_CLIP:
+---- 2316,2332 ---- +- break;
+-
+- case DLT_PPI:
+-+ case DLT_IEEE802_11_RADIO: +-+ case DLT_IEEE802_11: +-+ #ifdef ENABLE_WLAN_FILTERING_PATCH +-+ return gen_802_11_llc_linktype(proto); +-+ /*NOTREACHED*/ +-+ break; +-+ #endif /* ENABLE_WLAN_FILTERING_PATCH */ +-+ +- case DLT_FDDI:
+- case DLT_IEEE802:
+- case DLT_IEEE802_11_RADIO_AVS:
+- case DLT_PRISM_HEADER:
+- case DLT_ATM_RFC1483:
+- case DLT_ATM_CLIP:
+-*************** +-*** 2711,2716 **** +- }
+- }
+-
+- static struct block *
+- gen_hostop(addr, mask, dir, proto, src_off, dst_off)
+- bpf_u_int32 addr;
+---- 2870,2982 ---- +- }
+- }
+-
+-+ /* +-+ * Generate code to match a particular packet type, for link-layer types +-+ * using 802.2 LLC headers. +-+ * +-+ * This is *NOT* used for Ethernet; "gen_ether_linktype()" is used +-+ * for that - it handles the D/I/X Ethernet vs. 802.3+802.2 issues. +-+ * +-+ * "proto" is an Ethernet type value, if > ETHERMTU, or an LLC SAP +-+ * value, if <= ETHERMTU. We use that to determine whether to +-+ * match the DSAP or both DSAP and LSAP or to check the OUI and +-+ * protocol ID in a SNAP header. +-+ */ +-+ static struct block * +-+ gen_802_11_llc_linktype(proto) +-+ int proto; +-+ { +-+ struct block *b_check_data_frame; +-+ struct block *b_check_linktype; +-+ +-+ b_check_data_frame = gen_check_802_11_data_frame(); +-+ +-+ /* +-+ * XXX - generate the code that discards non data frames +-+ */ +-+ switch (proto) { +-+ +-+ case LLCSAP_IP: +-+ case LLCSAP_ISONS: +-+ case LLCSAP_NETBEUI: +-+ /* +-+ * XXX - should we check both the DSAP and the +-+ * SSAP, like this, or should we check just the +-+ * DSAP, as we do for other types <= ETHERMTU +-+ * (i.e., other SAP values)? +-+ */ +-+ b_check_linktype = gen_cmp(OR_LINK_AFTER_WIRELESS_HDR, 0, BPF_H, (bpf_u_int32) +-+ ((proto << 8) | proto)); +-+ break; +-+ +-+ case LLCSAP_IPX: +-+ /* +-+ * XXX - are there ever SNAP frames for IPX on +-+ * non-Ethernet 802.x networks? +-+ */ +-+ b_check_linktype = gen_cmp(OR_LINK_AFTER_WIRELESS_HDR, 0, BPF_B, +-+ (bpf_int32)LLCSAP_IPX); +-+ +-+ break; +-+ +-+ #if 0 +-+ case ETHERTYPE_ATALK: +-+ /* +-+ * 802.2-encapsulated ETHERTYPE_ATALK packets are +-+ * SNAP packets with an organization code of +-+ * 0x080007 (Apple, for Appletalk) and a protocol +-+ * type of ETHERTYPE_ATALK (Appletalk). +-+ * +-+ * XXX - check for an organization code of +-+ * encapsulated Ethernet as well? +-+ */ +-+ return gen_snap(0x080007, ETHERTYPE_ATALK, off_linktype); +-+ #endif +-+ default: +-+ /* +-+ * XXX - we don't have to check for IPX 802.3 +-+ * here, but should we check for the IPX Ethertype? +-+ */ +-+ if (proto <= ETHERMTU) { +-+ /* +-+ * This is an LLC SAP value, so check +-+ * the DSAP. +-+ */ +-+ b_check_linktype = gen_cmp(OR_LINK_AFTER_WIRELESS_HDR, 0, BPF_B, +-+ (bpf_int32)proto); +-+ } else { +-+ /* +-+ * This is an Ethernet type; we assume that it's +-+ * unlikely that it'll appear in the right place +-+ * at random, and therefore check only the +-+ * location that would hold the Ethernet type +-+ * in a SNAP frame with an organization code of +-+ * 0x000000 (encapsulated Ethernet). +-+ * +-+ * XXX - if we were to check for the SNAP DSAP and +-+ * LSAP, as per XXX, and were also to check for an +-+ * organization code of 0x000000 (encapsulated +-+ * Ethernet), we'd do +-+ * +-+ * return gen_snap(0x000000, proto, +-+ * off_linktype); +-+ * +-+ * here; for now, we don't, as per the above. +-+ * I don't know whether it's worth the extra CPU +-+ * time to do the right check or not. +-+ */ +-+ b_check_linktype = gen_cmp(OR_LINK_AFTER_WIRELESS_HDR, 0+6, BPF_H, +-+ (bpf_int32)proto); +-+ } +-+ } +-+ +-+ gen_and(b_check_data_frame, b_check_linktype); +-+ return b_check_linktype; +-+ +-+ } +-+ +-+ +-+ +- static struct block *
+- gen_hostop(addr, mask, dir, proto, src_off, dst_off)
+- bpf_u_int32 addr;
+-*************** +-*** 2925,2930 **** +- register struct block *b0, *b1, *b2;
+- register struct slist *s;
+-
+- switch (dir) {
+- case Q_SRC:
+- /*
+---- 3191,3207 ---- +- register struct block *b0, *b1, *b2;
+- register struct slist *s;
+-
+-+ #ifdef ENABLE_WLAN_FILTERING_PATCH +-+ /* +-+ * TODO GV 20070613 +-+ * We need to disable the optimizer because the optimizer is buggy +-+ * and wipes out some LD instructions generated by the below +-+ * code to validate the Frame Control bits +-+ * +-+ */ +-+ no_optimize = 1; +-+ #endif /* ENABLE_WLAN_FILTERING_PATCH */ +-+ +- switch (dir) {
+- case Q_SRC:
+- /*
+-*************** +-*** 4713,4718 **** +- #endif
+- }
+-
+-
+- /*
+- * Generate code that checks whether the packet is a packet for protocol
+---- 4990,5021 ---- +- #endif
+- }
+-
+-+ static struct block * +-+ gen_check_802_11_data_frame() +-+ { +-+ struct slist *s; +-+ struct block *b0, *b1; +-+ /* +-+ * Now check for a data frame. +-+ * I.e, check "link[0] & 0x08". +-+ */ +-+ s = gen_load_a(OR_LINK, 0, BPF_B); +-+ b0 = new_block(JMP(BPF_JSET)); +-+ b0->s.k = 0x08; +-+ b0->stmts = s; +-+ +-+ s = gen_load_a(OR_LINK, 0, BPF_B); +-+ b1 = new_block(JMP(BPF_JSET)); +-+ b1->s.k = 0x04; +-+ b1->stmts = s; +-+ gen_not(b1); +-+ +-+ +-+ gen_and(b1, b0); +-+ +-+ return b0; +-+ } +-+ +-
+- /*
+- * Generate code that checks whether the packet is a packet for protocol
|