public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"libc-help@sourceware.org" <libc-help@sourceware.org>
Subject: redefinition of 'struct iphdr' - netinet/ip.h vs linux/ip.h
Date: Mon, 10 Feb 2020 22:37:00 -0000	[thread overview]
Message-ID: <06d85c1ec9537fba479f9d02e938feeb7f623662.camel@alliedtelesis.co.nz> (raw)

Hi,

I have an application that wants to include both netinet/ip.h and
linux/if_tunnel.h.

As of kernel headers versions newer than v4.8 the application fails to
compile with the following error

  make[1]: Entering directory 'compile-test'
    CC       compile-test.o
  In file included from /usr/include/linux/if_tunnel.h:7,
                   from compile-test.c:3:
  /usr/include/linux/ip.h:86:8: error: redefinition of 'struct iphdr'
   struct iphdr {
        ^~~~~
  In file included from compile-test.c:2:
  /usr/include/netinet/ip.h:44:8: note: originally defined here
   struct iphdr
          ^~~~~
  make[1]: *** [Makefile:385: compile-test.o] Error 1

Looking at the linux commit commit 1fe8e0f074c7
("include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and
linux/in6.h") I can see that the application was probably working by
luck.

Doing a bit of searching I can see various fixes with removing one of
the offending header files but this causes more problems for the
application in question.

Is there a way of making netinet/ip.h and linux/if_tunnel.h co-exist?

Thanks,
Chris Packham

                 reply	other threads:[~2020-02-10 22:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=06d85c1ec9537fba479f9d02e938feeb7f623662.camel@alliedtelesis.co.nz \
    --to=chris.packham@alliedtelesis.co.nz \
    --cc=libc-help@sourceware.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).