@@ -17,6 +17,7 @@
#ifndef _UAPI_LINUX_ICMP_H
#define _UAPI_LINUX_ICMP_H
+#include <linux/libc-compat.h>
#include <linux/types.h>
#define ICMP_ECHOREPLY 0 /* Echo Reply */
@@ -64,7 +65,7 @@
#define ICMP_EXC_TTL 0 /* TTL count exceeded */
#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */
-
+#if __UAPI_DEF_ICMPHDR
struct icmphdr {
__u8 type;
__u8 code;
@@ -82,6 +83,7 @@ struct icmphdr {
__u8 reserved[4];
} un;
};
+#endif /* __UAPI_DEF_ICMPHDR */
/*
@@ -154,6 +154,13 @@
#endif /* _NETINET_IN_H */
+/* Coordinate with glibc netinet/ip_icmp.h header. */
+#if defined(__NETINET_IP_ICMP_H)
+#define __UAPI_DEF_ICMPHDR 0
+#else /* defined(__NETINET_IP_ICMP_H) */
+#define __UAPI_DEF_ICMPHDR 1
+#endif /* defined(__NETINET_IP_ICMP_H) */
+
/* Coordinate with glibc netipx/ipx.h header. */
#if defined(__NETIPX_IPX_H)
@@ -218,6 +225,9 @@
#define __UAPI_DEF_IN6_PKTINFO 1
#define __UAPI_DEF_IP6_MTUINFO 1
+/* Definitions for icmp.h */
+#define __UAPI_DEF_ICMPHDR 1
+
/* Definitions for ipx.h */
#define __UAPI_DEF_SOCKADDR_IPX 1
#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1
Fixes this userspace compile error when glibc netinet/ip_icmp.h is included before linux/icmp.h: linux/icmp.h:68:8: error: redefinition of ‘struct icmphdr’ Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi> --- include/uapi/linux/icmp.h | 4 +++- include/uapi/linux/libc-compat.h | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)