diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/Manifest b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/Manifest index 96ee31132b..4f3a214de0 100644 --- a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/Manifest +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/Manifest @@ -1 +1,2 @@ DIST libnl-3.10.0.tar.gz 1116186 BLAKE2B 13383c4ef49be3bcf89122b24d1d5dc9834353aa7128f04f50993203add14aa7f97a4500164982ddcb82f481f7324a26efc2375036d5a23bfa62b15c4fe07473 SHA512 c95e79fba69308c63a08d0c576503b4398710ea9cd1d0097851500a7fbc5fbe87fb32ac281cf42bbfe57eab07b110055e6bc9b95d82244bba3df8a31fe562962 +DIST libnl-3.11.0.tar.gz 1124072 BLAKE2B 8e2792620f56e1e9e05e4fe1f9bece70938c82c2d1a9f4e0f9de1ce0b1a7a2bf60f31a42e6056407b383875c08c575b26df87b9bd6b421d5053e96983e193c54 SHA512 69ecec6e792fc7b9c443fff8742cf45782af5c5c4664687440942eaeb616ba7b4ed2b606e33c5d86e44e6b49a9c79a1fed4b7c77781a059e13cf6a844d94530e diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/0001-Fix-compilation-error-in-GCC-14.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/0001-Fix-compilation-error-in-GCC-14.patch new file mode 100644 index 0000000000..e0efcabb17 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/0001-Fix-compilation-error-in-GCC-14.patch @@ -0,0 +1,36 @@ +https://github.com/thom311/libnl/commit/f278e5921498fc635bd9534a3f24979bb1b2849d + +From f278e5921498fc635bd9534a3f24979bb1b2849d Mon Sep 17 00:00:00 2001 +From: Aleksander Mazur <19613255+OlekMazur@users.noreply.github.com> +Date: Sat, 29 Mar 2025 01:34:46 +0100 +Subject: [PATCH] Fix compilation error in GCC 14 + +lib/socket.c: In function '_badrandom_from_time': +lib/socket.c:70:13: error: implicit declaration of function 'time' [-Wimplicit-function-declaration] + 70 | t = time(NULL); + | ^~~~ +lib/socket.c:39:1: note: 'time' is defined in header ''; this is probably fixable by adding '#include ' + 38 | #include "nl-aux-core/nl-core.h" + +++ |+#include + 39 | + +https://github.com/thom311/libnl/pull/424 +--- + lib/socket.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/socket.c b/lib/socket.c +index 4e64cbb3..c6200958 100644 +--- a/lib/socket.c ++++ b/lib/socket.c +@@ -23,6 +23,7 @@ + + #include "nl-default.h" + ++#include + #include + #include + #include +-- +2.49.0 + diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/libnl-3.11.0-no-iproute2.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/libnl-3.11.0-no-iproute2.patch new file mode 100644 index 0000000000..d14ae2ae42 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/libnl-3.11.0-no-iproute2.patch @@ -0,0 +1,18 @@ +Avoid the following test failure within network-sandbox: + tests/cksuite-all-netns.c:335:F:Core:route_1:0: command(system("ip -d link set v1 up")) has unexpected positive return code 512 +--- a/tests/nl-test-util.c ++++ b/tests/nl-test-util.c +@@ -780,12 +780,7 @@ bool _nltst_in_ci(void) + + bool _nltst_has_iproute2(void) + { +- static int has = -1; +- +- if (has == -1) +- has = (system("ip link &>/dev/null") == 0); +- +- return has; ++ return false; + } + + bool _nltst_skip_no_iproute2(const char *msg) diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/libnl-3.11.0-tests-ns.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/libnl-3.11.0-tests-ns.patch new file mode 100644 index 0000000000..5dffea0468 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/files/libnl-3.11.0-tests-ns.patch @@ -0,0 +1,176 @@ +https://github.com/thom311/libnl/commit/b3822aa3b605b2dc5f01f9aee8ee224fc23e23a0 + +From b3822aa3b605b2dc5f01f9aee8ee224fc23e23a0 Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Sun, 12 Jan 2025 10:54:59 +0100 +Subject: [PATCH] test: skip tests when having no private netns + +In github CI we seem now unable to create the netns. This worked +previously, now it no longer does. + +Handle that by skipping the tests that require a netns. +--- + tests/cksuite-all-netns.c | 13 +++++++++- + tests/nl-test-util.c | 50 +++++++++++++++++++++++++++++++++++++-- + tests/nl-test-util.h | 3 +++ + 3 files changed, 63 insertions(+), 3 deletions(-) + +diff --git a/tests/cksuite-all-netns.c b/tests/cksuite-all-netns.c +index 1948c3e8..04e0f6df 100644 +--- a/tests/cksuite-all-netns.c ++++ b/tests/cksuite-all-netns.c +@@ -73,6 +73,9 @@ START_TEST(cache_and_clone) + size_t i; + int r; + ++ if (_nltst_skip_no_netns()) ++ return; ++ + for (i = 0; i < _NL_N_ELEMENTS(links); i++) { + if (links[i].add) + _nltst_add_link(NULL, links[i].ifname, links[i].kind, +@@ -132,11 +135,16 @@ START_TEST(test_create_iface) + _nl_auto_rtnl_link struct rtnl_link *link2 = NULL; + _nl_auto_rtnl_link struct rtnl_link *peer = NULL; + _nltst_auto_delete_link const char *IFNAME_DUMMY = NULL; +- _nltst_auto_delete_link const char *IFNAME = "ifname"; ++ _nltst_auto_delete_link const char *IFNAME = NULL; + int ifindex_dummy; + uint32_t u32; + int r; + ++ if (_nltst_skip_no_netns()) ++ return; ++ ++ IFNAME = "ifname"; ++ + switch (TEST_IDX) { + case 0: + link = _nltst_assert(rtnl_link_bridge_alloc()); +@@ -317,6 +325,9 @@ START_TEST(route_1) + _nl_auto_nl_socket struct nl_sock *sk = NULL; + _nl_auto_nl_cache struct nl_cache *cache = NULL; + ++ if (_nltst_skip_no_netns()) ++ return; ++ + if (_nltst_skip_no_iproute2("route_1")) + return; + +diff --git a/tests/nl-test-util.c b/tests/nl-test-util.c +index dc8dc5ad..d1a8f3f1 100644 +--- a/tests/nl-test-util.c ++++ b/tests/nl-test-util.c +@@ -84,6 +84,7 @@ uint32_t _nltst_rand_u32(void) + + struct nltst_netns { + int canary; ++ bool is_unshared; + }; + + /*****************************************************************************/ +@@ -114,6 +115,23 @@ void nltst_netns_fixture_teardown(void) + _nl_clear_pointer(&_netns_fixture_global.nsdata, nltst_netns_leave); + } + ++bool nltst_netns_fixture_is_unshared(void) ++{ ++ _assert_nltst_netns(_netns_fixture_global.nsdata); ++ return _netns_fixture_global.nsdata->is_unshared; ++} ++ ++/*****************************************************************************/ ++ ++bool _nltst_skip_no_netns(void) ++{ ++ if (nltst_netns_fixture_is_unshared()) ++ return false; ++ ++ printf("skip test due to having no private netns\n"); ++ return true; ++} ++ + /*****************************************************************************/ + + static void unshare_user(void) +@@ -125,6 +143,10 @@ static void unshare_user(void) + + /* Become a root in new user NS. */ + r = unshare(CLONE_NEWUSER); ++ if (r != 0 && errno == EPERM) { ++ /* No permissions? Ignore. Will be handled later. */ ++ return; ++ } + _nltst_assert_errno(r == 0); + + /* Since Linux 3.19 we have to disable setgroups() in order to map users. +@@ -149,14 +171,28 @@ static void unshare_user(void) + } + r = fprintf(f, "0 %d 1", uid); + _nltst_assert_errno(r > 0); +- _nltst_fclose(f); ++ r = fclose(f); ++ if (r != 0 && errno == EPERM) { ++ /* Oddly, it seems close() can fail at this point. Ignore it, ++ * but we probably will be unable to unshare (which we handle ++ * later). ++ */ ++ } else ++ _nltst_assert_errno(r == 0); + + /* Map current GID to root in NS to be created. */ + f = fopen("/proc/self/gid_map", "we"); + _nltst_assert_errno(f); + r = fprintf(f, "0 %d 1", gid); + _nltst_assert_errno(r > 0); +- _nltst_fclose(f); ++ r = fclose(f); ++ if (r != 0 && errno == EPERM) { ++ /* Oddly, it seems close() can fail at this point. Ignore it, but ++ * we probably will be unable to unshare (which we handle ++ * later). ++ */ ++ } else ++ _nltst_assert_errno(r == 0); + } + + struct nltst_netns *nltst_netns_enter(void) +@@ -172,6 +208,15 @@ struct nltst_netns *nltst_netns_enter(void) + unshare_user(); + + r = unshare(CLONE_NEWNET | CLONE_NEWNS); ++ if (r != 0 && errno == EPERM) { ++ /* The system is probably sandboxed somehow and we are unable ++ * to create a private netns. That seems questionable, because ++ * a point of a private netns is to sandbox an application. ++ * Not having permissions to sandbox sounds bad. ++ * ++ * Anyway. We accept this and will later skip some tests. */ ++ return nsdata; ++ } + _nltst_assert_errno(r == 0); + + /* We need a read-only /sys so that the platform knows there's no udev. */ +@@ -179,6 +224,7 @@ struct nltst_netns *nltst_netns_enter(void) + r = mount("sys", "/sys", "sysfs", MS_RDONLY, NULL); + _nltst_assert_errno(r == 0); + ++ nsdata->is_unshared = true; + return nsdata; + } + +diff --git a/tests/nl-test-util.h b/tests/nl-test-util.h +index 981228b4..d840a4ab 100644 +--- a/tests/nl-test-util.h ++++ b/tests/nl-test-util.h +@@ -429,6 +429,9 @@ char **_nltst_strtokv(const char *str); + + void nltst_netns_fixture_setup(void); + void nltst_netns_fixture_teardown(void); ++bool nltst_netns_fixture_is_unshared(void); ++ ++bool _nltst_skip_no_netns(void); + + struct nltst_netns; + + diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/libnl-3.11.0.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/libnl-3.11.0.ebuild new file mode 100644 index 0000000000..7087ab65b1 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/libnl-3.11.0.ebuild @@ -0,0 +1,137 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# Make sure to test USE=utils on bumps and update MULTILIB_WRAPPED_HEADERS if needed + +DISTUTILS_EXT=1 +DISTUTILS_OPTIONAL=1 +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{11..14} ) +inherit autotools distutils-r1 multilib-minimal + +LIBNL_P=${P/_/-} +LIBNL_DIR=${PV/_/} +LIBNL_DIR=${LIBNL_DIR//./_} + +DESCRIPTION="Libraries providing APIs to netlink protocol based Linux kernel interfaces" +HOMEPAGE="https://www.infradead.org/~tgr/libnl/ https://github.com/thom311/libnl" +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://github.com/thom311/libnl" + inherit git-r3 +else + SRC_URI="https://github.com/thom311/${PN}/releases/download/${PN}${LIBNL_DIR}/${P/_rc/-rc}.tar.gz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" + + S="${WORKDIR}/${LIBNL_P}" +fi + +LICENSE="LGPL-2.1 utils? ( GPL-2 )" +SLOT="3" +IUSE="+debug python test utils" +RESTRICT="!test? ( test )" + +RDEPEND="python? ( ${PYTHON_DEPS} )" +DEPEND="${RDEPEND}" +BDEPEND=" + ${RDEPEND} + sys-devel/bison + sys-devel/flex + virtual/pkgconfig + python? ( + ${DISTUTILS_DEPS} + dev-lang/swig + ) + test? ( dev-libs/check ) +" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +MULTILIB_WRAPPED_HEADERS=( + # We do not install CLI stuff for non-native + /usr/include/libnl3/netlink/cli/addr.h + /usr/include/libnl3/netlink/cli/class.h + /usr/include/libnl3/netlink/cli/cls.h + /usr/include/libnl3/netlink/cli/ct.h + /usr/include/libnl3/netlink/cli/exp.h + /usr/include/libnl3/netlink/cli/link.h + /usr/include/libnl3/netlink/cli/mdb.h + /usr/include/libnl3/netlink/cli/nh.h + /usr/include/libnl3/netlink/cli/neigh.h + /usr/include/libnl3/netlink/cli/qdisc.h + /usr/include/libnl3/netlink/cli/route.h + /usr/include/libnl3/netlink/cli/rule.h + /usr/include/libnl3/netlink/cli/tc.h + /usr/include/libnl3/netlink/cli/utils.h +) + +PATCHES=( + "${FILESDIR}"/0001-Fix-compilation-error-in-GCC-14.patch + "${FILESDIR}"/${P}-tests-ns.patch + "${FILESDIR}"/${PN}-3.11.0-no-iproute2.patch +) + +src_prepare() { + default + + eautoreconf + + if use python; then + pushd "${S}"/python > /dev/null || die + distutils-r1_src_prepare + popd > /dev/null || die + fi +} + +multilib_src_configure() { + # bug #884277 + export YACC=yacc.bison + + ECONF_SOURCE="${S}" econf \ + $(multilib_native_use_enable utils cli) \ + $(use_enable debug) +} + +multilib_src_compile() { + default + + if multilib_is_native_abi && use python ; then + pushd python > /dev/null || die + distutils-r1_src_compile + popd > /dev/null || die + fi +} + +multilib_src_test() { + CK_VERBOSITY=verbose emake check VERBOSE=1 + + if multilib_is_native_abi && use python ; then + pushd python > /dev/null || die + # TODO: run python/tests/test-create-bridge.py + distutils-r1_src_test + popd > /dev/null || die + fi +} + +multilib_src_install() { + default + + if multilib_is_native_abi && use python ; then + # Unset DOCS= since distutils-r1.eclass interferes + local DOCS=() + + pushd python > /dev/null || die + + distutils-r1_src_install + + popd > /dev/null || die + fi +} + +multilib_src_install_all() { + DOCS=( ChangeLog ) + + einstalldocs + + find "${ED}" -name '*.la' -delete || die +} diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/libnl-9999.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/libnl-9999.ebuild index b30c49db70..5d4ac2e9b2 100644 --- a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/libnl-9999.ebuild +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/libnl-9999.ebuild @@ -8,7 +8,7 @@ EAPI=8 DISTUTILS_EXT=1 DISTUTILS_OPTIONAL=1 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{11..14} ) inherit autotools distutils-r1 multilib-minimal LIBNL_P=${P/_/-} @@ -30,9 +30,7 @@ fi LICENSE="LGPL-2.1 utils? ( GPL-2 )" SLOT="3" IUSE="+debug python test utils" -# Tests fail w/ sandboxes -# https://github.com/thom311/libnl/issues/361 -RESTRICT="!test? ( test ) test" +RESTRICT="!test? ( test )" RDEPEND="python? ( ${PYTHON_DEPS} )" DEPEND="${RDEPEND}" @@ -67,6 +65,11 @@ MULTILIB_WRAPPED_HEADERS=( /usr/include/libnl3/netlink/cli/utils.h ) +PATCHES=( + "${FILESDIR}"/0001-Fix-compilation-error-in-GCC-14.patch + "${FILESDIR}"/${PN}-3.11.0-no-iproute2.patch +) + src_prepare() { default diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/metadata.xml b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/metadata.xml index ff40a5ef75..cb4d98b0f4 100644 --- a/sdk_container/src/third_party/portage-stable/dev-libs/libnl/metadata.xml +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libnl/metadata.xml @@ -11,5 +11,6 @@ thom311/libnl + cpe:/a:libnl_project:libnl