Skip to contentSkip to conversation

net-tools: add a patch to avoid struct redefinition

PATCH New Vicente Olivert Riera 2 participants 3 messages Nov 3, 2016 – Nov 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net-tools: add a patch to avoid struct redefinition

This fixes a struct redefinition problem like this one:

================================
In file included from /usr/include/linux/if_tunnel.h:6:0, from iptunnel.c:34:
/usr/include/linux/ip.h:85:8: error: redefinition of 'struct iphdr' struct iphdr {
^
In file included from iptunnel.c:29:0:
/usr/include/netinet/ip.h:45:8: note: originally defined here struct iphdr
^
================================

iptunnel.c includes netinet/ip.h which contains a definition of the iphdr struct.

iptunnel.c also includes linux/if_tunnel.h which includes linux/ip.h which contains a definition of the iphdr struct.

So, both netinet/ip.h and linux/ip.h define the iphdr struct, and both of them have been included directly or indirectly by iptunnel.c. Because of that the compilation fails due to a struct redefinition.

The problem can be solved by just not including netinet/ip.h.

The patch has been sent upstream as a merge request:
https://sourceforge.net/p/net-tools/code/merge-requests/3/

Fixes:
http://autobuild.buildroot.net/results/dce/dce499da84b2a41bab946d5109a283ccb85c8b81/

---
 ...02-iptunnel.c-do-not-include-netinet-ip.h.patch | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch
package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch new file +54 -0
new file mode 100644
index 0000000..002c9da
@@ -0,0 +1,54 @@
+From 7a9a369d9de784791a2ab384877aab5ff3801d4e Mon Sep 17 00:00:00 2001
+From: Vicente Olivert Riera <[email protected]>
+Date: Thu, 3 Nov 2016 12:59:39 +0000
+Subject: [PATCH] iptunnel.c: do not include netinet/ip.h
+
+This fixes a struct redefinition problem like this one:
+
+================================
+In file included from /usr/include/linux/if_tunnel.h:6:0,
+                 from iptunnel.c:34:
+/usr/include/linux/ip.h:85:8: error: redefinition of 'struct iphdr'
+ struct iphdr {
+        ^
+In file included from iptunnel.c:29:0:
+/usr/include/netinet/ip.h:45:8: note: originally defined here
+ struct iphdr
+        ^
+================================
+
+iptunnel.c includes netinet/ip.h which contains a definition of the
+iphdr struct.
+
+iptunnel.c also includes linux/if_tunnel.h which includes linux/ip.h
+which contains a definition of the iphdr struct.
+
+So, both netinet/ip.h and linux/ip.h define the iphdr struct, and both
+of them have been included directly or indirectly by iptunnel.c. Because
+of that the compilation fails due to a struct redefinition.
+
+The problem can be solved by just not including netinet/ip.h.
+
+Upstream status: merge request sent
+https://sourceforge.net/p/net-tools/code/merge-requests/3/
+
+Signed-off-by: Vicente Olivert Riera <[email protected]>
+---
+ iptunnel.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/iptunnel.c b/iptunnel.c
+index 3fe1b84..247ae10 100644
+--- a/iptunnel.c
++++ b/iptunnel.c
+@@ -26,7 +26,6 @@
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <netinet/in.h>
+-#include <netinet/ip.h>
+ #include <arpa/inet.h>
+ #include <net/if.h>
+ #include <net/if_arp.h>
+-- 
+2.10.1
+
Signature · 1 line
2.10.1
#1 lore raw

PATCH 1/1 net-tools: add a patch to avoid struct redefinition

Hello,

Quoted 29 lines · Vicente Olivert Riera

This fixes a struct redefinition problem like this one:

================================
In file included from /usr/include/linux/if_tunnel.h:6:0, from iptunnel.c:34:
/usr/include/linux/ip.h:85:8: error: redefinition of 'struct iphdr' struct iphdr {
^
In file included from iptunnel.c:29:0:
/usr/include/netinet/ip.h:45:8: note: originally defined here struct iphdr
^
================================

iptunnel.c includes netinet/ip.h which contains a definition of the iphdr struct.

iptunnel.c also includes linux/if_tunnel.h which includes linux/ip.h which contains a definition of the iphdr struct.

So, both netinet/ip.h and linux/ip.h define the iphdr struct, and both of them have been included directly or indirectly by iptunnel.c. Because of that the compilation fails due to a struct redefinition.

The problem can be solved by just not including netinet/ip.h.

The patch has been sent upstream as a merge request:
https://sourceforge.net/p/net-tools/code/merge-requests/3/

Quoted 8 lines

Fixes:
http://autobuild.buildroot.net/results/dce/dce499da84b2a41bab946d5109a283ccb85c8b81/

---
 ...02-iptunnel.c-do-not-include-netinet-ip.h.patch | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 net-tools: add a patch to avoid struct redefinition

In reply to Vicente Olivert Riera

Hello,

Quoted 26 lines · Vicente Olivert Riera

This fixes a struct redefinition problem like this one:

================================
In file included from /usr/include/linux/if_tunnel.h:6:0, from iptunnel.c:34:
/usr/include/linux/ip.h:85:8: error: redefinition of 'struct iphdr' struct iphdr {
^
In file included from iptunnel.c:29:0:
/usr/include/netinet/ip.h:45:8: note: originally defined here struct iphdr
^
================================

iptunnel.c includes netinet/ip.h which contains a definition of the iphdr struct.

iptunnel.c also includes linux/if_tunnel.h which includes linux/ip.h which contains a definition of the iphdr struct.

So, both netinet/ip.h and linux/ip.h define the iphdr struct, and both of them have been included directly or indirectly by iptunnel.c. Because of that the compilation fails due to a struct redefinition.

The problem can be solved by just not including netinet/ip.h.

Quoted 7 lines

The patch has been sent upstream as a merge request:
https://sourceforge.net/p/net-tools/code/merge-requests/3/

Fixes:
http://autobuild.buildroot.net/results/dce/dce499da84b2a41bab946d5109a283ccb85c8b81/

This patch causes more build failures than it fixes. Care to have a look at:

     sparc64 | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/a1b2ff0385701fba85edfacf663896d8dbc8de09
    mips64el | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/3746f6438bc6df349b709fe0ea6e6bbe72e40c96
         arm | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/ce7bc29a60dadefa9a1e76588b6cd117b9b438d3
        i686 | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/b0ae167ed73731a500b3a689369ecee569280f3d
         arm | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/72cc7172fad6f886aef307b353775689784feca3
         arm | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/3ee0f8d998507086dc94cc06b66dc7aaea51199a
    mips64el | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/e7b07b8f84431664ab1c327b42d4ec508f377bd9
        bfin | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/df8500280736379c054585cf62980fb4dfeb66d2
        i686 | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/6c1efbfb8bdc6b68b4e2ac3cc58d736125ae0dbb
        i686 | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/404690a4f8b42f773c50eea834181bae0185c550
     sparc64 | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/d2e66e873fc242f87882f944abdc31a0e5243488
         arm | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/5a8d3f0e540e6123c30b4dac8832a74808e4c1e7
    mips64el | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/d8803422d86908b24731fff613a05ea0d40f9269
         arm | net-tools-3f170bff115303e92... | NOK | http://autobuild.buildroot.net/results/8e9fb71362f81fec605328bc32c4ded1376de5d4

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com