All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next] mptcp: fix conflict with <netinet/in.h>
@ 2022-05-19 15:39 Ossama Othman
  2022-05-19 17:17 ` mptcp: fix conflict with <netinet/in.h>: Tests Results MPTCP CI
  2022-05-20  0:05 ` [PATCH mptcp-next] mptcp: fix conflict with <netinet/in.h> Mat Martineau
  0 siblings, 2 replies; 6+ messages in thread
From: Ossama Othman @ 2022-05-19 15:39 UTC (permalink / raw)
  To: mptcp; +Cc: Ossama Othman

Including <linux/mptcp.h> before the C library <netinet/in.h> header
causes symbol redefinition errors at compile-time due to duplicate
declarations and definitions in the <linux/in.h> header included by
<linux/mptcp.h>.

Explicitly include <netinet/in.h> before <linux/in.h> in
<linux/mptcp.h> when __KERNEL__ is not defined so that the C library
compatibility logic in <linux/libc-compat.h> is enabled when including
<linux/mptcp.h> in user space code.

Signed-off-by: Ossama Othman <ossama.othman@intel.com>
---
 include/uapi/linux/mptcp.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h
index 921963589904..dfe19bf13f4c 100644
--- a/include/uapi/linux/mptcp.h
+++ b/include/uapi/linux/mptcp.h
@@ -2,16 +2,17 @@
 #ifndef _UAPI_MPTCP_H
 #define _UAPI_MPTCP_H
 
+#ifndef __KERNEL__
+#include <netinet/in.h>		/* for sockaddr_in and sockaddr_in6	*/
+#include <sys/socket.h>		/* for struct sockaddr			*/
+#endif
+
 #include <linux/const.h>
 #include <linux/types.h>
 #include <linux/in.h>		/* for sockaddr_in			*/
 #include <linux/in6.h>		/* for sockaddr_in6			*/
 #include <linux/socket.h>	/* for sockaddr_storage and sa_family	*/
 
-#ifndef __KERNEL__
-#include <sys/socket.h>		/* for struct sockaddr			*/
-#endif
-
 #define MPTCP_SUBFLOW_FLAG_MCAP_REM		_BITUL(0)
 #define MPTCP_SUBFLOW_FLAG_MCAP_LOC		_BITUL(1)
 #define MPTCP_SUBFLOW_FLAG_JOIN_REM		_BITUL(2)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-21  7:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-19 15:39 [PATCH mptcp-next] mptcp: fix conflict with <netinet/in.h> Ossama Othman
2022-05-19 17:17 ` mptcp: fix conflict with <netinet/in.h>: Tests Results MPTCP CI
2022-05-20  0:05 ` [PATCH mptcp-next] mptcp: fix conflict with <netinet/in.h> Mat Martineau
2022-05-20 15:20   ` Matthieu Baerts
2022-05-21  0:18     ` Mat Martineau
2022-05-21  7:27       ` Matthieu Baerts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.