diff -Nru libpcap-1.8.1/debian/changelog libpcap-1.8.1/debian/changelog --- libpcap-1.8.1/debian/changelog 2019-11-22 00:52:20.000000000 +0000 +++ libpcap-1.8.1/debian/changelog 2020-06-29 21:49:04.000000000 +0000 @@ -1,3 +1,20 @@ +libpcap (1.8.1-6ubuntu1.18.04.2) bionic; urgency=medium + + * Install pkg-config file for libpcap (LP: #1865501). + - d/p/set-package-name-with-ac-init.patch: Set the PACKAGE_NAME + variable using autoconf's AC_INIT macro, so that we can use it + in the libpcap.pc.in file. + - d/p/use-m4-macro-to-get-version.patch: Use an M4 macro to + execute a "cat" command and obtain the version from the VERSION + file. + - d/p/install-pkg-config-file.patch: New patch from upstream, + which creates a libpcap.pc.in file and adjusts the Makefile to + install it. + - d/libpcap0.8-dev.install: Install libpcap.pc pkg-config file. + Thanks to Luca Boccassi for the Debian patch (Closes #922219). + + -- Sergio Durigan Junior Mon, 29 Jun 2020 17:49:04 -0400 + libpcap (1.8.1-6ubuntu1.18.04.1) bionic-security; urgency=medium * SECURITY UPDATE: pcapng reading buffer over-read. diff -Nru libpcap-1.8.1/debian/libpcap0.8-dev.install libpcap-1.8.1/debian/libpcap0.8-dev.install --- libpcap-1.8.1/debian/libpcap0.8-dev.install 2017-12-31 22:16:48.000000000 +0000 +++ libpcap-1.8.1/debian/libpcap0.8-dev.install 2020-06-29 21:49:04.000000000 +0000 @@ -2,4 +2,5 @@ usr/include/pcap* usr/lib/*/libpcap.a usr/lib/*/libpcap.so +usr/lib/*/pkgconfig/libpcap.pc usr/share/man diff -Nru libpcap-1.8.1/debian/patches/install-pkg-config-file.patch libpcap-1.8.1/debian/patches/install-pkg-config-file.patch --- libpcap-1.8.1/debian/patches/install-pkg-config-file.patch 1970-01-01 00:00:00.000000000 +0000 +++ libpcap-1.8.1/debian/patches/install-pkg-config-file.patch 2020-06-29 21:49:04.000000000 +0000 @@ -0,0 +1,137 @@ +From: Guy Harris +Date: Wed, 25 Apr 2018 17:22:45 -0700 +Subject: Add a pkg-config .pc file for libpcap. + +Addresses GitHub issue #374. + +Author: Guy Harris +Origin: backport, https://github.com/the-tcpdump-group/libpcap/commit/a7deb6a241f8c71ca261adc45ac07c8427074792 +Bug: https://github.com/the-tcpdump-group/libpcap/issues/374 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libpcap/+bug/1865501 +Reviewed-By: Sergio Durigan Junior +Last-Update: 2020-06-29 +--- + Makefile.in | 28 +++++++++++++++++++++------- + libpcap.pc.in | 18 ++++++++++++++++++ + 2 files changed, 39 insertions(+), 7 deletions(-) + create mode 100644 libpcap.pc.in + +diff --git a/Makefile.in b/Makefile.in +index d8562f1..44b9274 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -171,7 +171,7 @@ TAGFILES = \ + + CLEANFILES = $(OBJ) libpcap.* $(TESTS) \ + $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \ +- lex.yy.c pcap-config $(OBJ_PIC) ++ lex.yy.c pcap-config libpcap.pc $(OBJ_PIC) + + MAN1 = pcap-config.1 + +@@ -300,6 +300,7 @@ EXTRA_DIST = \ + lbl/os-solaris2.h \ + lbl/os-sunos4.h \ + lbl/os-ultrix4.h \ ++ libpcap.pc.in \ + missing/getopt.c \ + missing/getopt.h \ + missing/snprintf.c \ +@@ -372,7 +373,7 @@ EXTRA_DIST = \ + Win32/Prj/wpcap.vcxproj \ + Win32/Prj/wpcap.vcxproj.filters + +-all: libpcap.a shared pcap-config ++all: libpcap.a shared libpcap.pc pcap-config + + libpcap.a: $(OBJ) + @rm -f $@ +@@ -536,7 +537,7 @@ bpf_filter_pic.o: bpf_filter.c + $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@ + + # +-# Generate the pcap-config script. ++# Generate the libpcap.pc file. + # + # Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<"; + # for example, the Solaris 9 make man page says +@@ -547,7 +548,16 @@ bpf_filter_pic.o: bpf_filter.c + # + # and this is an explicit target entry. + # +-# Therefore, instead of using $<, we explicitly put in $(srcdir)/pcap-config.in. ++# Therefore, instead of using $<, we explicitly put in $(srcdir)/libpcap.pc.in. ++# ++libpcap.pc: $(srcdir)/libpcap.pc.in ./config.status ++ @rm -f $@ $@.tmp ++ ./config.status --file=$@.tmp:$(srcdir)/libpcap.pc.in ++ mv $@.tmp $@ ++ chmod a+x $@ ++ ++# ++# Generate the pcap-config script. See above. + # + pcap-config: $(srcdir)/pcap-config.in ./config.status + @rm -f $@ $@.tmp +@@ -584,7 +594,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 install-archive libpcap.pc pcap-config + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + [ -d $(DESTDIR)$(includedir) ] || \ +@@ -605,6 +615,9 @@ install: install-shared install-archive pcap-config + [ -d $(DESTDIR)$(bindir) ] || \ + (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir)) + $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config ++ [ -d $(DESTDIR)$(libdir)/pkgconfig ] || \ ++ (mkdir -p $(DESTDIR)$(libdir)/pkgconfig; chmod 755 $(DESTDIR)$(libdir)/pkgconfig) ++ $(INSTALL_DATA) libpcap.pc $(DESTDIR)$(libdir)/pkgconfig/libpcap.pc + for i in $(MAN1); do \ + $(INSTALL_DATA) $(srcdir)/$$i \ + $(DESTDIR)$(mandir)/man1/$$i; done +@@ -708,6 +721,7 @@ uninstall: uninstall-shared + for i in $(PUBHDR); do \ + rm -f $(DESTDIR)$(includedir)/$$i; done + -rmdir $(DESTDIR)$(includedir)/pcap ++ rm -f $(DESTDIR)/$(libdir)/pkgconfig/libpcap.pc + rm -f $(DESTDIR)/$(bindir)/pcap-config + for i in $(MAN1); do \ + rm -f $(DESTDIR)$(mandir)/man1/$$i; done +@@ -760,8 +774,8 @@ clean: + + distclean: clean + rm -f Makefile config.cache config.log config.status \ +- config.h gnuc.h net os-proto.h bpf_filter.c pcap-config \ +- stamp-h stamp-h.in ++ config.h gnuc.h net os-proto.h bpf_filter.c libpcap.pc \ ++ pcap-config stamp-h stamp-h.in + rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=) + rm -rf autom4te.cache + +diff --git a/libpcap.pc.in b/libpcap.pc.in +new file mode 100644 +index 0000000..d74cbc5 +--- /dev/null ++++ b/libpcap.pc.in +@@ -0,0 +1,18 @@ ++# ++# pkg-config file for libpcap. ++# ++# These variables come from the configure script, so includedir and ++# libdir may be defined in terms of prefix and exec_prefix, so the ++# latter must be defined as well. ++# ++prefix="@prefix@" ++exec_prefix="@exec_prefix@" ++includedir="@includedir@" ++libdir="@libdir@" ++ ++Name: libpcap ++Description: Platform-independent network traffic capture library ++Version: @PACKAGE_VERSION@ ++Libs: -L${libdir} -l@PACKAGE_NAME@ ++Libs.private: @LIBS@ ++Cflags: -I${includedir} diff -Nru libpcap-1.8.1/debian/patches/series libpcap-1.8.1/debian/patches/series --- libpcap-1.8.1/debian/patches/series 2019-11-22 00:52:13.000000000 +0000 +++ libpcap-1.8.1/debian/patches/series 2020-06-29 21:49:04.000000000 +0000 @@ -11,3 +11,6 @@ 0001-Revert-Add-file-capture-length-sanity-check-for-pcap.patch CVE-2019-15165-1.patch CVE-2019-15165-2.patch +set-package-name-with-ac-init.patch +use-m4-macro-to-get-version.patch +install-pkg-config-file.patch diff -Nru libpcap-1.8.1/debian/patches/set-package-name-with-ac-init.patch libpcap-1.8.1/debian/patches/set-package-name-with-ac-init.patch --- libpcap-1.8.1/debian/patches/set-package-name-with-ac-init.patch 1970-01-01 00:00:00.000000000 +0000 +++ libpcap-1.8.1/debian/patches/set-package-name-with-ac-init.patch 2020-06-29 21:49:04.000000000 +0000 @@ -0,0 +1,160 @@ +From: Sergio Durigan Junior +Date: Mon, 29 Jun 2020 17:39:01 -0400 +Subject: Don't wire the library name into pcap-config. + +With autotools, set the package name with AC_INIT(), which now takes the +package name and version as arguments, rather than the name of a file in +the source directory. That sets PACKAGE_NAME. + +With CMake, set PACKAGE_NAME to ${LIBRARY_NAME}. + +In pcap-config.in, use "-l@PACKAGE_NAME@", rather than -lpcap, as the +library name. + +That means that pcap-config will use -lwpcap, rather than -lpcap, on +Windows, where the library's name is wpcap rather than just pcap. + +Author: Guy Harris +Origin: backport, https://github.com/the-tcpdump-group/libpcap/commit/c2e151358d7bc7c77dddb4ca00770034872cd081 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libpcap/+bug/1865501 +Reviewed-By: Sergio Durigan Junior +Last-Update: 2020-06-29 +--- + configure | 31 ++++++++++++++++--------------- + configure.ac | 3 ++- + pcap-config.in | 5 +++-- + 3 files changed, 21 insertions(+), 18 deletions(-) + +diff --git a/configure b/configure +index 4c64875..fd14f5f 100755 +--- a/configure ++++ b/configure +@@ -1,6 +1,6 @@ + #! /bin/sh + # Guess values for system-dependent variables and create Makefiles. +-# Generated by GNU Autoconf 2.69. ++# Generated by GNU Autoconf 2.69 for pcap 1.8.1. + # + # + # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +@@ -575,14 +575,13 @@ MFLAGS= + MAKEFLAGS= + + # Identity of this package. +-PACKAGE_NAME= +-PACKAGE_TARNAME= +-PACKAGE_VERSION= +-PACKAGE_STRING= +-PACKAGE_BUGREPORT= +-PACKAGE_URL= +- +-ac_unique_file="pcap.c" ++PACKAGE_NAME='pcap' ++PACKAGE_TARNAME='pcap' ++PACKAGE_VERSION='1.8.1' ++PACKAGE_STRING='pcap 1.8.1' ++PACKAGE_BUGREPORT='' ++PACKAGE_URL='' ++ + # Factoring default headers for most tests. + ac_includes_default="\ + #include +@@ -803,7 +802,7 @@ sharedstatedir='${prefix}/com' + localstatedir='${prefix}/var' + includedir='${prefix}/include' + oldincludedir='/usr/include' +-docdir='${datarootdir}/doc/${PACKAGE}' ++docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' + infodir='${datarootdir}/info' + htmldir='${docdir}' + dvidir='${docdir}' +@@ -1303,7 +1302,7 @@ if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +-\`configure' configures this package to adapt to many kinds of systems. ++\`configure' configures pcap 1.8.1 to adapt to many kinds of systems. + + Usage: $0 [OPTION]... [VAR=VALUE]... + +@@ -1351,7 +1350,7 @@ Fine tuning of the installation directories: + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] +- --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] ++ --docdir=DIR documentation root [DATAROOTDIR/doc/pcap] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] +@@ -1368,7 +1367,9 @@ _ACEOF + fi + + if test -n "$ac_init_help"; then +- ++ case $ac_init_help in ++ short | recursive ) echo "Configuration of pcap 1.8.1:";; ++ esac + cat <<\_ACEOF + + Optional Features: +@@ -1500,7 +1501,7 @@ fi + test -n "$ac_init_help" && exit $ac_status + if $ac_init_version; then + cat <<\_ACEOF +-configure ++pcap configure 1.8.1 + generated by GNU Autoconf 2.69 + + Copyright (C) 2012 Free Software Foundation, Inc. +@@ -1965,7 +1966,7 @@ cat >config.log <<_ACEOF + This file contains any messages produced by compilers while + running configure, to aid debugging if configure makes a mistake. + +-It was created by $as_me, which was ++It was created by pcap $as_me 1.8.1, which was + generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ +diff --git a/configure.ac b/configure.ac +index 46bbd67..9952e04 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -15,7 +15,8 @@ dnl + # + + AC_PREREQ(2.61) +-AC_INIT(pcap.c) ++AC_INIT(pcap, 1.8.1) ++AC_SUBST(PACKAGE_NAME) + + AC_CANONICAL_SYSTEM + +diff --git a/pcap-config.in b/pcap-config.in +index 16522dd..945c52d 100644 +--- a/pcap-config.in ++++ b/pcap-config.in +@@ -8,6 +8,7 @@ prefix="@prefix@" + exec_prefix="@exec_prefix@" + includedir="@includedir@" + LIBS="@LIBS@" ++PACKAGE_NAME="@PACKAGE_NAME@" + + static=0 + show_cflags=0 +@@ -63,7 +64,7 @@ else + # + if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] + then +- echo "-I$includedir -lpcap" ++ echo "-I$includedir -l$PACKAGE_NAME" + elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] + then + echo "-I$includedir" +@@ -72,6 +73,6 @@ else + echo "-I$includedir" + elif [ "$show_libs" = 1 ] + then +- echo "-lpcap" ++ echo "-l$PACKAGE_NAME" + fi + fi diff -Nru libpcap-1.8.1/debian/patches/use-m4-macro-to-get-version.patch libpcap-1.8.1/debian/patches/use-m4-macro-to-get-version.patch --- libpcap-1.8.1/debian/patches/use-m4-macro-to-get-version.patch 1970-01-01 00:00:00.000000000 +0000 +++ libpcap-1.8.1/debian/patches/use-m4-macro-to-get-version.patch 2020-06-29 21:49:04.000000000 +0000 @@ -0,0 +1,27 @@ +From: Ali Abdulkadir +Date: Wed, 4 Oct 2017 04:08:18 +0300 +Subject: Use a m4 macro to get version string from file + +Author: Ali Abdulkadir +Origin: backport, https://github.com/the-tcpdump-group/libpcap/commit/263e6ca61e072cd8abe82b58e6b3f6539c2cdaaa +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libpcap/+bug/1865501 +Reviewed-By: Sergio Durigan Junior +Last-Update: 2020-06-29 +--- + configure.ac | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 9952e04..febdb69 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -15,7 +15,8 @@ dnl + # + + AC_PREREQ(2.61) +-AC_INIT(pcap, 1.8.1) ++ ++AC_INIT(pcap, m4_esyscmd_s([cat VERSION])) + AC_SUBST(PACKAGE_NAME) + + AC_CANONICAL_SYSTEM