From 04c1d688de7d9f886d89aa32294b9e6e75658606 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Mon, 25 Mar 2024 18:25:31 -0600 Subject: [PATCH] strongswan: backport upstream MUSL fix for pf_handler.c Signed-off-by: Philip Prindeville --- ...andler-Fix-build-with-musl-C-library.patch | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 net/strongswan/patches/0001-pf-handler-Fix-build-with-musl-C-library.patch diff --git a/net/strongswan/patches/0001-pf-handler-Fix-build-with-musl-C-library.patch b/net/strongswan/patches/0001-pf-handler-Fix-build-with-musl-C-library.patch new file mode 100644 index 0000000000..f8de285b23 --- /dev/null +++ b/net/strongswan/patches/0001-pf-handler-Fix-build-with-musl-C-library.patch @@ -0,0 +1,58 @@ +commit f5b1ca4ef60bc4fca91f0d1e852ef8447d23c99a +Author: Tobias Brunner +Date: Fri Mar 22 09:57:07 2024 +0100 + + pf-handler: Fix build with musl C library + + musl's headers define a lot of networking structs. For some, the + definition in the Linux UAPI headers is then suppressed by e.g. + __UAPI_DEF_ETHHDR. + + Since we included musl's net/ethernet.h, which includes netinet/if_ether.h + that defines `struct ethhdr` (and the above constant), **after** we + include linux/if_ether.h, there was a compilation error because the + struct was defined multiple times. + + However, simply moving that include doesn't fix the problem because for + ARP-specific structs the Linux headers don't provide __UAPI_DEF* checks. + So instead of directly including the linux/ headers, we include those + provided by the C library. For glibc these usually just include the + Linux headers, but for musl this allows them to define the struct + directly. We also need to move if.h and add packet.h, which define + other structs (or include headers that do so) that we use. + + Fixes: 187c72d1afdc ("dhcp: Port the plugin to FreeBSD/macOS") + +--- a/src/libcharon/network/pf_handler.c ++++ b/src/libcharon/network/pf_handler.c +@@ -20,23 +20,23 @@ + + #include + #include ++#include ++#include ++#include ++#include + + #if !defined(__APPLE__) && !defined(__FreeBSD__) +-#include +-#include ++#include ++#include ++#include + #include + #else + #include + #include + #include +-#include + #include + #endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */ + +-#include +-#include +-#include +- + #if !defined(__APPLE__) && !defined(__FreeBSD__) + + /**