netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: 2.6.28 headers break kbd and net-tools userspace builds
       [not found]   ` <4978C301.1040705@walrond.org>
@ 2009-01-22 19:12     ` Sam Ravnborg
  2009-01-27  5:08       ` David Miller
  0 siblings, 1 reply; 12+ messages in thread
From: Sam Ravnborg @ 2009-01-22 19:12 UTC (permalink / raw)
  To: Andrew Walrond, LKML, netdev

[restored lkml]

On Thu, Jan 22, 2009 at 07:03:29PM +0000, Andrew Walrond wrote:
> Sam Ravnborg wrote:
> >
> >I checked the include guards and they are correct.
> >
> >Could you please investige where it picks up the first definition
> >of struct iphdr.
> >
> >  
> Here you go:
> 
> $ make iptunnel.o
> 
> cc -D_GNU_SOURCE -O2 -Wall -g  -I. -idirafter ./include/ -Ilib   -c -o 
> iptunnel.o iptunnel.c
> In file included from /usr/include/linux/if_tunnel.h:5,
>                 from iptunnel.c:39:
> /usr/include/linux/ip.h:85: error: redefinition of 'struct iphdr'
> 
> $ grep -r iphdr /usr/include/
> 
> /usr/include/netinet/ip.h:struct iphdr
> /usr/include/netinet/tcp.h: * This should be defined as MIN(512, IP_MSS 
> - sizeof (struct tcpiphdr)).
> /usr/include/linux/if_tunnel.h:    struct iphdr        iph;
> /usr/include/linux/ip.h:struct iphdr {
> 
> $ grep netinet/ip.h iptunnel.c
> 
> #include <netinet/ip.h>
> 
> So linux/ip.h is clashing with glibc(2.8)'s netinet/ip.h

I took a look at my netinet/ip.h and this is obviously
the same structure.
But I do not know what the right answer is here.

Added netdev..

This may be a general thing. Because iphdr is
no a kernel thing, it is an IP thing. So one could argue
that the kernel should not export it in the first place.

	Sam

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-01-22 19:12     ` 2.6.28 headers break kbd and net-tools userspace builds Sam Ravnborg
@ 2009-01-27  5:08       ` David Miller
  2009-01-27 10:44         ` Jan Engelhardt
  0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2009-01-27  5:08 UTC (permalink / raw)
  To: sam; +Cc: andrew, linux-kernel, netdev

From: Sam Ravnborg <sam@ravnborg.org>
Date: Thu, 22 Jan 2009 20:12:39 +0100

> On Thu, Jan 22, 2009 at 07:03:29PM +0000, Andrew Walrond wrote:
> > $ grep -r iphdr /usr/include/
> > 
> > /usr/include/netinet/ip.h:struct iphdr
> > /usr/include/netinet/tcp.h: * This should be defined as MIN(512, IP_MSS 
> > - sizeof (struct tcpiphdr)).
> > /usr/include/linux/if_tunnel.h:    struct iphdr        iph;
> > /usr/include/linux/ip.h:struct iphdr {
> > 
> > $ grep netinet/ip.h iptunnel.c
> > 
> > #include <netinet/ip.h>
> > 
> > So linux/ip.h is clashing with glibc(2.8)'s netinet/ip.h
> 
> I took a look at my netinet/ip.h and this is obviously
> the same structure.
> But I do not know what the right answer is here.
> 
> Added netdev..
> 
> This may be a general thing. Because iphdr is
> no a kernel thing, it is an IP thing. So one could argue
> that the kernel should not export it in the first place.

The fly in the ointment is linux/if_tunnel.h

We export a structure there for a userland interface which
uses "struct iphdr".

Because of that, we are faced with the difficult choice between
defining the structure (as we do) in linux/ip.h or using some ugly
__KERNEL__ ifdefs in linux/if_tunnel.h to conditionally include
netinet/ip.h instead. :-/

Really, I have no idea what to do about this as the problem has
existed for so long.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-01-27  5:08       ` David Miller
@ 2009-01-27 10:44         ` Jan Engelhardt
  2009-01-28 20:29           ` David Miller
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Engelhardt @ 2009-01-27 10:44 UTC (permalink / raw)
  To: David Miller; +Cc: sam, andrew, linux-kernel, netdev


On Tuesday 2009-01-27 06:08, David Miller wrote:
>> On Thu, Jan 22, 2009 at 07:03:29PM +0000, Andrew Walrond wrote:
>> > $ grep -r iphdr /usr/include/
>> > 
>> > /usr/include/netinet/ip.h:struct iphdr
>> > /usr/include/netinet/tcp.h: * This should be defined as MIN(512, IP_MSS 
>> > - sizeof (struct tcpiphdr)).
>> > /usr/include/linux/if_tunnel.h:    struct iphdr        iph;
>> > /usr/include/linux/ip.h:struct iphdr {
>> > 
>> > $ grep netinet/ip.h iptunnel.c
>> > 
>> > #include <netinet/ip.h>
>> > 
>> > So linux/ip.h is clashing with glibc(2.8)'s netinet/ip.h
>> 
>> I took a look at my netinet/ip.h and this is obviously
>> the same structure.
>> But I do not know what the right answer is here.
>> 
>> This may be a general thing. Because iphdr is
>> no a kernel thing, it is an IP thing. So one could argue
>> that the kernel should not export it in the first place.
>
>The fly in the ointment is linux/if_tunnel.h
>
>We export a structure there for a userland interface which
>uses "struct iphdr".
>
>Because of that, we are faced with the difficult choice between
>defining the structure (as we do) in linux/ip.h or using some ugly
>__KERNEL__ ifdefs in linux/if_tunnel.h to conditionally include
>netinet/ip.h instead. :-/
>
>Really, I have no idea what to do about this as the problem has
>existed for so long.

I think in the long term, exported structs should probably
have a "kernel_" prefix, much like userspace libraries use
such prefixes to (try to) guard against simple name clashes.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-01-27 10:44         ` Jan Engelhardt
@ 2009-01-28 20:29           ` David Miller
  2009-01-30  4:12             ` Jan Engelhardt
  0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2009-01-28 20:29 UTC (permalink / raw)
  To: jengelh; +Cc: sam, andrew, linux-kernel, netdev

From: Jan Engelhardt <jengelh@medozas.de>
Date: Tue, 27 Jan 2009 11:44:51 +0100 (CET)

> 
> On Tuesday 2009-01-27 06:08, David Miller wrote:
> >The fly in the ointment is linux/if_tunnel.h
> >
> >We export a structure there for a userland interface which
> >uses "struct iphdr".
> >
> >Because of that, we are faced with the difficult choice between
> >defining the structure (as we do) in linux/ip.h or using some ugly
> >__KERNEL__ ifdefs in linux/if_tunnel.h to conditionally include
> >netinet/ip.h instead. :-/
> >
> >Really, I have no idea what to do about this as the problem has
> >existed for so long.
> 
> I think in the long term, exported structs should probably
> have a "kernel_" prefix, much like userspace libraries use
> such prefixes to (try to) guard against simple name clashes.

This is a reasonable rule for future interfaces, but won't
help us here on this one.

For one thing, users can be making use of the inner types
to build the blobs they send via these interfaces.  So it's
not like we can rename "struct iphdr" to "struct kernel_iphdr"
to fix this particular case.

Really, we page a huge price these days because the relationship
between glibc's and the kernel's userland header exports in the
past has been anti-social at best.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-01-28 20:29           ` David Miller
@ 2009-01-30  4:12             ` Jan Engelhardt
  2009-02-02 10:35               ` Andrew Walrond
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Engelhardt @ 2009-01-30  4:12 UTC (permalink / raw)
  To: David Miller; +Cc: sam, andrew, linux-kernel, netdev


On Wednesday 2009-01-28 21:29, David Miller wrote:
>> On Tuesday 2009-01-27 06:08, David Miller wrote:
>> >The fly in the ointment is linux/if_tunnel.h
>> >
>> >We export a structure there for a userland interface which
>> >uses "struct iphdr".
>> >
>> >Because of that, we are faced with the difficult choice between
>> >defining the structure (as we do) in linux/ip.h or using some ugly
>> >__KERNEL__ ifdefs in linux/if_tunnel.h to conditionally include
>> >netinet/ip.h instead. :-/
>> >
>> >Really, I have no idea what to do about this as the problem has
>> >existed for so long.
>> 
>> I think in the long term, exported structs should probably
>> have a "kernel_" prefix, much like userspace libraries use
>> such prefixes to (try to) guard against simple name clashes.
>
>This is a reasonable rule for future interfaces, but won't
>help us here on this one.[...]
>Really, we page a huge price these days because the relationship
>between glibc's and the kernel's userland header exports in the
>past has been anti-social at best.
>
Yeah I just had to notice >:-(

IPPROTO_MH is only defined in linux/in6.h, but inclusion of it:

/usr/include/linux/in6.h:31: error: redefinition of ■struct in6_addr■
/usr/include/linux/in6.h:52: error: redefinition of ■struct sockaddr_in6■
/usr/include/linux/in6.h:60: error: redefinition of ■struct ipv6_mreq■

Ick. That's even worse than tunnels.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-01-30  4:12             ` Jan Engelhardt
@ 2009-02-02 10:35               ` Andrew Walrond
  2009-02-02 20:05                 ` David Miller
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Walrond @ 2009-02-02 10:35 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: David Miller, sam, linux-kernel, netdev

Hey guys. A gentle nudge...

My distro scripts build the

    glibc
    iproute2
    iputils
    kbd
    lm_sensors
    net-tools
    strace

packages and others against every new release of linux and linux-stable, 
(hence my initial report).
Right now I'm stalled at the 2.6.27.? headers so can't do any more 
testing until this is resolved.

Andrew Walrond

Jan Engelhardt wrote:
> On Wednesday 2009-01-28 21:29, David Miller wrote:
>   
>>> On Tuesday 2009-01-27 06:08, David Miller wrote:
>>>       
>>>> The fly in the ointment is linux/if_tunnel.h
>>>>
>>>> We export a structure there for a userland interface which
>>>> uses "struct iphdr".
>>>>
>>>> Because of that, we are faced with the difficult choice between
>>>> defining the structure (as we do) in linux/ip.h or using some ugly
>>>> __KERNEL__ ifdefs in linux/if_tunnel.h to conditionally include
>>>> netinet/ip.h instead. :-/
>>>>
>>>> Really, I have no idea what to do about this as the problem has
>>>> existed for so long.
>>>>         
>>> I think in the long term, exported structs should probably
>>> have a "kernel_" prefix, much like userspace libraries use
>>> such prefixes to (try to) guard against simple name clashes.
>>>       
>> This is a reasonable rule for future interfaces, but won't
>> help us here on this one.[...]
>> Really, we page a huge price these days because the relationship
>> between glibc's and the kernel's userland header exports in the
>> past has been anti-social at best.
>>
>>     
> Yeah I just had to notice >:-(
>
> IPPROTO_MH is only defined in linux/in6.h, but inclusion of it:
>
> /usr/include/linux/in6.h:31: error: redefinition of ■struct in6_addr■
> /usr/include/linux/in6.h:52: error: redefinition of ■struct sockaddr_in6■
> /usr/include/linux/in6.h:60: error: redefinition of ■struct ipv6_mreq■
>
> Ick. That's even worse than tunnels.
>
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-02-02 10:35               ` Andrew Walrond
@ 2009-02-02 20:05                 ` David Miller
  2009-02-02 21:13                   ` Andrew Walrond
  0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2009-02-02 20:05 UTC (permalink / raw)
  To: andrew; +Cc: jengelh, sam, linux-kernel, netdev

From: Andrew Walrond <andrew@walrond.org>
Date: Mon, 02 Feb 2009 10:35:25 +0000

> Hey guys. A gentle nudge...
> 
> My distro scripts build the
> 
>     glibc
>     iproute2
>     iputils
>     kbd
>     lm_sensors
>     net-tools
>     strace
> 
> packages and others against every new release of linux and linux-stable, (hence my initial report).
> Right now I'm stalled at the 2.6.27.? headers so can't do any more testing until this is resolved.

There isn't anything we can really do about these cases.

No matter what we do, we break the userland build in one way or
another.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-02-02 20:05                 ` David Miller
@ 2009-02-02 21:13                   ` Andrew Walrond
  2009-02-02 21:24                     ` David Miller
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Walrond @ 2009-02-02 21:13 UTC (permalink / raw)
  To: David Miller; +Cc: jengelh, sam, linux-kernel, netdev

David Miller wrote:
>
> There isn't anything we can really do about these cases.
>
> No matter what we do, we break the userland build in one way or
> another.
>   
What exactly is the purpose of the kernel headers? Are there some 
definitions in the kernel headers that will never be available from 
glibc? Is it perhaps possible to work towards exporting kernel headers 
for the sole purpose of building glibc, and all other packages should be 
able to build against glibc's headers?

Andrew Walrond

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-02-02 21:13                   ` Andrew Walrond
@ 2009-02-02 21:24                     ` David Miller
  2009-02-02 21:27                       ` David Miller
  0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2009-02-02 21:24 UTC (permalink / raw)
  To: andrew; +Cc: jengelh, sam, linux-kernel, netdev

From: Andrew Walrond <andrew@walrond.org>
Date: Mon, 02 Feb 2009 21:13:11 +0000

> What exactly is the purpose of the kernel headers? Are there some
> definitions in the kernel headers that will never be available from
> glibc? Is it perhaps possible to work towards exporting kernel
> headers for the sole purpose of building glibc, and all other
> packages should be able to build against glibc's headers?

To a certain extent they are supposed to be able to
co-exist.

We weren't careful in the past in some cases, to the point
where the conflicts often very difficult to resolve.  That's
the kind of situation we have here.

I guess I'll put in the following hack for now:

diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index aeab2cb..82c4362 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,7 +2,10 @@
 #define _IF_TUNNEL_H_
 
 #include <linux/types.h>
+
+#ifdef __KERNEL__
 #include <linux/ip.h>
+#endif
 
 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
 #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-02-02 21:24                     ` David Miller
@ 2009-02-02 21:27                       ` David Miller
  2009-02-03  4:58                         ` Sam Ravnborg
  0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2009-02-02 21:27 UTC (permalink / raw)
  To: andrew; +Cc: jengelh, sam, linux-kernel, netdev

From: David Miller <davem@davemloft.net>
Date: Mon, 02 Feb 2009 13:24:50 -0800 (PST)

> I guess I'll put in the following hack for now:
> 
> diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
> index aeab2cb..82c4362 100644

Need to also update linux/Kbuild, here is an updated patch:

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 12e9a29..6a9bb97 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -89,7 +89,6 @@ header-y += if_ppp.h
 header-y += if_slip.h
 header-y += if_strip.h
 header-y += if_tun.h
-header-y += if_tunnel.h
 header-y += in_route.h
 header-y += ioctl.h
 header-y += ip6_tunnel.h
@@ -235,6 +234,7 @@ unifdef-y += if_phonet.h
 unifdef-y += if_pppol2tp.h
 unifdef-y += if_pppox.h
 unifdef-y += if_tr.h
+unifdef-y += if_tunnel.h
 unifdef-y += if_vlan.h
 unifdef-y += igmp.h
 unifdef-y += inet_diag.h
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index aeab2cb..82c4362 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,7 +2,10 @@
 #define _IF_TUNNEL_H_
 
 #include <linux/types.h>
+
+#ifdef __KERNEL__
 #include <linux/ip.h>
+#endif
 
 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
 #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-02-02 21:27                       ` David Miller
@ 2009-02-03  4:58                         ` Sam Ravnborg
  2009-02-03  5:26                           ` David Miller
  0 siblings, 1 reply; 12+ messages in thread
From: Sam Ravnborg @ 2009-02-03  4:58 UTC (permalink / raw)
  To: David Miller; +Cc: andrew, jengelh, linux-kernel, netdev

On Mon, Feb 02, 2009 at 01:27:23PM -0800, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Mon, 02 Feb 2009 13:24:50 -0800 (PST)
> 
> > I guess I'll put in the following hack for now:
> > 
> > diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
> > index aeab2cb..82c4362 100644
> 
> Need to also update linux/Kbuild, here is an updated patch:

All headers are unifdeffed - so the Kbuild patch
is not needed.

	Sam

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 2.6.28 headers break kbd and net-tools userspace builds
  2009-02-03  4:58                         ` Sam Ravnborg
@ 2009-02-03  5:26                           ` David Miller
  0 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2009-02-03  5:26 UTC (permalink / raw)
  To: sam; +Cc: andrew, jengelh, linux-kernel, netdev

From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 3 Feb 2009 05:58:33 +0100

> On Mon, Feb 02, 2009 at 01:27:23PM -0800, David Miller wrote:
> > From: David Miller <davem@davemloft.net>
> > Date: Mon, 02 Feb 2009 13:24:50 -0800 (PST)
> > 
> > > I guess I'll put in the following hack for now:
> > > 
> > > diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
> > > index aeab2cb..82c4362 100644
> > 
> > Need to also update linux/Kbuild, here is an updated patch:
> 
> All headers are unifdeffed - so the Kbuild patch
> is not needed.

Thanks for the info but that's how I commited and pushed out
the fix already, and it doesn't hurt either :-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-02-03  5:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <49786A59.6040706@walrond.org>
     [not found] ` <20090122175645.GA14178@uranus.ravnborg.org>
     [not found]   ` <4978C301.1040705@walrond.org>
2009-01-22 19:12     ` 2.6.28 headers break kbd and net-tools userspace builds Sam Ravnborg
2009-01-27  5:08       ` David Miller
2009-01-27 10:44         ` Jan Engelhardt
2009-01-28 20:29           ` David Miller
2009-01-30  4:12             ` Jan Engelhardt
2009-02-02 10:35               ` Andrew Walrond
2009-02-02 20:05                 ` David Miller
2009-02-02 21:13                   ` Andrew Walrond
2009-02-02 21:24                     ` David Miller
2009-02-02 21:27                       ` David Miller
2009-02-03  4:58                         ` Sam Ravnborg
2009-02-03  5:26                           ` David Miller

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 NNTP newsgroup(s).