void-packages/srcpkgs/kernel-libc-headers/patches/1-6-musl-libc-net-compat.patch

126 lines
3.6 KiB
Diff

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 <linux/netdevice.h>
+#include <linux/libc-compat.h>
/* 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 <linux/types.h>
+#include <linux/libc-compat.h>
/*
* 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