libpcap: update to 1.9.0
001-Fix-compiler_state_t.ai-usage-when-INET6-is-not-defi.patch dropped due to upstream 002-Add-missing-compiler_state_t-parameter.patch dropped due to upstream 202-protocol_api.patch dropped due to implemented upstream by another way upstream commit:55c690f6f8
and renamed via:697b1f7e9b
ead is the only user who use the protocol api, we have to use the new api since libpcap 1.9.0 Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
parent
c0608c6a27
commit
4d57c696b1
9 changed files with 50 additions and 306 deletions
|
@ -8,13 +8,13 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=libpcap
|
PKG_NAME:=libpcap
|
||||||
PKG_VERSION:=1.8.1
|
PKG_VERSION:=1.9.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \
|
PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \
|
||||||
http://www.tcpdump.org/release/
|
http://www.tcpdump.org/release/
|
||||||
PKG_HASH:=673dbc69fdc3f5a86fb5759ab19899039a8e5e6c631749e48dcd9c6f0c83541e
|
PKG_HASH:=2edb88808e5913fdaa8e9c1fcaf272e19b2485338742b5074b9fe44d68f37019
|
||||||
PKG_FIXUP:=patch-libtool
|
PKG_FIXUP:=patch-libtool
|
||||||
|
|
||||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
From 64aa033a061c43fc15c711f2490ae41d23b868c3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Fabio Berton <fabio.berton@ossystems.com.br>
|
|
||||||
Date: Thu, 17 Nov 2016 09:44:42 -0200
|
|
||||||
Subject: [PATCH 1/2] Fix compiler_state_t.ai usage when INET6 is not defined
|
|
||||||
Organization: O.S. Systems Software LTDA.
|
|
||||||
|
|
||||||
Fix error:
|
|
||||||
|
|
||||||
/
|
|
||||||
| ../libpcap-1.8.1/gencode.c: In function 'pcap_compile':
|
|
||||||
| ../libpcap-1.8.1/gencode.c:693:8: error: 'compiler_state_t
|
|
||||||
| {aka struct _compiler_state}' has no member named 'ai'
|
|
||||||
| cstate.ai = NULL;
|
|
||||||
\
|
|
||||||
|
|
||||||
Upstream-Status: Submitted [1]
|
|
||||||
|
|
||||||
[1] https://github.com/the-tcpdump-group/libpcap/pull/541
|
|
||||||
|
|
||||||
Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
|
|
||||||
---
|
|
||||||
gencode.c | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/gencode.c b/gencode.c
|
|
||||||
index a887f27..e103c70 100644
|
|
||||||
--- a/gencode.c
|
|
||||||
+++ b/gencode.c
|
|
||||||
@@ -690,7 +690,9 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
|
|
||||||
}
|
|
||||||
initchunks(&cstate);
|
|
||||||
cstate.no_optimize = 0;
|
|
||||||
+#ifdef INET6
|
|
||||||
cstate.ai = NULL;
|
|
||||||
+#endif
|
|
||||||
cstate.ic.root = NULL;
|
|
||||||
cstate.ic.cur_mark = 0;
|
|
||||||
cstate.bpf_pcap = p;
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
From 50ec0a088d5924a8305b2d70dcba71b0942dee1a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Fabio Berton <fabio.berton@ossystems.com.br>
|
|
||||||
Date: Thu, 17 Nov 2016 09:47:29 -0200
|
|
||||||
Subject: [PATCH 2/2] Add missing compiler_state_t parameter
|
|
||||||
Organization: O.S. Systems Software LTDA.
|
|
||||||
|
|
||||||
Fix error:
|
|
||||||
|
|
||||||
/
|
|
||||||
|../libpcap-1.8.1/gencode.c: In function 'gen_gateway':
|
|
||||||
|../libpcap-1.8.1/gencode.c:4914:13: error: 'cstate' undeclared
|
|
||||||
| (first use in this function)
|
|
||||||
| bpf_error(cstate, "direction applied to 'gateway'");
|
|
||||||
\
|
|
||||||
|
|
||||||
Upstream-Status: Submitted [1]
|
|
||||||
|
|
||||||
[1] https://github.com/the-tcpdump-group/libpcap/pull/541
|
|
||||||
|
|
||||||
Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
|
|
||||||
---
|
|
||||||
gencode.c | 15 ++++++++-------
|
|
||||||
1 file changed, 8 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/gencode.c b/gencode.c
|
|
||||||
index e103c70..f07c0be 100644
|
|
||||||
--- a/gencode.c
|
|
||||||
+++ b/gencode.c
|
|
||||||
@@ -523,7 +523,7 @@ static struct block *gen_host6(compiler_state_t *, struct in6_addr *,
|
|
||||||
struct in6_addr *, int, int, int);
|
|
||||||
#endif
|
|
||||||
#ifndef INET6
|
|
||||||
-static struct block *gen_gateway(const u_char *, bpf_u_int32 **, int, int);
|
|
||||||
+static struct block *gen_gateway(compiler_state_t *, const u_char *, bpf_u_int32 **, int, int);
|
|
||||||
#endif
|
|
||||||
static struct block *gen_ipfrag(compiler_state_t *);
|
|
||||||
static struct block *gen_portatom(compiler_state_t *, int, bpf_int32);
|
|
||||||
@@ -4904,11 +4904,12 @@ gen_host6(compiler_state_t *cstate, struct in6_addr *addr,
|
|
||||||
|
|
||||||
#ifndef INET6
|
|
||||||
static struct block *
|
|
||||||
-gen_gateway(eaddr, alist, proto, dir)
|
|
||||||
- const u_char *eaddr;
|
|
||||||
- bpf_u_int32 **alist;
|
|
||||||
- int proto;
|
|
||||||
- int dir;
|
|
||||||
+gen_gateway(cstate, eaddr, alist, proto, dir)
|
|
||||||
+ compiler_state_t *cstate;
|
|
||||||
+ const u_char *eaddr;
|
|
||||||
+ bpf_u_int32 **alist;
|
|
||||||
+ int proto;
|
|
||||||
+ int dir;
|
|
||||||
{
|
|
||||||
struct block *b0, *b1, *tmp;
|
|
||||||
|
|
||||||
@@ -6472,7 +6473,7 @@ gen_scode(compiler_state_t *cstate, const char *name, struct qual q)
|
|
||||||
alist = pcap_nametoaddr(name);
|
|
||||||
if (alist == NULL || *alist == NULL)
|
|
||||||
bpf_error(cstate, "unknown host '%s'", name);
|
|
||||||
- b = gen_gateway(eaddr, alist, proto, dir);
|
|
||||||
+ b = gen_gateway(cstate, eaddr, alist, proto, dir);
|
|
||||||
free(eaddr);
|
|
||||||
return b;
|
|
||||||
#else
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ build a shared library.
|
||||||
|
|
||||||
--- a/Makefile.in
|
--- a/Makefile.in
|
||||||
+++ b/Makefile.in
|
+++ b/Makefile.in
|
||||||
@@ -38,6 +38,13 @@ mandir = @mandir@
|
@@ -40,6 +40,13 @@ mandir = @mandir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
|
||||||
|
@ -17,17 +17,17 @@ build a shared library.
|
||||||
#
|
#
|
||||||
# You shouldn't need to edit anything below.
|
# You shouldn't need to edit anything below.
|
||||||
#
|
#
|
||||||
@@ -62,7 +69,8 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
|
@@ -69,7 +76,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@
|
||||||
PROG=libpcap
|
EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@
|
||||||
|
|
||||||
# Standard CFLAGS
|
# Standard CFLAGS for building members of a shared library
|
||||||
-FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
|
-FULL_CFLAGS = $(CCOPT) $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
|
||||||
+FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS)
|
+FULL_CFLAGS = $(CCOPT) $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS)
|
||||||
+CFLAGS_SHARED = -shared -Wl,-soname,$(SHAREDLIB)
|
+CFLAGS_SHARED = -shared -Wl,-soname,$(SHAREDLIB)
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
@@ -77,7 +85,11 @@ YACC = @YACC@
|
@@ -84,7 +92,11 @@ YACC = @YACC@
|
||||||
# problem if you don't own the file but can write to the directory.
|
# problem if you don't own the file but can write to the directory.
|
||||||
.c.o:
|
.c.o:
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
|
@ -38,9 +38,9 @@ build a shared library.
|
||||||
+ @rm -f $@
|
+ @rm -f $@
|
||||||
+ $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
|
||||||
|
|
||||||
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@
|
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ @NETMAP_SRC@ @RDMA_SRC@
|
||||||
FSRC = @V_FINDALLDEVS@
|
FSRC = @V_FINDALLDEVS@
|
||||||
@@ -93,6 +105,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
|
@@ -101,6 +113,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
|
||||||
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
|
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
|
||||||
# hack the extra indirection
|
# hack the extra indirection
|
||||||
OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
|
OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
|
||||||
|
@ -48,16 +48,16 @@ build a shared library.
|
||||||
PUBHDR = \
|
PUBHDR = \
|
||||||
pcap.h \
|
pcap.h \
|
||||||
pcap-bpf.h \
|
pcap-bpf.h \
|
||||||
@@ -157,7 +170,7 @@ TAGFILES = \
|
@@ -154,7 +167,7 @@ TAGFILES = \
|
||||||
|
|
||||||
CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
|
CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \
|
||||||
$(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
|
$(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
|
||||||
- lex.yy.c pcap-config
|
- lex.yy.c pcap-config libpcap.pc
|
||||||
+ lex.yy.c pcap-config $(OBJ_PIC)
|
+ lex.yy.c pcap-config libpcap.pc $(OBJ_PIC)
|
||||||
|
|
||||||
MAN1 = pcap-config.1
|
MAN1 = pcap-config.1
|
||||||
|
|
||||||
@@ -365,7 +378,7 @@ libpcap.a: $(OBJ)
|
@@ -386,7 +399,7 @@ libpcap.a: $(OBJ)
|
||||||
$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
|
$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ build a shared library.
|
||||||
|
|
||||||
libpcap.so: $(OBJ)
|
libpcap.so: $(OBJ)
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
@@ -443,6 +456,12 @@ libpcap.shareda: $(OBJ)
|
@@ -462,6 +475,12 @@ libpcap.shareda: $(OBJ)
|
||||||
#
|
#
|
||||||
libpcap.none:
|
libpcap.none:
|
||||||
|
|
||||||
|
@ -79,44 +79,37 @@ build a shared library.
|
||||||
scanner.c: $(srcdir)/scanner.l
|
scanner.c: $(srcdir)/scanner.l
|
||||||
$(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $<
|
$(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $<
|
||||||
scanner.h: scanner.c
|
scanner.h: scanner.c
|
||||||
@@ -455,6 +474,9 @@ scanner.h: scanner.c
|
@@ -474,6 +493,9 @@ scanner.h: scanner.c
|
||||||
scanner.o: scanner.c grammar.h
|
scanner.o: scanner.c grammar.h
|
||||||
$(CC) $(FULL_CFLAGS) -c scanner.c
|
$(CC) $(FULL_CFLAGS) -c scanner.c
|
||||||
|
|
||||||
+scanner_pic.o: scanner.c grammar.h
|
+scanner_pic.o: scanner.c grammar.h
|
||||||
+ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c scanner.c
|
+ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c scanner.c
|
||||||
+
|
+
|
||||||
pcap.o: pcap_version.h
|
|
||||||
|
|
||||||
grammar.c: $(srcdir)/grammar.y
|
grammar.c: $(srcdir)/grammar.y
|
||||||
@@ -472,9 +494,16 @@ grammar.o: grammar.c
|
$(YACC) -p pcap_ -o grammar.c -d $<
|
||||||
|
grammar.h: grammar.c
|
||||||
|
@@ -486,6 +508,9 @@ grammar.h: grammar.c
|
||||||
|
grammar.o: grammar.c scanner.h
|
||||||
|
$(CC) $(FULL_CFLAGS) -c grammar.c
|
||||||
|
|
||||||
|
+grammar_pic.o: grammar.c scanner.h
|
||||||
|
+ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c grammar.c
|
||||||
|
+
|
||||||
gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
|
gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
|
||||||
$(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
|
$(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
|
||||||
|
|
||||||
+grammar_pic.o: grammar.c
|
@@ -524,6 +549,9 @@ pcap-config: $(srcdir)/pcap-config.in ./
|
||||||
+ @rm -f $@
|
mv $@.tmp $@
|
||||||
+ $(CC) -fPIC $(FULL_CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
|
chmod a+x $@
|
||||||
+
|
|
||||||
version.o: version.c
|
|
||||||
$(CC) $(FULL_CFLAGS) -c version.c
|
|
||||||
|
|
||||||
+version_pic.o: version.c
|
|
||||||
+ $(CC) -fPIC $(FULL_CFLAGS) -c version.c -o $@
|
|
||||||
+
|
|
||||||
snprintf.o: $(srcdir)/missing/snprintf.c
|
|
||||||
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
|
|
||||||
|
|
||||||
@@ -501,6 +530,9 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt
|
|
||||||
bpf_filter.o: bpf_filter.c
|
|
||||||
$(CC) $(FULL_CFLAGS) -c bpf_filter.c
|
|
||||||
|
|
||||||
+bpf_filter_pic.o: bpf_filter.c
|
+bpf_filter_pic.o: bpf_filter.c
|
||||||
+ $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@
|
||||||
+
|
+
|
||||||
#
|
#
|
||||||
# Generate the pcap-config script.
|
# Remote pcap daemon.
|
||||||
#
|
#
|
||||||
@@ -623,14 +655,11 @@ install: install-shared install-archive
|
@@ -614,14 +642,11 @@ install: install-shared install-archive
|
||||||
$(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
|
$(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
|
||||||
|
|
||||||
install-shared: install-shared-$(DYEXT)
|
install-shared: install-shared-$(DYEXT)
|
||||||
|
@ -136,27 +129,27 @@ build a shared library.
|
||||||
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
||||||
--- a/aclocal.m4
|
--- a/aclocal.m4
|
||||||
+++ b/aclocal.m4
|
+++ b/aclocal.m4
|
||||||
@@ -470,7 +470,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
@@ -507,7 +507,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
- V_CCOPT="$V_CCOPT $PIC_OPT"
|
- V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT"
|
||||||
+ V_CCOPT="$V_CCOPT"
|
+ V_SHLIB_CCOPT="$V_SHLIB_CCOPT"
|
||||||
V_SONAME_OPT="-Wl,-soname,"
|
V_SONAME_OPT="-Wl,-soname,"
|
||||||
V_RPATH_OPT="-Wl,-rpath,"
|
V_RPATH_OPT="-Wl,-rpath,"
|
||||||
;;
|
;;
|
||||||
@@ -533,7 +533,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
@@ -570,7 +570,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
||||||
#
|
#
|
||||||
# "cc" is GCC.
|
# "cc" is GCC.
|
||||||
#
|
#
|
||||||
- V_CCOPT="$V_CCOPT -fpic"
|
- V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
|
||||||
+ V_CCOPT="$V_CCOPT"
|
+ V_SHLIB_CCOPT="$V_SHLIB_CCOPT"
|
||||||
V_SHLIB_CMD="\$(CC)"
|
V_SHLIB_CMD="\$(CC)"
|
||||||
V_SHLIB_OPT="-shared"
|
V_SHLIB_OPT="-shared"
|
||||||
V_SONAME_OPT="-Wl,-soname,"
|
V_SONAME_OPT="-Wl,-soname,"
|
||||||
--- a/pcap-config.in
|
--- a/pcap-config.in
|
||||||
+++ b/pcap-config.in
|
+++ b/pcap-config.in
|
||||||
@@ -36,16 +36,6 @@ do
|
@@ -41,16 +41,6 @@ do
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/Makefile.in
|
--- a/Makefile.in
|
||||||
+++ b/Makefile.in
|
+++ b/Makefile.in
|
||||||
@@ -589,70 +589,12 @@ install: install-shared install-archive
|
@@ -573,14 +573,6 @@ install: install-shared install-archive
|
||||||
(mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
|
(mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
|
||||||
[ -d $(DESTDIR)$(includedir)/pcap ] || \
|
[ -d $(DESTDIR)$(includedir)/pcap ] || \
|
||||||
(mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
|
(mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
|
||||||
|
@ -15,9 +15,10 @@
|
||||||
for i in $(PUBHDR); do \
|
for i in $(PUBHDR); do \
|
||||||
$(INSTALL_DATA) $(srcdir)/$$i \
|
$(INSTALL_DATA) $(srcdir)/$$i \
|
||||||
$(DESTDIR)$(includedir)/$$i; done
|
$(DESTDIR)$(includedir)/$$i; done
|
||||||
[ -d $(DESTDIR)$(bindir) ] || \
|
@@ -590,56 +582,6 @@ install: install-shared install-archive
|
||||||
(mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
|
[ -d $(DESTDIR)$(libdir)/pkgconfig ] || \
|
||||||
$(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
|
(mkdir -p $(DESTDIR)$(libdir)/pkgconfig; chmod 755 $(DESTDIR)$(libdir)/pkgconfig)
|
||||||
|
$(INSTALL_DATA) libpcap.pc $(DESTDIR)$(libdir)/pkgconfig/libpcap.pc
|
||||||
- for i in $(MAN1); do \
|
- for i in $(MAN1); do \
|
||||||
- $(INSTALL_DATA) $(srcdir)/$$i \
|
- $(INSTALL_DATA) $(srcdir)/$$i \
|
||||||
- $(DESTDIR)$(mandir)/man1/$$i; done
|
- $(DESTDIR)$(mandir)/man1/$$i; done
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
--- a/Makefile.in
|
--- a/Makefile.in
|
||||||
+++ b/Makefile.in
|
+++ b/Makefile.in
|
||||||
@@ -56,7 +56,7 @@ LN_S = @LN_S@
|
@@ -59,7 +59,7 @@ MKDEP = @MKDEP@
|
||||||
MKDEP = @MKDEP@
|
|
||||||
CCOPT = @V_CCOPT@
|
CCOPT = @V_CCOPT@
|
||||||
|
SHLIB_CCOPT = @V_SHLIB_CCOPT@
|
||||||
INCLS = -I. @V_INCLS@
|
INCLS = -I. @V_INCLS@
|
||||||
-DEFS = -DBUILDING_PCAP @DEFS@ @V_DEFS@
|
-DEFS = -DBUILDING_PCAP -Dpcap_EXPORTS @DEFS@ @V_DEFS@
|
||||||
+DEFS = -DBUILDING_PCAP -D_BSD_SOURCE @DEFS@ @V_DEFS@
|
+DEFS = -DBUILDING_PCAP -D_BSD_SOURCE -Dpcap_EXPORTS @DEFS@ @V_DEFS@
|
||||||
ADDLOBJS = @ADDLOBJS@
|
ADDLOBJS = @ADDLOBJS@
|
||||||
ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
|
ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/pcap-common.c
|
--- a/pcap-common.c
|
||||||
+++ b/pcap-common.c
|
+++ b/pcap-common.c
|
||||||
@@ -1447,14 +1447,23 @@ swap_pseudo_headers(int linktype, struct
|
@@ -1524,14 +1524,23 @@ swap_pseudo_headers(int linktype, struct
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLT_USB_LINUX:
|
case DLT_USB_LINUX:
|
||||||
|
|
|
@ -1,142 +0,0 @@
|
||||||
This API extension is used by ead (Emergency Access Daemon)
|
|
||||||
|
|
||||||
--- a/pcap-linux.c
|
|
||||||
+++ b/pcap-linux.c
|
|
||||||
@@ -425,7 +425,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);
|
|
||||||
#ifdef IW_MODE_MONITOR
|
|
||||||
static int has_wext(int sock_fd, const char *device, char *ebuf);
|
|
||||||
#endif /* IW_MODE_MONITOR */
|
|
||||||
@@ -1059,7 +1059,7 @@ pcap_can_set_rfmon_linux(pcap_t *handle)
|
|
||||||
* (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)pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
|
||||||
"socket: %s", pcap_strerror(errno));
|
|
||||||
@@ -1456,6 +1456,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
|
|
||||||
@@ -3335,8 +3338,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) {
|
|
||||||
if (errno == EINVAL || errno == EAFNOSUPPORT) {
|
|
||||||
@@ -3454,7 +3457,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) {
|
|
||||||
pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
|
||||||
"socket: %s", pcap_strerror(errno));
|
|
||||||
@@ -3518,7 +3521,7 @@ activate_new(pcap_t *handle)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((err = iface_bind(sock_fd, handlep->ifindex,
|
|
||||||
- handle->errbuf)) != 1) {
|
|
||||||
+ handle->errbuf, handle->opt.proto)) != 1) {
|
|
||||||
close(sock_fd);
|
|
||||||
if (err < 0)
|
|
||||||
return err;
|
|
||||||
@@ -5271,7 +5274,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;
|
|
||||||
@@ -5280,7 +5283,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) {
|
|
||||||
@@ -6325,7 +6328,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) {
|
|
||||||
pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
|
||||||
"socket: %s", pcap_strerror(errno));
|
|
||||||
--- a/pcap.c
|
|
||||||
+++ b/pcap.c
|
|
||||||
@@ -578,6 +578,7 @@ pcap_create_common(char *ebuf, size_t si
|
|
||||||
p->opt.promisc = 0;
|
|
||||||
p->opt.rfmon = 0;
|
|
||||||
p->opt.immediate = 0;
|
|
||||||
+ p->opt.proto = -1;
|
|
||||||
p->opt.tstamp_type = -1; /* default to not setting time stamp type */
|
|
||||||
p->opt.tstamp_precision = PCAP_TSTAMP_PRECISION_MICRO;
|
|
||||||
|
|
||||||
@@ -771,6 +772,15 @@ pcap_get_tstamp_precision(pcap_t *p)
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -68,6 +68,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
|
|
||||||
@@ -287,6 +288,7 @@ PCAP_API int pcap_set_timeout(pcap_t *,
|
|
||||||
PCAP_API int pcap_set_tstamp_type(pcap_t *, int);
|
|
||||||
PCAP_API int pcap_set_immediate_mode(pcap_t *, int);
|
|
||||||
PCAP_API int pcap_set_buffer_size(pcap_t *, int);
|
|
||||||
+PCAP_API int pcap_set_protocol(pcap_t *, unsigned short);
|
|
||||||
PCAP_API int pcap_set_tstamp_precision(pcap_t *, int);
|
|
||||||
PCAP_API int pcap_get_tstamp_precision(pcap_t *);
|
|
||||||
PCAP_API int pcap_activate(pcap_t *);
|
|
||||||
--- a/pcap-int.h
|
|
||||||
+++ b/pcap-int.h
|
|
||||||
@@ -111,6 +111,7 @@ struct pcap_opt {
|
|
||||||
char *device;
|
|
||||||
int timeout; /* timeout for buffering */
|
|
||||||
u_int buffer_size;
|
|
||||||
+ int proto; /* protocol for packet socket (linux) */
|
|
||||||
int promisc;
|
|
||||||
int rfmon; /* monitor mode */
|
|
||||||
int immediate; /* immediate mode - deliver packets as soon as they arrive */
|
|
|
@ -2,7 +2,7 @@ Fix USB bus path; /proc/bus/usb is deprecated.
|
||||||
|
|
||||||
--- a/pcap-usb-linux.c
|
--- a/pcap-usb-linux.c
|
||||||
+++ b/pcap-usb-linux.c
|
+++ b/pcap-usb-linux.c
|
||||||
@@ -71,7 +71,7 @@
|
@@ -72,7 +72,7 @@
|
||||||
#define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon"
|
#define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon"
|
||||||
#define USB_TEXT_DIR "/sys/kernel/debug/usb/usbmon"
|
#define USB_TEXT_DIR "/sys/kernel/debug/usb/usbmon"
|
||||||
#define SYS_USB_BUS_DIR "/sys/bus/usb/devices"
|
#define SYS_USB_BUS_DIR "/sys/bus/usb/devices"
|
||||||
|
|
Loading…
Reference in a new issue