From 6e725564a764f61fe635ea3c764126c7215b441f Mon Sep 17 00:00:00 2001 From: John Date: Mon, 14 May 2018 23:53:03 +0200 Subject: [PATCH] kernel-libc-headers: fix musl net headers conflicts --- .../patches/1-6-musl-libc-net-compat.patch | 125 ++++++++++++++++++ srcpkgs/kernel-libc-headers/template | 2 +- 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/kernel-libc-headers/patches/1-6-musl-libc-net-compat.patch diff --git a/srcpkgs/kernel-libc-headers/patches/1-6-musl-libc-net-compat.patch b/srcpkgs/kernel-libc-headers/patches/1-6-musl-libc-net-compat.patch new file mode 100644 index 00000000000..9ac04dc9f18 --- /dev/null +++ b/srcpkgs/kernel-libc-headers/patches/1-6-musl-libc-net-compat.patch @@ -0,0 +1,125 @@ +diff -u -r linux-4.9.8-bak/include/uapi/linux/if_arp.h linux-4.9.8/include/uapi/linux/if_arp.h +--- include/uapi/linux/if_arp.h 2018-05-14 23:49:28.882768986 +0200 ++++ include/uapi/linux/if_arp.h 2018-05-14 23:50:03.156912981 +0200 +@@ -24,6 +24,7 @@ + #define _UAPI_LINUX_IF_ARP_H + + #include ++#include + + /* ARP protocol HARDWARE identifiers. */ + #define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ +@@ -108,7 +109,7 @@ + #define ARPOP_InREPLY 9 /* InARP reply */ + #define ARPOP_NAK 10 /* (ATM)ARP NAK */ + +- ++#if __UAPI_DEF_ARPREQ + /* ARP ioctl request. */ + struct arpreq { + struct sockaddr arp_pa; /* protocol address */ +@@ -117,13 +118,15 @@ + struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ + char arp_dev[16]; + }; +- ++#endif ++#if __UAPI_DEF_ARPREQ_OLD + struct arpreq_old { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ + struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ + }; ++#endif + + /* ARP Flag values. */ + #define ATF_COM 0x02 /* completed entry (ha valid) */ +@@ -133,7 +136,7 @@ + #define ATF_NETMASK 0x20 /* want to use a netmask (only + for proxy entries) */ + #define ATF_DONTPUB 0x40 /* don't answer this addresses */ +- ++#if __UAPI_DEF_ARPHDR + /* + * This structure defines an ethernet arp header. + */ +@@ -156,6 +159,6 @@ + #endif + + }; +- ++#endif + + #endif /* _UAPI_LINUX_IF_ARP_H */ +diff -u -r linux-4.9.8-bak/include/uapi/linux/if_ether.h linux-4.9.8/include/uapi/linux/if_ether.h +--- include/uapi/linux/if_ether.h 2018-05-14 23:49:28.882768986 +0200 ++++ include/uapi/linux/if_ether.h 2018-05-14 23:50:03.155912977 +0200 +@@ -22,6 +22,7 @@ + #define _UAPI_LINUX_IF_ETHER_H + + #include ++#include + + /* + * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble +@@ -137,12 +138,12 @@ + /* + * This is an Ethernet frame header. + */ +- ++#if __UAPI_DEF_ETHHDR + struct ethhdr { + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ + unsigned char h_source[ETH_ALEN]; /* source ether addr */ + __be16 h_proto; /* packet type ID field */ + } __attribute__((packed)); +- ++#endif + + #endif /* _UAPI_LINUX_IF_ETHER_H */ +diff -u -r linux-4.9.8-bak/include/uapi/linux/libc-compat.h linux-4.9.8/include/uapi/linux/libc-compat.h +--- include/uapi/linux/libc-compat.h 2018-05-14 23:49:28.885768999 +0200 ++++ include/uapi/linux/libc-compat.h 2018-05-14 23:50:03.156912981 +0200 +@@ -51,6 +51,11 @@ + /* We have included glibc headers... */ + #if defined(__GLIBC__) + ++#define __UAPI_DEF_ETHHDR 1 ++#define __UAPI_DEF_ARPREQ 1 ++#define __UAPI_DEF_ARPREQ_OLD 1 ++#define __UAPI_DEF_ARPHDR 1 ++ + /* Coordinate with glibc net/if.h header. */ + #if defined(_NET_IF_H) && defined(__USE_MISC) + +@@ -73,7 +78,6 @@ + /* Linux headers included first, and we must define everything + * we need. The expectation is that glibc will check the + * __UAPI_DEF_* defines and adjust appropriately. */ +- + #define __UAPI_DEF_IF_IFCONF 1 + #define __UAPI_DEF_IF_IFMAP 1 + #define __UAPI_DEF_IF_IFNAMSIZ 1 +@@ -256,6 +260,21 @@ + #define __UAPI_DEF_XATTR 1 + #endif + ++#ifdef _NETINET_IF_ETHER_H /* musl */ ++#define __UAPI_DEF_ETHHDR 0 ++#else ++#define __UAPI_DEF_ETHHDR 1 ++#endif ++ ++#ifdef _NET_IF_ARP_H ++#define __UAPI_DEF_ARPREQ 0 ++#define __UAPI_DEF_ARPREQ_OLD 0 ++#define __UAPI_DEF_ARPHDR 0 ++#else ++#define __UAPI_DEF_ARPREQ 1 ++#define __UAPI_DEF_ARPREQ_OLD 1 ++#define __UAPI_DEF_ARPHDR 1 ++#endif + + /* If we did not see any headers from any supported C libraries, + * or we are being included in the kernel, then define everything diff --git a/srcpkgs/kernel-libc-headers/template b/srcpkgs/kernel-libc-headers/template index 8217a33112d..74fbf393651 100644 --- a/srcpkgs/kernel-libc-headers/template +++ b/srcpkgs/kernel-libc-headers/template @@ -1,7 +1,7 @@ # Template file for 'kernel-libc-headers' pkgname=kernel-libc-headers version=4.9.8 -revision=3 +revision=4 bootstrap=yes nostrip=yes noverifyrdeps=yes