From 541737f469cbd0ebd41c1ff6bcd2ae0760e5bb4d Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Tue, 20 Jun 2017 13:25:15 +0200 Subject: libpcap: fix build without INET6 With deactivated IPv6 libpcap fails to build. There was a pull request upstream to fix this, and upstream decided to fix it, but differently: https://github.com/the-tcpdump-group/libpcap/pull/541 This imports just the one upstream changeset to fix the issue, and reorganizes the patch series to reflect the different types of patches. Signed-off-by: Alexander Dahl Signed-off-by: Michael Olbrich --- ...01-Fix-compilation-if-INET6-isn-t-defined.patch | 58 ++++++++++++++++++++++ .../0001-build-and-install-share-lib-only.patch | 35 ------------- .../0002-pcap-config-add-SYSROOT-support.patch | 33 ------------ ...igure.ac-allow-specifying-path-for-libnl3.patch | 25 ---------- .../0100-build-and-install-share-lib-only.patch | 35 +++++++++++++ .../0101-pcap-config-add-SYSROOT-support.patch | 33 ++++++++++++ ...igure.ac-allow-specifying-path-for-libnl3.patch | 25 ++++++++++ patches/libpcap-1.8.1/series | 11 ++-- 8 files changed, 158 insertions(+), 97 deletions(-) create mode 100644 patches/libpcap-1.8.1/0001-Fix-compilation-if-INET6-isn-t-defined.patch delete mode 100644 patches/libpcap-1.8.1/0001-build-and-install-share-lib-only.patch delete mode 100644 patches/libpcap-1.8.1/0002-pcap-config-add-SYSROOT-support.patch delete mode 100644 patches/libpcap-1.8.1/0003-configure.ac-allow-specifying-path-for-libnl3.patch create mode 100644 patches/libpcap-1.8.1/0100-build-and-install-share-lib-only.patch create mode 100644 patches/libpcap-1.8.1/0101-pcap-config-add-SYSROOT-support.patch create mode 100644 patches/libpcap-1.8.1/0102-configure.ac-allow-specifying-path-for-libnl3.patch (limited to 'patches') diff --git a/patches/libpcap-1.8.1/0001-Fix-compilation-if-INET6-isn-t-defined.patch b/patches/libpcap-1.8.1/0001-Fix-compilation-if-INET6-isn-t-defined.patch new file mode 100644 index 000000000..7607752e1 --- /dev/null +++ b/patches/libpcap-1.8.1/0001-Fix-compilation-if-INET6-isn-t-defined.patch @@ -0,0 +1,58 @@ +From: Guy Harris +Date: Tue, 17 Jan 2017 02:58:52 -0800 +Subject: [PATCH] Fix compilation if INET6 isn't defined. + +Addresses GitHub issue #541, but differently from the pull request (it +defines gen_gateway() with a function prototype rather than using a +pre-prototype-style definition). +--- + gencode.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/gencode.c b/gencode.c +index a887f2730f7a..60494e3de974 100644 +--- a/gencode.c ++++ b/gencode.c +@@ -523,7 +523,8 @@ 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); +@@ -690,7 +691,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; +@@ -4902,11 +4905,8 @@ 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(compiler_state_t *cstate, const u_char *eaddr, bpf_u_int32 **alist, ++ int proto, int dir) + { + struct block *b0, *b1, *tmp; + +@@ -6470,7 +6470,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 diff --git a/patches/libpcap-1.8.1/0001-build-and-install-share-lib-only.patch b/patches/libpcap-1.8.1/0001-build-and-install-share-lib-only.patch deleted file mode 100644 index 85ce7015d..000000000 --- a/patches/libpcap-1.8.1/0001-build-and-install-share-lib-only.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: Michael Olbrich -Date: Fri, 31 May 2013 17:28:01 +0200 -Subject: [PATCH] build and install share lib only - -This patch removes the static library from the dependency list -for "all" and "install". This way libpcap.a is not built and -tcpdump cannot link against it. - -Signed-off-by: Alexander Aring ---- - Makefile.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile.in b/Makefile.in -index e71d973ca448..e0debadeb837 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -358,7 +358,7 @@ EXTRA_DIST = \ - Win32/Prj/wpcap.vcxproj \ - Win32/Prj/wpcap.vcxproj.filters - --all: libpcap.a shared pcap-config -+all: shared pcap-config - - libpcap.a: $(OBJ) - @rm -f $@ -@@ -550,7 +550,7 @@ selpolltest: tests/selpolltest.c libpcap.a - valgrindtest: tests/valgrindtest.c libpcap.a - $(CC) $(FULL_CFLAGS) -I. -L. -o valgrindtest $(srcdir)/tests/valgrindtest.c libpcap.a $(LIBS) - --install: install-shared install-archive pcap-config -+install: install-shared pcap-config - [ -d $(DESTDIR)$(libdir) ] || \ - (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) - [ -d $(DESTDIR)$(includedir) ] || \ diff --git a/patches/libpcap-1.8.1/0002-pcap-config-add-SYSROOT-support.patch b/patches/libpcap-1.8.1/0002-pcap-config-add-SYSROOT-support.patch deleted file mode 100644 index 51cf6c554..000000000 --- a/patches/libpcap-1.8.1/0002-pcap-config-add-SYSROOT-support.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Marc Kleine-Budde -Date: Sun, 10 Jan 2010 00:49:07 +0100 -Subject: [PATCH] pcap-config: add SYSROOT support - -Signed-off-by: Alexander Aring ---- - pcap-config.in | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/pcap-config.in b/pcap-config.in -index 206be3b4a644..50b05f53d32e 100644 ---- a/pcap-config.in -+++ b/pcap-config.in -@@ -6,8 +6,8 @@ - # - prefix="@prefix@" - exec_prefix="@exec_prefix@" --includedir="@includedir@" --libdir="@libdir@" -+includedir="${SYSROOT}@includedir@" -+libdir="${SYSROOT}@libdir@" - V_RPATH_OPT="@V_RPATH_OPT@" - LIBS="@LIBS@" - -@@ -41,7 +41,7 @@ then - # - # If libdir isn't /usr/lib, add it to the run-time linker path. - # -- if [ "$libdir" != "/usr/lib" ] -+ if [ "$libdir" != "${SYSROOT}/usr/lib" ] - then - RPATH=$V_RPATH_OPT$libdir - fi diff --git a/patches/libpcap-1.8.1/0003-configure.ac-allow-specifying-path-for-libnl3.patch b/patches/libpcap-1.8.1/0003-configure.ac-allow-specifying-path-for-libnl3.patch deleted file mode 100644 index 3e56d90c9..000000000 --- a/patches/libpcap-1.8.1/0003-configure.ac-allow-specifying-path-for-libnl3.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Michael Olbrich -Date: Wed, 29 Jan 2014 09:17:52 +0100 -Subject: [PATCH] configure.ac: allow specifying path for libnl3 - ---- - configure.ac | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index da2f940da963..8a3ab56d865c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -511,7 +511,11 @@ linux) - AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x]) - AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE]) - AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api]) -- V_INCLS="$V_INCLS ${incdir}" -+ if test x$with_libnl != xyes ; then -+ V_INCLS="$V_INCLS -I${with_libnl}/include/libnl3" -+ else -+ V_INCLS="$V_INCLS ${incdir}" -+ fi - have_any_nl="yes" - ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 ) - diff --git a/patches/libpcap-1.8.1/0100-build-and-install-share-lib-only.patch b/patches/libpcap-1.8.1/0100-build-and-install-share-lib-only.patch new file mode 100644 index 000000000..85ce7015d --- /dev/null +++ b/patches/libpcap-1.8.1/0100-build-and-install-share-lib-only.patch @@ -0,0 +1,35 @@ +From: Michael Olbrich +Date: Fri, 31 May 2013 17:28:01 +0200 +Subject: [PATCH] build and install share lib only + +This patch removes the static library from the dependency list +for "all" and "install". This way libpcap.a is not built and +tcpdump cannot link against it. + +Signed-off-by: Alexander Aring +--- + Makefile.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index e71d973ca448..e0debadeb837 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -358,7 +358,7 @@ EXTRA_DIST = \ + Win32/Prj/wpcap.vcxproj \ + Win32/Prj/wpcap.vcxproj.filters + +-all: libpcap.a shared pcap-config ++all: shared pcap-config + + libpcap.a: $(OBJ) + @rm -f $@ +@@ -550,7 +550,7 @@ selpolltest: tests/selpolltest.c libpcap.a + valgrindtest: tests/valgrindtest.c libpcap.a + $(CC) $(FULL_CFLAGS) -I. -L. -o valgrindtest $(srcdir)/tests/valgrindtest.c libpcap.a $(LIBS) + +-install: install-shared install-archive pcap-config ++install: install-shared pcap-config + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + [ -d $(DESTDIR)$(includedir) ] || \ diff --git a/patches/libpcap-1.8.1/0101-pcap-config-add-SYSROOT-support.patch b/patches/libpcap-1.8.1/0101-pcap-config-add-SYSROOT-support.patch new file mode 100644 index 000000000..51cf6c554 --- /dev/null +++ b/patches/libpcap-1.8.1/0101-pcap-config-add-SYSROOT-support.patch @@ -0,0 +1,33 @@ +From: Marc Kleine-Budde +Date: Sun, 10 Jan 2010 00:49:07 +0100 +Subject: [PATCH] pcap-config: add SYSROOT support + +Signed-off-by: Alexander Aring +--- + pcap-config.in | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/pcap-config.in b/pcap-config.in +index 206be3b4a644..50b05f53d32e 100644 +--- a/pcap-config.in ++++ b/pcap-config.in +@@ -6,8 +6,8 @@ + # + prefix="@prefix@" + exec_prefix="@exec_prefix@" +-includedir="@includedir@" +-libdir="@libdir@" ++includedir="${SYSROOT}@includedir@" ++libdir="${SYSROOT}@libdir@" + V_RPATH_OPT="@V_RPATH_OPT@" + LIBS="@LIBS@" + +@@ -41,7 +41,7 @@ then + # + # If libdir isn't /usr/lib, add it to the run-time linker path. + # +- if [ "$libdir" != "/usr/lib" ] ++ if [ "$libdir" != "${SYSROOT}/usr/lib" ] + then + RPATH=$V_RPATH_OPT$libdir + fi diff --git a/patches/libpcap-1.8.1/0102-configure.ac-allow-specifying-path-for-libnl3.patch b/patches/libpcap-1.8.1/0102-configure.ac-allow-specifying-path-for-libnl3.patch new file mode 100644 index 000000000..3e56d90c9 --- /dev/null +++ b/patches/libpcap-1.8.1/0102-configure.ac-allow-specifying-path-for-libnl3.patch @@ -0,0 +1,25 @@ +From: Michael Olbrich +Date: Wed, 29 Jan 2014 09:17:52 +0100 +Subject: [PATCH] configure.ac: allow specifying path for libnl3 + +--- + configure.ac | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index da2f940da963..8a3ab56d865c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -511,7 +511,11 @@ linux) + AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x]) + AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE]) + AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api]) +- V_INCLS="$V_INCLS ${incdir}" ++ if test x$with_libnl != xyes ; then ++ V_INCLS="$V_INCLS -I${with_libnl}/include/libnl3" ++ else ++ V_INCLS="$V_INCLS ${incdir}" ++ fi + have_any_nl="yes" + ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 ) + diff --git a/patches/libpcap-1.8.1/series b/patches/libpcap-1.8.1/series index 5b8e8a230..7e01f0602 100644 --- a/patches/libpcap-1.8.1/series +++ b/patches/libpcap-1.8.1/series @@ -1,6 +1,9 @@ # generated by git-ptx-patches #tag:base --start-number 1 -0001-build-and-install-share-lib-only.patch -0002-pcap-config-add-SYSROOT-support.patch -0003-configure.ac-allow-specifying-path-for-libnl3.patch -# 04919371617f914a399e4491d8b76206 - git-ptx-patches magic +#tag:upstream --start-number 1 +0001-Fix-compilation-if-INET6-isn-t-defined.patch +#tag:ptx --start-number 100 +0100-build-and-install-share-lib-only.patch +0101-pcap-config-add-SYSROOT-support.patch +0102-configure.ac-allow-specifying-path-for-libnl3.patch +# 363b6cba4073355bfab4a58107b4a1da - git-ptx-patches magic -- cgit v1.2.3