[PATCH] uapi/if_arp.h: guard struct definition to not redefine libc's definitions
Export this patch
musl libc defines the structs arpreq, arpreq_old and arphdr in
Could you add some reference to when the structs were added to musl?
Web link, or a version number, perhaps?
their <net/if_arp.h> header. Guard against a redefinition via
__UAPI_DEF_IF_ARP_ARPREQ for arpreq + arpreq_old and
__UAPI_DEF_IF_ARP_ARPHDR for arphdr.
A follow-up patch for musl is needed for this after this gets picked.
Redefinitions of all the various flags is fine, as this will only
produce warnings with a lenient compiler.
Signed-off-by: Jane Rachinger <jane400@postmarketos.org>
---
include/uapi/linux/if_arp.h | 8 ++++++++
include/uapi/linux/libc-compat.h | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
index 4783af9fe520..9f2dcc16c013 100644
--- a/include/uapi/linux/if_arp.h
+++ b/include/uapi/linux/if_arp.h
@@ -24,6 +24,7 @@
#ifndef _UAPI_LINUX_IF_ARP_H
#define _UAPI_LINUX_IF_ARP_H
+ #include <linux/libc-compat.h>
#include <linux/netdevice.h>
/* ARP protocol HARDWARE identifiers. */
@@ -113,6 +114,8 @@
#define ARPOP_NAK 10 /* (ATM)ARP NAK */
+ #if __UAPI_DEF_IF_ARP_ARPREQ
+
/* ARP ioctl request. */
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
@@ -129,6 +132,8 @@ struct arpreq_old {
struct sockaddr arp_netmask; /* netmask (only for proxy arps) */
};
+ #endif
+
/* ARP Flag values. */
#define ATF_COM 0x02 /* completed entry (ha valid) */
#define ATF_PERM 0x04 /* permanent entry */
@@ -142,6 +147,8 @@ struct arpreq_old {
* This structure defines an ethernet arp header.
*/
+ #if __UAPI_DEF_IF_ARP_ARPHDR
+
struct arphdr {
__be16 ar_hrd; /* format of hardware address */
__be16 ar_pro; /* format of protocol address */
@@ -161,5 +168,6 @@ struct arphdr {
};
+ #endif
#endif /* _UAPI_LINUX_IF_ARP_H */
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 8254c937c9f4..e722c213f18b 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -194,6 +194,14 @@
#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
#endif
+ /* Definitions for if_arp.h */
+ #ifndef __UAPI_DEF_IF_ARP_ARPREQ
+ #define __UAPI_DEF_IF_ARP_ARPREQ 1
+ #endif
+ #ifndef __UAPI_DEF_IF_ARP_ARPHDR
+ #define __UAPI_DEF_IF_ARP_ARPHDR 1
+ #endif
+
/* Definitions for in.h */
#ifndef __UAPI_DEF_IN_ADDR
#define __UAPI_DEF_IN_ADDR 1
base-commit: 89f5e14d05b4852db5ecdf222dc6a13edc633658
The code change looks almost good, I think you're missing the code for
handling getting included after the user space, tho? look around how
existing definitions are handled..
--
2.46.0
On Mon, 9 Sep 2024 11:28:55 +0200 jane400 wrote:
Could you please update the From fields in the email / the author of
the patch to have your full name like the sign off? Right now it says:
From: jane400 <jane400@postmarketos.org>