All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] net-tools: add a patch to avoid struct redefinition
Date: Thu, 3 Nov 2016 13:25:46 +0000	[thread overview]
Message-ID: <20161103132546.52679-1-Vincent.Riera@imgtec.com> (raw)

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/

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 ...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

diff --git a/package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch b/package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch
new file mode 100644
index 0000000..002c9da
--- /dev/null
+++ b/package/net-tools/0002-iptunnel.c-do-not-include-netinet-ip.h.patch
@@ -0,0 +1,54 @@
+From 7a9a369d9de784791a2ab384877aab5ff3801d4e Mon Sep 17 00:00:00 2001
+From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+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 <Vincent.Riera@imgtec.com>
+---
+ 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
+
-- 
2.10.1

             reply	other threads:[~2016-11-03 13:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 13:25 Vicente Olivert Riera [this message]
2016-11-03 21:30 ` [Buildroot] [PATCH] net-tools: add a patch to avoid struct redefinition Thomas Petazzoni
2016-11-06 10:55 ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161103132546.52679-1-Vincent.Riera@imgtec.com \
    --to=vincent.riera@imgtec.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.