Thread (1 message) 1 message, 1 author, 2016-08-23
STALE3581d

Revision v05 of 4 in this series.

Revisions (4)
  1. v03 [diff vs current]
  2. v4 [diff vs current]
  3. v05 [diff vs current]
  4. v05 current

[PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header file compatibility fixes

From: Mikko Rapeli <hidden>
Date: 2016-08-23 20:55:49
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

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 <redacted>
---
 include/uapi/linux/icmp.h        |  4 +++-
 include/uapi/linux/libc-compat.h | 10 ++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/icmp.h b/include/uapi/linux/icmp.h
index fddd9d7..cd38005 100644
--- a/include/uapi/linux/icmp.h
+++ b/include/uapi/linux/icmp.h
@@ -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 */
 
 
 /*
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 40190a4..8a5a7cc 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -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
-- 
2.8.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help