History

mptcp: fix conflict with <netinet/in.h>

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.

Ossama Othman committed 4 years ago

Commit 06e445f1 parent 42fb6cd1 file · +5 −4Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/linux/mptcp.h+5−4
@@ -2,16 +2,17 @@ · 1 unmodified line
22 #ifndef _UAPI_MPTCP_H
33 #define _UAPI_MPTCP_H
44
5+#ifndef __KERNEL__
6+#include <netinet/in.h> /* for sockaddr_in and sockaddr_in6 */
7+#include <sys/socket.h> /* for struct sockaddr */
8+#endif
9+
510 #include <linux/const.h>
611 #include <linux/types.h>
712 #include <linux/in.h> /* for sockaddr_in */
813 #include <linux/in6.h> /* for sockaddr_in6 */
914 #include <linux/socket.h> /* for sockaddr_storage and sa_family */
1015
11−#ifndef __KERNEL__
12−#include <sys/socket.h> /* for struct sockaddr */
13−#endif
14−
1516 #define MPTCP_SUBFLOW_FLAG_MCAP_REM _BITUL(0)
1617 #define MPTCP_SUBFLOW_FLAG_MCAP_LOC _BITUL(1)
1718 #define MPTCP_SUBFLOW_FLAG_JOIN_REM _BITUL(2)