On 2023-03-31, at 22:36:01 +0000, Alyssa Ross wrote: > If building statically, with libpcap built with libnl support, linking > will fail, as the compiler won't be able to find the libnl symbols > since static libraries don't contain dependency information. To fix > this, use pkg-config to find the flags for linking libpcap, since the > pkg-config files contain the neccesary dependency information. ^^^^^^^^^ "necessary" > Signed-off-by: Alyssa Ross <hi@xxxxxxxxx> LGTM. The only thing I would say is that pkg-config support was added to libpcap comparatively recently (2018). When I made similar changes to ulogd2 last year, I added a fall-back to pcap-config: https://git.netfilter.org/ulogd2/commit/?id=be4df8f66eb843dc19c7d1fed7c33fd7a40c2e21 > --- > configure.ac | 3 ++- > utils/Makefile.am | 6 +++--- > 2 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/configure.ac b/configure.ac > index bc2ed47b..e0bb26aa 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -114,7 +114,8 @@ AM_CONDITIONAL([ENABLE_NFTABLES], [test "$enable_nftables" = "yes"]) > AM_CONDITIONAL([ENABLE_CONNLABEL], [test "$enable_connlabel" = "yes"]) > > if test "x$enable_bpfc" = "xyes" || test "x$enable_nfsynproxy" = "xyes"; then > - AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool)) > + PKG_CHECK_MODULES([libpcap], [libpcap], [], [ > + AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool)]) > fi > > PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0], > diff --git a/utils/Makefile.am b/utils/Makefile.am > index e9eec48f..34056514 100644 > --- a/utils/Makefile.am > +++ b/utils/Makefile.am > @@ -2,7 +2,7 @@ > > AM_CFLAGS = ${regular_CFLAGS} > AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include \ > - -I${top_srcdir}/include ${libnfnetlink_CFLAGS} > + -I${top_srcdir}/include ${libnfnetlink_CFLAGS} ${libpcap_CFLAGS} > AM_LDFLAGS = ${regular_LDFLAGS} > > sbin_PROGRAMS = > @@ -25,12 +25,12 @@ endif > if ENABLE_BPFC > man_MANS += nfbpf_compile.8 > sbin_PROGRAMS += nfbpf_compile > -nfbpf_compile_LDADD = -lpcap > +nfbpf_compile_LDADD = ${libpcap_LIBS} > endif > > if ENABLE_SYNCONF > sbin_PROGRAMS += nfsynproxy > -nfsynproxy_LDADD = -lpcap > +nfsynproxy_LDADD = ${libpcap_LIBS} > endif > > CLEANFILES = nfnl_osf.8 nfbpf_compile.8 > > base-commit: 09f0bfe2032454d21e3650e7ac75c4dc53f3c881 > -- > 2.37.1 > > J.
Attachment:
signature.asc
Description: PGP signature