Skip to contentSkip to conversation

configure: improve FreeBSD DCO check

PATCH In review Kristof Provost 2 participants 2 messages Mar 1, 2023 – Mar 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 configure: improve FreeBSD DCO check

From: Kristof Provost <[email protected]...>

The libnv check doesn't work as expected on FreeBSD 14.x, because FreeBSD has namespaced libnv to avoid conflicts with libnvpair. This means that the naive check generated by AC_CHECK_LIB() fails to detect libnv even though it's present.

Instead check for the if_ovpn.h header. This is a more accurate check anyway, as libnv is present on FreeBSD versions prior to 14 (which do not support DCO).

---
 configure.ac | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
configure.ac +2 -4
index 4c271464..67f680b2 100644
@@ -832,9 +832,7 @@ if test "$enable_dco" != "no"; then
 			fi
 			;;
 		*-*-freebsd*)
-			AC_CHECK_LIB(
-				[nv],
-				[nvlist_create],
+			AC_CHECK_HEADERS([net/if_ovpn.h],
 				[
 				 LIBS="${LIBS} -lnv"
 				 AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for FreeBSD])
@@ -842,7 +840,7 @@ if test "$enable_dco" != "no"; then
 				],
 				[
 				 enable_dco="no"
-				 AC_MSG_WARN([Name/Value pair library not found.])
+				 AC_MSG_WARN([DCO header not found.])
 				]
 			)
 			if test "$enable_dco" = "no"; then
Signature · 1 line
2.39.2
Acked-by on v1 1/2
#1 lore raw

Thanks for spotting & fixing this, and apologies for still not having a FreeBSD 14 buildslave.

Indeed, the existing configure.ac hard breaks my FreeBSD 14 setup (which I didn't look at for a while, "because it works")...

checking for nvlist_create in -lnv... no
configure: WARNING: Name/Value pair library not found.
configure: error: DCO support can't be enabled

(because "./configure --enable-dco" -> succeed or error out).

With "enable DCO on auto", the existing code does

checking for nvlist_create in -lnv... no
configure: WARNING: Name/Value pair library not found.
configure: WARNING: DCO support disabled

and proceeds to build a binary with no DCO!

With this patch applied, "no arguments" or "--enable-dco" both succeed...

checking for net/if_ovpn.h... yes
configure: Enabled ovpn-dco support for FreeBSD

on earlier FreeBSD versions (7.4), it just disables DCO, and proceeds happily - as it should be.

configure: WARNING: DCO header not found.
configure: WARNING: DCO support disabled

Your patch has been applied to the master and release/2.6 branch.

commit 6f261673dee26ae8cfdf58f77038098d4f81d84a (master) commit 86fb085b6d2582916ef59b4bd8bd5e4a072964a3 (release/2.6)

Author: Kristof Provost
Date:   Wed Mar 1 10:18:48 2023 +0100
     configure: improve FreeBSD DCO check

     Signed-off-by: Kristof Provost <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26314.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering