Hi,
this patch uses PKG_INSTALL:=1 and simplifies the Makefile,
separates the menuconfig options in a separates Config.in file,
adds a new patch to disable man pages (there was an error with QUILT=1
without this patch, as ln was used without -f),
renames patches to be more explicit (and 1xx for Makefile patches and
2xx for source patches)
-Raphael
diff -pruN libpcap.orig/Config.in libpcap/Config.in
--- libpcap.orig/Config.in 1970-01-01 01:00:00.000000000 +0100
+++ libpcap/Config.in 2010-03-04 17:37:18.000000000 +0100
@@ -0,0 +1,12 @@
+config PCAP_HAS_USB
+ bool "Include USB support"
+ depends PACKAGE_libpcap
+ depends PACKAGE_kmod-usb-core
+ default n
+
+config PCAP_HAS_BT
+ bool "Include bluetooth support"
+ depends PACKAGE_libpcap
+ depends PACKAGE_kmod-bluetooth
+ depends BROKEN
+ default n
diff -pruN libpcap.orig/Makefile libpcap/Makefile
--- libpcap.orig/Makefile 2010-03-04 17:22:31.000000000 +0100
+++ libpcap/Makefile 2010-03-04 18:40:55.000000000 +0100
@@ -1,5 +1,5 @@
-#
-# Copyright (C) 2006 OpenWrt.org
+#
+# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -9,12 +9,14 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libpcap
PKG_VERSION:=1.0.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.tcpdump.org/release/
PKG_MD5SUM:=9ad1358c5dec48456405eac197a46d3d
+PKG_INSTALL:=1
+
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk
@@ -26,28 +28,17 @@ define Package/libpcap
endef
define Package/libpcap/description
- This package contains a system-independent library for user-level network
- packet capture.
+This package contains a system-independent library for user-level network packet
+capture.
endef
define Package/libpcap/config
- config PCAP_HAS_USB
- bool "Include USB support"
- depends PACKAGE_libpcap
- depends PACKAGE_kmod-usb-core
- default n
-
- config PCAP_HAS_BT
- bool "Include bluetooth support"
- depends PACKAGE_libpcap
- depends PACKAGE_kmod-bluetooth
- depends BROKEN
- default n
-
+source "$(SOURCE)/Config.in"
endef
TARGET_CFLAGS += \
- -ffunction-sections -fdata-sections
+ -ffunction-sections \
+ -fdata-sections
CONFIGURE_VARS += \
ac_cv_linux_vers=$(LINUX_VERSION)
@@ -62,31 +53,28 @@ CONFIGURE_ARGS += \
--without-septel \
--without-dag
-define Build/Compile
- rm -rf $(PKG_INSTALL_DIR)
+MAKE_FLAGS += \
+ CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include"
+
+define Build/Configure
+ $(call Build/Configure/Default)
$(if $(CONFIG_PCAP_HAS_USB),,$(SED) '/^#define PCAP_SUPPORT_USB/D' $(PKG_BUILD_DIR)/config.h)
$(if $(CONFIG_PCAP_HAS_USB),,$(SED) 's/pcap-usb-linux.c *//' $(PKG_BUILD_DIR)/Makefile)
$(if $(CONFIG_PCAP_HAS_BT),,$(SED) '/^#define PCAP_SUPPORT_BT/D' $(PKG_BUILD_DIR)/config.h)
$(if $(CONFIG_PCAP_HAS_BT),,$(SED) 's/pcap-bt-linux.c *//' $(PKG_BUILD_DIR)/Makefile)
- $(MAKE) -C $(PKG_BUILD_DIR) \
- CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- all install
endef
define Build/InstallDev
- mkdir -p $(1)/usr/include $(1)/usr/lib
- $(CP) \
- $(PKG_INSTALL_DIR)/usr/include/pcap* \
- $(1)/usr/include/
- $(CP) \
- $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} \
- $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap* $(1)/usr/include/
+
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(1)/usr/lib/
endef
define Package/libpcap/install
$(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libpcap))
diff -pruN libpcap.orig/patches/101-debian_fix_any_intf.patch libpcap/patches/101-debian_fix_any_intf.patch
--- libpcap.orig/patches/101-debian_fix_any_intf.patch 2010-03-04 17:22:31.000000000 +0100
+++ libpcap/patches/101-debian_fix_any_intf.patch 1970-01-01 01:00:00.000000000 +0100
@@ -1,149 +0,0 @@
---- a/pcap-linux.c
-+++ b/pcap-linux.c
-@@ -297,6 +297,12 @@ pcap_create(const char *device, char *eb
- {
- pcap_t *handle;
-
-+ /*
-+ * A null device name is equivalent to the "any" device.
-+ */
-+ if (device == NULL)
-+ device = "any";
-+
- #ifdef HAVE_DAG_API
- if (strstr(device, "dag")) {
- return dag_create(device, ebuf);
-@@ -338,10 +344,9 @@ pcap_can_set_rfmon_linux(pcap_t *p)
- struct iwreq ireq;
- #endif
-
-- if (p->opt.source == NULL) {
-+ if (strcmp(p->opt.source, "any") == 0) {
- /*
-- * This is equivalent to the "any" device, and we don't
-- * support monitor mode on it.
-+ * Monitor mode makes no sense on the "any" device.
- */
- return 0;
- }
-@@ -518,12 +523,11 @@ pcap_activate_linux(pcap_t *handle)
- handle->stats_op = pcap_stats_linux;
-
- /*
-- * NULL and "any" are special devices which give us the hint to
-- * monitor all devices.
-+ * The "any" device is a special device which causes us not
-+ * to bind to a particular device and thus to look at all
-+ * devices.
- */
-- if (!device || strcmp(device, "any") == 0) {
-- device = NULL;
-- handle->md.device = strdup("any");
-+ if (strcmp(device, "any") == 0) {
- if (handle->opt.promisc) {
- handle->opt.promisc = 0;
- /* Just a warning. */
-@@ -531,10 +535,9 @@ pcap_activate_linux(pcap_t *handle)
- "Promiscuous mode not supported on the \"any\" device");
- status = PCAP_WARNING_PROMISC_NOTSUP;
- }
-+ }
-
-- } else
-- handle->md.device = strdup(device);
--
-+ handle->md.device = strdup(device);
- if (handle->md.device == NULL) {
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "strdup: %s",
- pcap_strerror(errno) );
-@@ -1657,19 +1660,21 @@ static int
- activate_new(pcap_t *handle)
- {
- #ifdef HAVE_PF_PACKET_SOCKETS
-+ const char *device = handle->opt.source;
-+ int is_any_device = (strcmp(device, "any") == 0);
- int sock_fd = -1, arptype, val;
- int err = 0;
- struct packet_mreq mr;
-- const char* device = handle->opt.source;
-
- /*
-- * Open a socket with protocol family packet. If a device is
-- * given we try to open it in raw mode otherwise we use
-- * the cooked interface.
-- */
-- sock_fd = device ?
-- socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))
-- : socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL));
-+ * Open a socket with protocol family packet. If the
-+ * "any" device was specified, we open a SOCK_DGRAM
-+ * socket for the cooked interface, otherwise we first
-+ * try a SOCK_RAW socket for the raw interface.
-+ */
-+ sock_fd = is_any_device ?
-+ socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL)) :
-+ socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
-
- if (sock_fd == -1) {
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s",
-@@ -1704,7 +1709,7 @@ activate_new(pcap_t *handle)
- * to cooked mode if we have an unknown interface type
- * or a type we know doesn't work well in raw mode.
- */
-- if (device) {
-+ if (!is_any_device) {
- /* Assume for now we don't need cooked mode. */
- handle->md.cooked = 0;
-
-@@ -1819,15 +1824,23 @@ activate_new(pcap_t *handle)
- }
- } else {
- /*
-- * This is cooked mode.
-+ * The "any" device.
-+ */
-+ if (handle->opt.rfmon) {
-+ /*
-+ * It doesn't support monitor mode.
-+ */
-+ return PCAP_ERROR_RFMON_NOTSUP;
-+ }
-+
-+ /*
-+ * It uses cooked mode.
- */
- handle->md.cooked = 1;
- handle->linktype = DLT_LINUX_SLL;
-
- /*
- * We're not bound to a device.
-- * XXX - true? Or true only if we're using
-- * the "any" device?
- * For now, we're using this as an indication
- * that we can't transmit; stop doing that only
- * if we figure out how to transmit in cooked
-@@ -1852,10 +1865,13 @@ activate_new(pcap_t *handle)
-
- /*
- * Hmm, how can we set promiscuous mode on all interfaces?
-- * I am not sure if that is possible at all.
-+ * I am not sure if that is possible at all. For now, we
-+ * silently ignore attempts to turn promiscuous mode on
-+ * for the "any" device (so you don't have to explicitly
-+ * disable it in programs such as tcpdump).
- */
-
-- if (device && handle->opt.promisc) {
-+ if (!is_any_device && handle->opt.promisc) {
- memset(&mr, 0, sizeof(mr));
- mr.mr_ifindex = handle->md.ifindex;
- mr.mr_type = PACKET_MR_PROMISC;
-@@ -3118,7 +3134,7 @@ activate_old(pcap_t *handle)
-
- /* Bind to the given device */
-
-- if (!device) {
-+ if (strcmp(device, "any") == 0) {
- strncpy(handle->errbuf, "pcap_activate: The \"any\" device isn't supported on 2.0[.x]-kernel systems",
- PCAP_ERRBUF_SIZE);
- return PCAP_ERROR;
diff -pruN libpcap.orig/patches/101-makefile_create_bindir.patch libpcap/patches/101-makefile_create_bindir.patch
--- libpcap.orig/patches/101-makefile_create_bindir.patch 1970-01-01 01:00:00.000000000 +0100
+++ libpcap/patches/101-makefile_create_bindir.patch 2010-03-04 18:28:17.000000000 +0100
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -484,6 +484,8 @@ install: libpcap.a pcap-config
+ $(DESTDIR)$(includedir)/pcap-bpf.h
+ $(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
+ $(DESTDIR)$(includedir)/pcap-namedb.h
++ [ -d $(DESTDIR)$(bindir) ] || \
++ (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
+ $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
+ for i in $(MAN1); do \
+ $(INSTALL_DATA) $(srcdir)/$$i \
diff -pruN libpcap.orig/patches/102-fix_install.patch libpcap/patches/102-fix_install.patch
--- libpcap.orig/patches/102-fix_install.patch 2010-03-04 17:22:31.000000000 +0100
+++ libpcap/patches/102-fix_install.patch 1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -484,6 +484,8 @@ install: libpcap.a pcap-config
- $(DESTDIR)$(includedir)/pcap-bpf.h
- $(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
- $(DESTDIR)$(includedir)/pcap-namedb.h
-+ [ -d $(DESTDIR)$(bindir) ] || \
-+ (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
- $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
- for i in $(MAN1); do \
- $(INSTALL_DATA) $(srcdir)/$$i \
diff -pruN libpcap.orig/patches/102-makefile_disable_manpages.patch libpcap/patches/102-makefile_disable_manpages.patch
--- libpcap.orig/patches/102-makefile_disable_manpages.patch 1970-01-01 01:00:00.000000000 +0100
+++ libpcap/patches/102-makefile_disable_manpages.patch 2010-03-04 18:27:49.000000000 +0100
@@ -0,0 +1,78 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -461,14 +461,6 @@
+ (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
+ [ -d $(DESTDIR)$(includedir)/pcap ] || \
+ (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
+- [ -d $(DESTDIR)$(mandir)/man1 ] || \
+- (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
+- [ -d $(DESTDIR)$(mandir)/man3 ] || \
+- (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
+- [ -d $(DESTDIR)$(mandir)/m...@man_file_formats@ ] || \
+- (mkdir -p $(DESTDIR)$(mandir)/m...@man_file_formats@; chmod 755 $(DESTDIR)$(mandir)/m...@man_file_formats@)
+- [ -d $(DESTDIR)$(mandir)/m...@man_misc_info@ ] || \
+- (mkdir -p $(DESTDIR)$(mandir)/m...@man_misc_info@; chmod 755 $(DESTDIR)$(mandir)/m...@man_misc_info@)
+ $(INSTALL_DATA) $(srcdir)/pcap/pcap.h \
+ $(DESTDIR)$(includedir)/pcap/pcap.h
+ $(INSTALL_DATA) $(srcdir)/pcap/bpf.h \
+@@ -487,36 +479,6 @@
+ [ -d $(DESTDIR)$(bindir) ] || \
+ (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
+ $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
+- for i in $(MAN1); do \
+- $(INSTALL_DATA) $(srcdir)/$$i \
+- $(DESTDIR)$(mandir)/man1/$$i; done
+- for i in $(MAN3PCAP); do \
+- $(INSTALL_DATA) $(srcdir)/$$i \
+- $(DESTDIR)$(mandir)/man3/$$i; done
+- ln $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_name.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
+- ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
+- ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
+- ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
+- ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
+- ln $(DESTDIR)$(mandir)/man3/pcap_major_version.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
+- ln $(DESTDIR)$(mandir)/man3/pcap_next_ex.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
+- ln $(DESTDIR)$(mandir)/man3/pcap_open_offline.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
+- ln $(DESTDIR)$(mandir)/man3/pcap_setnonblock.3pcap \
+- $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
+- for i in $(MANFILE); do \
+- $(INSTALL_DATA) $(srcdir)/`echo $$i | sed 's/.manfile.in/.manfile/'` \
+- $(DESTDIR)$(mandir)/m...@man_file_formats@/`echo $$i | sed 's/.manfile.in/....@man_file_formats@/'`; done
+- for i in $(MANMISC); do \
+- $(INSTALL_DATA) $(srcdir)/`echo $$i | sed 's/.manmisc.in/.manmisc/'` \
+- $(DESTDIR)$(mandir)/m...@man_misc_info@/`echo $$i | sed 's/.manmisc.in/....@man_misc_info@/'`; done
+
+ install-shared: install-shared-$(DYEXT)
+ install-shared-so: libpcap.so
+@@ -536,23 +498,6 @@
+ rm -f $(DESTDIR)$(includedir)/pcap.h
+ rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
+ rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
+- for i in $(MAN1); do \
+- rm -f $(DESTDIR)$(mandir)/man1/$$i; done
+- for i in $(MAN3PCAP); do \
+- rm -f $(DESTDIR)$(mandir)/man3/$$i; done
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
+- rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
+- for i in $(MANFILE); do \
+- rm -f $(DESTDIR)$(mandir)/m...@man_file_formats@/`echo $$i | sed 's/.manfile.in/....@man_file_formats@/'`; done
+- for i in $(MANMISC); do \
+- rm -f $(DESTDIR)$(mandir)/m...@man_misc_info@/`echo $$i | sed 's/.manmisc.in/....@man_misc_info@/'`; done
+
+ clean:
+ rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
diff -pruN libpcap.orig/patches/103-flex_workaround.patch libpcap/patches/103-flex_workaround.patch
--- libpcap.orig/patches/103-flex_workaround.patch 2010-03-04 17:22:31.000000000 +0100
+++ libpcap/patches/103-flex_workaround.patch 1970-01-01 01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-
- Copyright (C) 2006 Markus Wigge
-
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -55,7 +55,7 @@ SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
- CC = @CC@
- CCOPT = @V_CCOPT@
- INCLS = -I. @V_INCLS@
--DEFS = @DEFS@ @V_DEFS@
-+DEFS = -D_BSD_SOURCE @DEFS@ @V_DEFS@
- LIBS = @V_LIBS@
- DAGLIBS = @DAGLIBS@
- DEPLIBS = @DEPLIBS@
diff -pruN libpcap.orig/patches/103-makefile_flex_workaround.patch libpcap/patches/103-makefile_flex_workaround.patch
--- libpcap.orig/patches/103-makefile_flex_workaround.patch 1970-01-01 01:00:00.000000000 +0100
+++ libpcap/patches/103-makefile_flex_workaround.patch 2010-03-04 18:28:34.000000000 +0100
@@ -0,0 +1,14 @@
+
+ Copyright (C) 2006 Markus Wigge
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -55,7 +55,7 @@ SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
+ CC = @CC@
+ CCOPT = @V_CCOPT@
+ INCLS = -I. @V_INCLS@
+-DEFS = @DEFS@ @V_DEFS@
++DEFS = -D_BSD_SOURCE @DEFS@ @V_DEFS@
+ LIBS = @V_LIBS@
+ DAGLIBS = @DAGLIBS@
+ DEPLIBS = @DEPLIBS@
diff -pruN libpcap.orig/patches/105-space_optimization.patch libpcap/patches/105-space_optimization.patch
--- libpcap.orig/patches/105-space_optimization.patch 2010-03-04 17:22:31.000000000 +0100
+++ libpcap/patches/105-space_optimization.patch 1970-01-01 01:00:00.000000000 +0100
@@ -1,133 +0,0 @@
---- a/gencode.c
-+++ b/gencode.c
-@@ -439,20 +439,6 @@ pcap_compile_nopcap(int snaplen_arg, int
- }
-
- /*
-- * Clean up a "struct bpf_program" by freeing all the memory allocated
-- * in it.
-- */
--void
--pcap_freecode(struct bpf_program *program)
--{
-- program->bf_len = 0;
-- if (program->bf_insns != NULL) {
-- free((char *)program->bf_insns);
-- program->bf_insns = NULL;
-- }
--}
--
--/*
- * Backpatch the blocks in 'list' to 'target'. The 'sense' field indicates
- * which of the jt and jf fields has been resolved and which is a pointer
- * back to another unresolved block (or nil). At least one of the fields
---- a/pcap.c
-+++ b/pcap.c
-@@ -698,6 +698,59 @@ static const u_char charmap[] = {
- (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377',
- };
-
-+/*
-+ * Clean up a "struct bpf_program" by freeing all the memory allocated
-+ * in it.
-+ */
-+void
-+pcap_freecode(struct bpf_program *program)
-+{
-+ program->bf_len = 0;
-+ if (program->bf_insns != NULL) {
-+ free((char *)program->bf_insns);
-+ program->bf_insns = NULL;
-+ }
-+}
-+
-+/*
-+ * Make a copy of a BPF program and put it in the "fcode" member of
-+ * a "pcap_t".
-+ *
-+ * If we fail to allocate memory for the copy, fill in the "errbuf"
-+ * member of the "pcap_t" with an error message, and return -1;
-+ * otherwise, return 0.
-+ */
-+int
-+install_bpf_program(pcap_t *p, struct bpf_program *fp)
-+{
-+ size_t prog_size;
-+
-+ /*
-+ * Validate the program.
-+ */
-+ if (!bpf_validate(fp->bf_insns, fp->bf_len)) {
-+ snprintf(p->errbuf, sizeof(p->errbuf),
-+ "BPF program is not valid");
-+ return (-1);
-+ }
-+
-+ /*
-+ * Free up any already installed program.
-+ */
-+ pcap_freecode(&p->fcode);
-+
-+ prog_size = sizeof(*fp->bf_insns) * fp->bf_len;
-+ p->fcode.bf_len = fp->bf_len;
-+ p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size);
-+ if (p->fcode.bf_insns == NULL) {
-+ snprintf(p->errbuf, sizeof(p->errbuf),
-+ "malloc: %s", pcap_strerror(errno));
-+ return (-1);
-+ }
-+ memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
-+ return (0);
-+}
-+
- int
- pcap_strcasecmp(const char *s1, const char *s2)
- {
---- a/optimize.c
-+++ b/optimize.c
-@@ -2278,45 +2278,6 @@ icode_to_fcode(root, lenp)
- return fp;
- }
-
--/*
-- * Make a copy of a BPF program and put it in the "fcode" member of
-- * a "pcap_t".
-- *
-- * If we fail to allocate memory for the copy, fill in the "errbuf"
-- * member of the "pcap_t" with an error message, and return -1;
-- * otherwise, return 0.
-- */
--int
--install_bpf_program(pcap_t *p, struct bpf_program *fp)
--{
-- size_t prog_size;
--
-- /*
-- * Validate the program.
-- */
-- if (!bpf_validate(fp->bf_insns, fp->bf_len)) {
-- snprintf(p->errbuf, sizeof(p->errbuf),
-- "BPF program is not valid");
-- return (-1);
-- }
--
-- /*
-- * Free up any already installed program.
-- */
-- pcap_freecode(&p->fcode);
--
-- prog_size = sizeof(*fp->bf_insns) * fp->bf_len;
-- p->fcode.bf_len = fp->bf_len;
-- p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size);
-- if (p->fcode.bf_insns == NULL) {
-- snprintf(p->errbuf, sizeof(p->errbuf),
-- "malloc: %s", pcap_strerror(errno));
-- return (-1);
-- }
-- memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
-- return (0);
--}
--
- #ifdef BDEBUG
- static void
- opt_dump(root)
diff -pruN libpcap.orig/patches/106-protocol_api.patch libpcap/patches/106-protocol_api.patch
--- libpcap.orig/patches/106-protocol_api.patch 2010-03-04 17:22:31.000000000 +0100
+++ libpcap/patches/106-protocol_api.patch 1970-01-01 01:00:00.000000000 +0100
@@ -1,141 +0,0 @@
---- a/pcap-int.h
-+++ b/pcap-int.h
-@@ -187,6 +187,7 @@ struct pcap_opt {
- char *source;
- int promisc;
- int rfmon;
-+ int proto; /* protocol for packet socket (linux) */
- };
-
- /*
---- a/pcap-linux.c
-+++ b/pcap-linux.c
-@@ -273,7 +273,7 @@ static int iface_get_id(int fd, const ch
- static int iface_get_mtu(int fd, const char *device, char *ebuf);
- static int iface_get_arptype(int fd, const char *device, char *ebuf);
- #ifdef HAVE_PF_PACKET_SOCKETS
--static int iface_bind(int fd, int ifindex, char *ebuf);
-+static int iface_bind(int fd, int ifindex, char *ebuf, unsigned short proto);
- static int has_wext(int sock_fd, const char *device, char *ebuf);
- static int enter_rfmon_mode_wext(pcap_t *handle, int sock_fd,
- const char *device);
-@@ -362,7 +362,7 @@ pcap_can_set_rfmon_linux(pcap_t *p)
- * (We assume that if we have Wireless Extensions support
- * we also have PF_PACKET support.)
- */
-- sock_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
-+ sock_fd = socket(PF_PACKET, SOCK_RAW, p->opt.proto);
- if (sock_fd == -1) {
- (void)snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
- "socket: %s", pcap_strerror(errno));
-@@ -522,6 +522,9 @@ pcap_activate_linux(pcap_t *handle)
- handle->read_op = pcap_read_linux;
- handle->stats_op = pcap_stats_linux;
-
-+ if (handle->opt.proto < 0)
-+ handle->opt.proto = (int) htons(ETH_P_ALL);
-+
- /*
- * The "any" device is a special device which causes us not
- * to bind to a particular device and thus to look at all
-@@ -1673,8 +1676,8 @@ activate_new(pcap_t *handle)
- * try a SOCK_RAW socket for the raw interface.
- */
- sock_fd = is_any_device ?
-- socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL)) :
-- socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
-+ socket(PF_PACKET, SOCK_DGRAM, handle->opt.proto) :
-+ socket(PF_PACKET, SOCK_RAW, handle->opt.proto);
-
- if (sock_fd == -1) {
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s",
-@@ -1763,7 +1766,7 @@ activate_new(pcap_t *handle)
- return PCAP_ERROR;
- }
- sock_fd = socket(PF_PACKET, SOCK_DGRAM,
-- htons(ETH_P_ALL));
-+ handle->opt.proto);
- if (sock_fd == -1) {
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
- "socket: %s", pcap_strerror(errno));
-@@ -1815,7 +1818,7 @@ activate_new(pcap_t *handle)
- }
-
- if ((err = iface_bind(sock_fd, handle->md.ifindex,
-- handle->errbuf)) != 1) {
-+ handle->errbuf, handle->opt.proto)) != 1) {
- close(sock_fd);
- if (err < 0)
- return err;
-@@ -2440,7 +2443,7 @@ iface_get_id(int fd, const char *device,
- * or a PCAP_ERROR_ value on a hard error.
- */
- static int
--iface_bind(int fd, int ifindex, char *ebuf)
-+iface_bind(int fd, int ifindex, char *ebuf, unsigned short proto)
- {
- struct sockaddr_ll sll;
- int err;
-@@ -2449,7 +2452,7 @@ iface_bind(int fd, int ifindex, char *eb
- memset(&sll, 0, sizeof(sll));
- sll.sll_family = AF_PACKET;
- sll.sll_ifindex = ifindex;
-- sll.sll_protocol = htons(ETH_P_ALL);
-+ sll.sll_protocol = proto;
-
- if (bind(fd, (struct sockaddr *) &sll, sizeof(sll)) == -1) {
- if (errno == ENETDOWN) {
-@@ -3119,7 +3122,7 @@ activate_old(pcap_t *handle)
-
- /* Open the socket */
-
-- handle->fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL));
-+ handle->fd = socket(PF_INET, SOCK_PACKET, handle->opt.proto);
- if (handle->fd == -1) {
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
- "socket: %s", pcap_strerror(errno));
---- a/pcap.c
-+++ b/pcap.c
-@@ -152,6 +152,8 @@ pcap_create_common(const char *source, c
- pcap_set_snaplen(p, 65535); /* max packet size */
- p->opt.promisc = 0;
- p->opt.buffer_size = 0;
-+ p->opt.proto = -1;
-+
- return (p);
- }
-
-@@ -212,6 +214,15 @@ pcap_set_buffer_size(pcap_t *p, int buff
- }
-
- int
-+pcap_set_protocol(pcap_t *p, unsigned short proto)
-+{
-+ if (pcap_check_activated(p))
-+ return PCAP_ERROR_ACTIVATED;
-+ p->opt.proto = proto;
-+ return 0;
-+}
-+
-+int
- pcap_activate(pcap_t *p)
- {
- int status;
---- a/pcap/pcap.h
-+++ b/pcap/pcap.h
-@@ -61,6 +61,7 @@ extern "C" {
- #define PCAP_VERSION_MINOR 4
-
- #define PCAP_ERRBUF_SIZE 256
-+#define HAS_PROTO_EXTENSION
-
- /*
- * Compatibility for systems that have a bpf.h that
-@@ -263,6 +264,7 @@ int pcap_can_set_rfmon(pcap_t *);
- int pcap_set_rfmon(pcap_t *, int);
- int pcap_set_timeout(pcap_t *, int);
- int pcap_set_buffer_size(pcap_t *, int);
-+int pcap_set_protocol(pcap_t *, unsigned short);
- int pcap_activate(pcap_t *);
-
- pcap_t *pcap_open_live(const char *, int, int, int, char *);
diff -pruN libpcap.orig/patches/200-debian_fix_any_intf.patch libpcap/patches/200-debian_fix_any_intf.patch
--- libpcap.orig/patches/200-debian_fix_any_intf.patch 1970-01-01 01:00:00.000000000 +0100
+++ libpcap/patches/200-debian_fix_any_intf.patch 2010-03-04 18:27:29.000000000 +0100
@@ -0,0 +1,149 @@
+--- a/pcap-linux.c
++++ b/pcap-linux.c
+@@ -297,6 +297,12 @@ pcap_create(const char *device, char *eb
+ {
+ pcap_t *handle;
+
++ /*
++ * A null device name is equivalent to the "any" device.
++ */
++ if (device == NULL)
++ device = "any";
++
+ #ifdef HAVE_DAG_API
+ if (strstr(device, "dag")) {
+ return dag_create(device, ebuf);
+@@ -338,10 +344,9 @@ pcap_can_set_rfmon_linux(pcap_t *p)
+ struct iwreq ireq;
+ #endif
+
+- if (p->opt.source == NULL) {
++ if (strcmp(p->opt.source, "any") == 0) {
+ /*
+- * This is equivalent to the "any" device, and we don't
+- * support monitor mode on it.
++ * Monitor mode makes no sense on the "any" device.
+ */
+ return 0;
+ }
+@@ -518,12 +523,11 @@ pcap_activate_linux(pcap_t *handle)
+ handle->stats_op = pcap_stats_linux;
+
+ /*
+- * NULL and "any" are special devices which give us the hint to
+- * monitor all devices.
++ * The "any" device is a special device which causes us not
++ * to bind to a particular device and thus to look at all
++ * devices.
+ */
+- if (!device || strcmp(device, "any") == 0) {
+- device = NULL;
+- handle->md.device = strdup("any");
++ if (strcmp(device, "any") == 0) {
+ if (handle->opt.promisc) {
+ handle->opt.promisc = 0;
+ /* Just a warning. */
+@@ -531,10 +535,9 @@ pcap_activate_linux(pcap_t *handle)
+ "Promiscuous mode not supported on the \"any\" device");
+ status = PCAP_WARNING_PROMISC_NOTSUP;
+ }
++ }
+
+- } else
+- handle->md.device = strdup(device);
+-
++ handle->md.device = strdup(device);
+ if (handle->md.device == NULL) {
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "strdup: %s",
+ pcap_strerror(errno) );
+@@ -1657,19 +1660,21 @@ static int
+ activate_new(pcap_t *handle)
+ {
+ #ifdef HAVE_PF_PACKET_SOCKETS
++ const char *device = handle->opt.source;
++ int is_any_device = (strcmp(device, "any") == 0);
+ int sock_fd = -1, arptype, val;
+ int err = 0;
+ struct packet_mreq mr;
+- const char* device = handle->opt.source;
+
+ /*
+- * Open a socket with protocol family packet. If a device is
+- * given we try to open it in raw mode otherwise we use
+- * the cooked interface.
+- */
+- sock_fd = device ?
+- socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))
+- : socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL));
++ * Open a socket with protocol family packet. If the
++ * "any" device was specified, we open a SOCK_DGRAM
++ * socket for the cooked interface, otherwise we first
++ * try a SOCK_RAW socket for the raw interface.
++ */
++ sock_fd = is_any_device ?
++ socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL)) :
++ socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+
+ if (sock_fd == -1) {
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s",
+@@ -1704,7 +1709,7 @@ activate_new(pcap_t *handle)
+ * to cooked mode if we have an unknown interface type
+ * or a type we know doesn't work well in raw mode.
+ */
+- if (device) {
++ if (!is_any_device) {
+ /* Assume for now we don't need cooked mode. */
+ handle->md.cooked = 0;
+
+@@ -1819,15 +1824,23 @@ activate_new(pcap_t *handle)
+ }
+ } else {
+ /*
+- * This is cooked mode.
++ * The "any" device.
++ */
++ if (handle->opt.rfmon) {
++ /*
++ * It doesn't support monitor mode.
++ */
++ return PCAP_ERROR_RFMON_NOTSUP;
++ }
++
++ /*
++ * It uses cooked mode.
+ */
+ handle->md.cooked = 1;
+ handle->linktype = DLT_LINUX_SLL;
+
+ /*
+ * We're not bound to a device.
+- * XXX - true? Or true only if we're using
+- * the "any" device?
+ * For now, we're using this as an indication
+ * that we can't transmit; stop doing that only
+ * if we figure out how to transmit in cooked
+@@ -1852,10 +1865,13 @@ activate_new(pcap_t *handle)
+
+ /*
+ * Hmm, how can we set promiscuous mode on all interfaces?
+- * I am not sure if that is possible at all.
++ * I am not sure if that is possible at all. For now, we
++ * silently ignore attempts to turn promiscuous mode on
++ * for the "any" device (so you don't have to explicitly
++ * disable it in programs such as tcpdump).
+ */
+
+- if (device && handle->opt.promisc) {
++ if (!is_any_device && handle->opt.promisc) {
+ memset(&mr, 0, sizeof(mr));
+ mr.mr_ifindex = handle->md.ifindex;
+ mr.mr_type = PACKET_MR_PROMISC;
+@@ -3118,7 +3134,7 @@ activate_old(pcap_t *handle)
+
+ /* Bind to the given device */
+
+- if (!device) {
++ if (strcmp(device, "any") == 0) {
+ strncpy(handle->errbuf, "pcap_activate: The \"any\" device isn't supported on 2.0[.x]-kernel systems",
+ PCAP_ERRBUF_SIZE);
+ return PCAP_ERROR;
diff -pruN libpcap.orig/patches/201-space_optimization.patch libpcap/patches/201-space_optimization.patch
--- libpcap.orig/patches/201-space_optimization.patch 1970-01-01 01:00:00.000000000 +0100
+++ libpcap/patches/201-space_optimization.patch 2010-03-04 18:27:18.000000000 +0100
@@ -0,0 +1,133 @@
+--- a/gencode.c
++++ b/gencode.c
+@@ -439,20 +439,6 @@ pcap_compile_nopcap(int snaplen_arg, int
+ }
+
+ /*
+- * Clean up a "struct bpf_program" by freeing all the memory allocated
+- * in it.
+- */
+-void
+-pcap_freecode(struct bpf_program *program)
+-{
+- program->bf_len = 0;
+- if (program->bf_insns != NULL) {
+- free((char *)program->bf_insns);
+- program->bf_insns = NULL;
+- }
+-}
+-
+-/*
+ * Backpatch the blocks in 'list' to 'target'. The 'sense' field indicates
+ * which of the jt and jf fields has been resolved and which is a pointer
+ * back to another unresolved block (or nil). At least one of the fields
+--- a/pcap.c
++++ b/pcap.c
+@@ -698,6 +698,59 @@ static const u_char charmap[] = {
+ (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377',
+ };
+
++/*
++ * Clean up a "struct bpf_program" by freeing all the memory allocated
++ * in it.
++ */
++void
++pcap_freecode(struct bpf_program *program)
++{
++ program->bf_len = 0;
++ if (program->bf_insns != NULL) {
++ free((char *)program->bf_insns);
++ program->bf_insns = NULL;
++ }
++}
++
++/*
++ * Make a copy of a BPF program and put it in the "fcode" member of
++ * a "pcap_t".
++ *
++ * If we fail to allocate memory for the copy, fill in the "errbuf"
++ * member of the "pcap_t" with an error message, and return -1;
++ * otherwise, return 0.
++ */
++int
++install_bpf_program(pcap_t *p, struct bpf_program *fp)
++{
++ size_t prog_size;
++
++ /*
++ * Validate the program.
++ */
++ if (!bpf_validate(fp->bf_insns, fp->bf_len)) {
++ snprintf(p->errbuf, sizeof(p->errbuf),
++ "BPF program is not valid");
++ return (-1);
++ }
++
++ /*
++ * Free up any already installed program.
++ */
++ pcap_freecode(&p->fcode);
++
++ prog_size = sizeof(*fp->bf_insns) * fp->bf_len;
++ p->fcode.bf_len = fp->bf_len;
++ p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size);
++ if (p->fcode.bf_insns == NULL) {
++ snprintf(p->errbuf, sizeof(p->errbuf),
++ "malloc: %s", pcap_strerror(errno));
++ return (-1);
++ }
++ memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
++ return (0);
++}
++
+ int
+ pcap_strcasecmp(const char *s1, const char *s2)
+ {
+--- a/optimize.c
++++ b/optimize.c
+@@ -2278,45 +2278,6 @@ icode_to_fcode(root, lenp)
+ return fp;
+ }
+
+-/*
+- * Make a copy of a BPF program and put it in the "fcode" member of
+- * a "pcap_t".
+- *
+- * If we fail to allocate memory for the copy, fill in the "errbuf"
+- * member of the "pcap_t" with an error message, and return -1;
+- * otherwise, return 0.
+- */
+-int
+-install_bpf_program(pcap_t *p, struct bpf_program *fp)
+-{
+- size_t prog_size;
+-
+- /*
+- * Validate the program.
+- */
+- if (!bpf_validate(fp->bf_insns, fp->bf_len)) {
+- snprintf(p->errbuf, sizeof(p->errbuf),
+- "BPF program is not valid");
+- return (-1);
+- }
+-
+- /*
+- * Free up any already installed program.
+- */
+- pcap_freecode(&p->fcode);
+-
+- prog_size = sizeof(*fp->bf_insns) * fp->bf_len;
+- p->fcode.bf_len = fp->bf_len;
+- p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size);
+- if (p->fcode.bf_insns == NULL) {
+- snprintf(p->errbuf, sizeof(p->errbuf),
+- "malloc: %s", pcap_strerror(errno));
+- return (-1);
+- }
+- memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
+- return (0);
+-}
+-
+ #ifdef BDEBUG
+ static void
+ opt_dump(root)
diff -pruN libpcap.orig/patches/202-protocol_api.patch libpcap/patches/202-protocol_api.patch
--- libpcap.orig/patches/202-protocol_api.patch 1970-01-01 01:00:00.000000000 +0100
+++ libpcap/patches/202-protocol_api.patch 2010-03-04 18:27:06.000000000 +0100
@@ -0,0 +1,141 @@
+--- a/pcap-int.h
++++ b/pcap-int.h
+@@ -187,6 +187,7 @@ struct pcap_opt {
+ char *source;
+ int promisc;
+ int rfmon;
++ int proto; /* protocol for packet socket (linux) */
+ };
+
+ /*
+--- a/pcap-linux.c
++++ b/pcap-linux.c
+@@ -273,7 +273,7 @@ static int iface_get_id(int fd, const ch
+ static int iface_get_mtu(int fd, const char *device, char *ebuf);
+ static int iface_get_arptype(int fd, const char *device, char *ebuf);
+ #ifdef HAVE_PF_PACKET_SOCKETS
+-static int iface_bind(int fd, int ifindex, char *ebuf);
++static int iface_bind(int fd, int ifindex, char *ebuf, unsigned short proto);
+ static int has_wext(int sock_fd, const char *device, char *ebuf);
+ static int enter_rfmon_mode_wext(pcap_t *handle, int sock_fd,
+ const char *device);
+@@ -362,7 +362,7 @@ pcap_can_set_rfmon_linux(pcap_t *p)
+ * (We assume that if we have Wireless Extensions support
+ * we also have PF_PACKET support.)
+ */
+- sock_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
++ sock_fd = socket(PF_PACKET, SOCK_RAW, p->opt.proto);
+ if (sock_fd == -1) {
+ (void)snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+ "socket: %s", pcap_strerror(errno));
+@@ -522,6 +522,9 @@ pcap_activate_linux(pcap_t *handle)
+ handle->read_op = pcap_read_linux;
+ handle->stats_op = pcap_stats_linux;
+
++ if (handle->opt.proto < 0)
++ handle->opt.proto = (int) htons(ETH_P_ALL);
++
+ /*
+ * The "any" device is a special device which causes us not
+ * to bind to a particular device and thus to look at all
+@@ -1673,8 +1676,8 @@ activate_new(pcap_t *handle)
+ * try a SOCK_RAW socket for the raw interface.
+ */
+ sock_fd = is_any_device ?
+- socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL)) :
+- socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
++ socket(PF_PACKET, SOCK_DGRAM, handle->opt.proto) :
++ socket(PF_PACKET, SOCK_RAW, handle->opt.proto);
+
+ if (sock_fd == -1) {
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s",
+@@ -1763,7 +1766,7 @@ activate_new(pcap_t *handle)
+ return PCAP_ERROR;
+ }
+ sock_fd = socket(PF_PACKET, SOCK_DGRAM,
+- htons(ETH_P_ALL));
++ handle->opt.proto);
+ if (sock_fd == -1) {
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+ "socket: %s", pcap_strerror(errno));
+@@ -1815,7 +1818,7 @@ activate_new(pcap_t *handle)
+ }
+
+ if ((err = iface_bind(sock_fd, handle->md.ifindex,
+- handle->errbuf)) != 1) {
++ handle->errbuf, handle->opt.proto)) != 1) {
+ close(sock_fd);
+ if (err < 0)
+ return err;
+@@ -2440,7 +2443,7 @@ iface_get_id(int fd, const char *device,
+ * or a PCAP_ERROR_ value on a hard error.
+ */
+ static int
+-iface_bind(int fd, int ifindex, char *ebuf)
++iface_bind(int fd, int ifindex, char *ebuf, unsigned short proto)
+ {
+ struct sockaddr_ll sll;
+ int err;
+@@ -2449,7 +2452,7 @@ iface_bind(int fd, int ifindex, char *eb
+ memset(&sll, 0, sizeof(sll));
+ sll.sll_family = AF_PACKET;
+ sll.sll_ifindex = ifindex;
+- sll.sll_protocol = htons(ETH_P_ALL);
++ sll.sll_protocol = proto;
+
+ if (bind(fd, (struct sockaddr *) &sll, sizeof(sll)) == -1) {
+ if (errno == ENETDOWN) {
+@@ -3119,7 +3122,7 @@ activate_old(pcap_t *handle)
+
+ /* Open the socket */
+
+- handle->fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL));
++ handle->fd = socket(PF_INET, SOCK_PACKET, handle->opt.proto);
+ if (handle->fd == -1) {
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+ "socket: %s", pcap_strerror(errno));
+--- a/pcap.c
++++ b/pcap.c
+@@ -152,6 +152,8 @@ pcap_create_common(const char *source, c
+ pcap_set_snaplen(p, 65535); /* max packet size */
+ p->opt.promisc = 0;
+ p->opt.buffer_size = 0;
++ p->opt.proto = -1;
++
+ return (p);
+ }
+
+@@ -212,6 +214,15 @@ pcap_set_buffer_size(pcap_t *p, int buff
+ }
+
+ int
++pcap_set_protocol(pcap_t *p, unsigned short proto)
++{
++ if (pcap_check_activated(p))
++ return PCAP_ERROR_ACTIVATED;
++ p->opt.proto = proto;
++ return 0;
++}
++
++int
+ pcap_activate(pcap_t *p)
+ {
+ int status;
+--- a/pcap/pcap.h
++++ b/pcap/pcap.h
+@@ -61,6 +61,7 @@ extern "C" {
+ #define PCAP_VERSION_MINOR 4
+
+ #define PCAP_ERRBUF_SIZE 256
++#define HAS_PROTO_EXTENSION
+
+ /*
+ * Compatibility for systems that have a bpf.h that
+@@ -263,6 +264,7 @@ int pcap_can_set_rfmon(pcap_t *);
+ int pcap_set_rfmon(pcap_t *, int);
+ int pcap_set_timeout(pcap_t *, int);
+ int pcap_set_buffer_size(pcap_t *, int);
++int pcap_set_protocol(pcap_t *, unsigned short);
+ int pcap_activate(pcap_t *);
+
+ pcap_t *pcap_open_live(const char *, int, int, int, char *);
diff -pruN libpcap.orig/patches/203-undef_iw_mode_monitor.patch libpcap/patches/203-undef_iw_mode_monitor.patch
--- libpcap.orig/patches/203-undef_iw_mode_monitor.patch 1970-01-01 01:00:00.000000000 +0100
+++ libpcap/patches/203-undef_iw_mode_monitor.patch 2010-03-04 18:26:50.000000000 +0100
@@ -0,0 +1,11 @@
+--- a/pcap-linux.c
++++ b/pcap-linux.c
+@@ -194,6 +194,8 @@ static const char rcsid[] _U_ =
+ typedef int socklen_t;
+ #endif
+
++#undef IW_MODE_MONITOR
++
+ #ifndef MSG_TRUNC
+ /*
+ * This is being compiled on a system that lacks MSG_TRUNC; define it
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel