[PATCH master 3/3] sandbox: os: tap: make it compile with musl
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Mar 25 05:47:40 PDT 2025
musl not ship a definition of IFF_TAP. As this is ABI set in stone,
let's just duplicate the constant we need and use them as fallback, when
<linux/if_tun.h> is missing.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
arch/sandbox/os/tap.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/sandbox/os/tap.c b/arch/sandbox/os/tap.c
index 83b97ffd49c7..fbb20f2fa80f 100644
--- a/arch/sandbox/os/tap.c
+++ b/arch/sandbox/os/tap.c
@@ -21,10 +21,20 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <linux/if.h>
-#include <linux/if_tun.h>
+#include <net/if.h>
#include <string.h>
+#ifdef __has_include
+# if !__has_include(<linux/if_tun.h>)
+# define IFF_TAP 0x0002
+# define IFF_NO_PI 0x1000
+# define TUNSETIFF _IOW('T', 202, int)
+# endif
+#endif
+#ifndef IFF_TAP
+# include <linux/if_tun.h>
+#endif
+
int tap_alloc(const char *dev)
{
struct ifreq ifr;
--
2.39.5
More information about the barebox
mailing list