All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: David Lebrun <david.lebrun@uclouvain.be>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] ipv6: sr: fix user space compilation error with old glibc
Date: Mon, 15 May 2017 12:05:07 +0200	[thread overview]
Message-ID: <59197D53.8030104@iogearbox.net> (raw)
In-Reply-To: <20170515091828.19349-1-david.lebrun@uclouvain.be>

On 05/15/2017 11:18 AM, David Lebrun wrote:
> When seg6.h is included in a user space program that also includes
> netinet/in.h, it results in multiple definitions of structures such as
> struct in6_addr. Recent glibc versions have a workaround that consists in
> defining __USE_KERNEL_IPV6_DEFS to prevent duplicates. However, such a
> program will fail to compile with older glibc versions.
>
> This patch ensures that including seg6.h will work in any case.
>
> Fixes: ea3ebc73b46fbdb049dafd47543bb22efaa09c8e ("uapi: fix linux/seg6.h and linux/seg6_iptunnel.h userspace compilation errors")
> Reported-by: Daniel Borkmann <daniel@iogearbox.net>
> Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
> ---
>   include/uapi/linux/seg6.h | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/include/uapi/linux/seg6.h b/include/uapi/linux/seg6.h
> index 7278511..52b8f46 100644
> --- a/include/uapi/linux/seg6.h
> +++ b/include/uapi/linux/seg6.h
> @@ -15,7 +15,16 @@
>   #define _UAPI_LINUX_SEG6_H
>
>   #include <linux/types.h>
> +
> +#ifdef __KERNEL__
>   #include <linux/in6.h>		/* For struct in6_addr. */
> +#else
> +#ifdef __USE_KERNEL_IPV6_DEFS
> +#include <linux/in6.h>
> +#else
> +#include <netinet/in.h>
> +#endif
> +#endif
>
>   /*
>    * SRH
>

When this gets pulled into iproute2's include/linux/seg6.h due to
header rebase, we still have the same effect.

__USE_KERNEL_IPV6_DEFS gets defined by ip/iproute_lwtunnel.c, and
when we then include above header, we end up including linux/in6.h
just like before, same compile error in iproute2.

Or, is there still another fix for iproute2 coming after this has
landed?

Thanks,
Daniel

ip
     CC       iproute_lwtunnel.o
In file included from ../include/linux/seg6.h:23:0,
                  from iproute_lwtunnel.c:26:
../include/linux/in6.h:131:26: error: expected identifier before numeric constant
  #define IPPROTO_HOPOPTS  0 /* IPv6 hop-by-hop options */
                           ^
In file included from /usr/include/resolv.h:57:0,
                  from ../include/utils.h:6,
                  from iproute_lwtunnel.c:32:
/usr/include/netinet/in.h:196:8: error: redefinition of ‘struct in6_addr’
  struct in6_addr
         ^
In file included from ../include/linux/seg6.h:23:0,
                  from iproute_lwtunnel.c:26:
../include/linux/in6.h:32:8: note: originally defined here
  struct in6_addr {
         ^
In file included from /usr/include/resolv.h:57:0,
                  from ../include/utils.h:6,
                  from iproute_lwtunnel.c:32:
/usr/include/netinet/in.h:237:8: error: redefinition of ‘struct sockaddr_in6’
  struct sockaddr_in6
         ^
In file included from ../include/linux/seg6.h:23:0,
                  from iproute_lwtunnel.c:26:
../include/linux/in6.h:49:8: note: originally defined here
  struct sockaddr_in6 {
         ^
In file included from /usr/include/resolv.h:57:0,
                  from ../include/utils.h:6,
                  from iproute_lwtunnel.c:32:
/usr/include/netinet/in.h:273:8: error: redefinition of ‘struct ipv6_mreq’
  struct ipv6_mreq
         ^
In file included from ../include/linux/seg6.h:23:0,
                  from iproute_lwtunnel.c:26:
../include/linux/in6.h:59:8: note: originally defined here
  struct ipv6_mreq {
         ^
iproute_lwtunnel.c: In function ‘parse_encap_seg6’:
iproute_lwtunnel.c:375:3: warning: passing argument 3 of ‘inet_get_addr’ from incompatible pointer type [enabled by default]
    inet_get_addr(s, NULL, &srh->segments[i]);
    ^
In file included from iproute_lwtunnel.c:32:0:
../include/utils.h:241:5: note: expected ‘struct in6_addr *’ but argument is of type ‘struct in6_addr *’
  int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6);
      ^
make[1]: *** [iproute_lwtunnel.o] Error 1
make: *** [all] Error 2

  reply	other threads:[~2017-05-15 10:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15  9:18 [PATCH net] ipv6: sr: fix user space compilation error with old glibc David Lebrun
2017-05-15 10:05 ` Daniel Borkmann [this message]
2017-05-15 10:37   ` David Lebrun
2017-05-15 10:43     ` Daniel Borkmann
2017-05-15 10:53       ` David Lebrun
2017-05-15 11:01         ` David Lebrun

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=59197D53.8030104@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=david.lebrun@uclouvain.be \
    --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 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.