-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 540881627fe8083207f9a2cfd01b931164c7ef4e Mon Sep 17 00:00:00 2001 | ||
From: Tobias Brunner <tobias@strongswan.org> | ||
Date: Fri, 22 Mar 2024 10:42:34 +0100 | ||
Subject: [PATCH] farp: Fix build with musl C library | ||
|
||
Same issue as described in the previous commit. | ||
|
||
Fixes: 187c72d1afdc ("dhcp: Port the plugin to FreeBSD/macOS") | ||
--- | ||
src/libcharon/plugins/farp/farp_spoofer.c | 7 ++++--- | ||
1 file changed, 4 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/src/libcharon/plugins/farp/farp_spoofer.c b/src/libcharon/plugins/farp/farp_spoofer.c | ||
index 65451263f5f..7f2c9bef419 100644 | ||
--- a/src/libcharon/plugins/farp/farp_spoofer.c | ||
+++ b/src/libcharon/plugins/farp/farp_spoofer.c | ||
@@ -20,12 +20,14 @@ | ||
|
||
#include <errno.h> | ||
#include <unistd.h> | ||
+#include <net/ethernet.h> | ||
#include <sys/ioctl.h> | ||
|
||
#if !defined(__APPLE__) && !defined(__FreeBSD__) | ||
#include <sys/socket.h> | ||
-#include <linux/if_arp.h> | ||
-#include <linux/if_ether.h> | ||
+#include <net/if_arp.h> | ||
+#include <netinet/if_ether.h> | ||
+#include <netpacket/packet.h> | ||
#include <linux/filter.h> | ||
#else | ||
#include <net/bpf.h> | ||
@@ -33,7 +35,6 @@ | ||
#include <net/if_dl.h> | ||
#endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */ | ||
|
||
-#include <net/ethernet.h> | ||
#include <daemon.h> | ||
#include <threading/thread.h> | ||
#include <processing/jobs/callback_job.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
From f5b1ca4ef60bc4fca91f0d1e852ef8447d23c99a Mon Sep 17 00:00:00 2001 | ||
From: Tobias Brunner <tobias@strongswan.org> | ||
Date: Fri, 22 Mar 2024 09:57:07 +0100 | ||
Subject: [PATCH] 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") | ||
--- | ||
src/libcharon/network/pf_handler.c | 14 +++++++------- | ||
1 file changed, 7 insertions(+), 7 deletions(-) | ||
|
||
diff --git a/src/libcharon/network/pf_handler.c b/src/libcharon/network/pf_handler.c | ||
index 91b0e7507f9..43ef432ba60 100644 | ||
--- a/src/libcharon/network/pf_handler.c | ||
+++ b/src/libcharon/network/pf_handler.c | ||
@@ -20,23 +20,23 @@ | ||
|
||
#include <library.h> | ||
#include <unistd.h> | ||
+#include <errno.h> | ||
+#include <net/ethernet.h> | ||
+#include <net/if.h> | ||
+#include <sys/ioctl.h> | ||
|
||
#if !defined(__APPLE__) && !defined(__FreeBSD__) | ||
-#include <linux/if_arp.h> | ||
-#include <linux/if_ether.h> | ||
+#include <net/if_arp.h> | ||
+#include <netinet/if_ether.h> | ||
+#include <netpacket/packet.h> | ||
#include <linux/filter.h> | ||
#else | ||
#include <fcntl.h> | ||
#include <ifaddrs.h> | ||
#include <net/bpf.h> | ||
-#include <net/if.h> | ||
#include <net/if_dl.h> | ||
#endif /* !defined(__APPLE__) && !defined(__FreeBSD__) */ | ||
|
||
-#include <errno.h> | ||
-#include <net/ethernet.h> | ||
-#include <sys/ioctl.h> | ||
- | ||
#if !defined(__APPLE__) && !defined(__FreeBSD__) | ||
|
||
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters