[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1471890809-4383-73-git-send-email-mikko.rapeli@iki.fi>
Date: Mon, 22 Aug 2016 20:33:29 +0200
From: Mikko Rapeli <mikko.rapeli@....fi>
To: linux-kernel@...r.kernel.org
Cc: Mikko Rapeli <mikko.rapeli@....fi>,
"David S. Miller" <davem@...emloft.net>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>
Subject: [PATCH v05 72/72] uapi route.h: glibc net/route.h compat fix
Fixes this userspace compile error when net/route.h is included before
linux/route.h:
linux/route.h:30:8: error: redefinition of ‘struct rtentry’
Signed-off-by: Mikko Rapeli <mikko.rapeli@....fi>
---
include/uapi/linux/libc-compat.h | 10 ++++++++++
include/uapi/linux/route.h | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 07a3462..16ba7dc 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -230,6 +230,13 @@
#endif /* defined(_NETROSE_ROSE_H) */
+/* Coordinate with glibc net/route.h */
+#if defined(_NET_ROUTE_H)
+#define __UAPI_DEF_RTENTRY 0
+#else /* defined(_NET_ROUTE_H) */
+#define __UAPI_DEF_RTENTRY 1
+#endif /* defined(_NET_ROUTE_H) */
+
/* Coordinate with glibc pty.h */
#if defined(_PTY_H)
#define __UAPI_DEF_TERMIOS 0
@@ -369,6 +376,9 @@
#define __UAPI_DEF_ROSE_CAUSE_STRUCT 1
#define __UAPI_DEF_ROSE_FACILITIES_STRUCT 1
+/* Definitions for route.h */
+#define __UAPI_DEF_RTENTRY 1
+
/* Definitions for time.h */
#define __UAPI_DEF_TIMESPEC 1
#define __UAPI_DEF_TIMEVAL 1
diff --git a/include/uapi/linux/route.h b/include/uapi/linux/route.h
index 6600708..7b77ef2 100644
--- a/include/uapi/linux/route.h
+++ b/include/uapi/linux/route.h
@@ -23,10 +23,12 @@
#ifndef _LINUX_ROUTE_H
#define _LINUX_ROUTE_H
+#include <linux/libc-compat.h>
#include <linux/if.h>
#include <linux/compiler.h>
/* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */
+#if __UAPI_DEF_RTENTRY
struct rtentry {
unsigned long rt_pad1;
struct sockaddr rt_dst; /* target address */
@@ -45,7 +47,7 @@ struct rtentry {
unsigned long rt_window; /* Window clamping */
unsigned short rt_irtt; /* Initial RTT */
};
-
+#endif /* __UAPI_DEF_RTENTRY */
#define RTF_UP 0x0001 /* route usable */
#define RTF_GATEWAY 0x0002 /* destination is a gateway */
--
2.8.1
Powered by blists - more mailing lists