[PATCH] Avoid in6_addr redefinition

Subsystems: ethernet bridge, netfilter, networking drivers, the rest

STALE3503d

2 messages, 2 authors, 2017-01-19 · open the first message on its own page

[PATCH] Avoid in6_addr redefinition

From: Zheng Ruoqin <hidden>
Date: 2017-01-19 02:30:10

Due to both <netinet/in.h> and <linux/in6.h> being included, the 
in6_addr is being redefined: once from the C library headers and once
from the kernel headers. This causes some build failures with for 
example the musl C library.

In order to fix this, use just the C library header <netinet/in.h>.
Original patch taken from
http://git.alpinelinux.org/cgit/aports/tree/main/iproute2/musl-fixes.patch.

(Refreshed the patch for 4.9 release)

Upstream-Status: Pending

Signed-off-by: Thomas Petazzoni <redacted>
Signed-off-by: Maxin B. John <redacted>
Signed-off-by: Zheng Ruoqin <redacted>
---
 include/libiptc/ipt_kernel_headers.h     | 1 -
 include/linux/if_bridge.h                | 1 -
 include/linux/if_tunnel.h                | 2 --
 include/linux/netfilter.h                | 2 --
 include/linux/netfilter_ipv4/ip_tables.h | 1 -
 include/linux/xfrm.h                     | 1 -
 include/utils.h                          | 1 +
 ip/ip6tunnel.c                           | 1 -
 8 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/include/libiptc/ipt_kernel_headers.h b/include/libiptc/ipt_kernel_headers.h
index a5963e9..42f8610 100644
--- a/include/libiptc/ipt_kernel_headers.h
+++ b/include/libiptc/ipt_kernel_headers.h
@@ -6,7 +6,6 @@
 #include <limits.h>
 
 #include <netinet/ip.h>
-#include <netinet/in.h>
 #include <netinet/ip_icmp.h>
 #include <netinet/tcp.h>
 #include <netinet/udp.h>
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index b7393dd..a7028ab 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -15,7 +15,6 @@
 
 #include <linux/types.h>
 #include <linux/if_ether.h>
-#include <linux/in6.h>
 
 #define SYSFS_BRIDGE_ATTR	"bridge"
 #define SYSFS_BRIDGE_FDB	"brforward"
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 4f975f5..2680646 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,9 +2,7 @@
 #define _IF_TUNNEL_H_
 
 #include <linux/types.h>
-#include <linux/if.h>
 #include <linux/ip.h>
-#include <linux/in6.h>
 #include <asm/byteorder.h>
 
 
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index b71b4c9..3e4e6ae 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -4,8 +4,6 @@
 #include <linux/types.h>
 
 #include <linux/sysctl.h>
-#include <linux/in.h>
-#include <linux/in6.h>
 
 /* Responses from hook functions. */
 #define NF_DROP 0
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 456fb86..38542b4 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -17,7 +17,6 @@
 
 #include <linux/types.h>
 
-#include <linux/if.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <linux/netfilter/x_tables.h>
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index d2dd1fd..8c72966 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -1,7 +1,6 @@
 #ifndef _LINUX_XFRM_H
 #define _LINUX_XFRM_H
 
-#include <linux/in6.h>
 #include <linux/types.h>
 
 /* All of the structures in this file may not change size as they are
diff --git a/include/utils.h b/include/utils.h
index 1b4f939..d10840b 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -1,6 +1,7 @@
 #ifndef __UTILS_H__
 #define __UTILS_H__ 1
 
+#include <sys/param.h>  /* MAXPATHLEN */
 #include <sys/types.h>
 #include <asm/types.h>
 #include <resolv.h>
diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c
index b1c0ae6..8fa4eb2 100644
--- a/ip/ip6tunnel.c
+++ b/ip/ip6tunnel.c
@@ -28,7 +28,6 @@
 #include <arpa/inet.h>
 #include <sys/ioctl.h>
 #include <linux/ip.h>
-#include <linux/if.h>
 #include <linux/if_arp.h>
 #include <linux/if_tunnel.h>
 #include <linux/ip6_tunnel.h>
-- 
2.7.4

Re: [PATCH] Avoid in6_addr redefinition

From: David Miller <davem@davemloft.net>
Date: 2017-01-19 02:40:14

From: Zheng Ruoqin <redacted>
Date: Thu, 19 Jan 2017 10:25:16 +0800
Due to both <netinet/in.h> and <linux/in6.h> being included, the 
in6_addr is being redefined: once from the C library headers and once
from the kernel headers. This causes some build failures with for 
example the musl C library.

In order to fix this, use just the C library header <netinet/in.h>.
Original patch taken from
http://git.alpinelinux.org/cgit/aports/tree/main/iproute2/musl-fixes.patch.

(Refreshed the patch for 4.9 release)

Upstream-Status: Pending

Signed-off-by: Thomas Petazzoni <redacted>
Signed-off-by: Maxin B. John <redacted>
Signed-off-by: Zheng Ruoqin <redacted>
We have multiple definition avoidance using CPP tests, which works in
concert with GLIBC headers, that is supposed to avoid this properly.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help