linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Linux kernel headers violate RFC2553
@ 2001-06-08 17:57 Felix von Leitner
  2001-06-08 19:05 ` David S. Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Felix von Leitner @ 2001-06-08 17:57 UTC (permalink / raw)
  To: linux-kernel

glibc works around this, but the diet libc uses the kernel headers and
thus exports the wrong API to user land.

Here is what RFC2553 mandates:

   struct ipv6_mreq {
       struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast addr */
       unsigned int    ipv6mr_interface; /* interface index */
   };

...and here is what include/linux/in6.h declares:

  struct ipv6_mreq {
	  /* IPv6 multicast address of group */
	  struct in6_addr ipv6mr_multiaddr;

	  /* local IPv6 address of interface */
	  int             ipv6mr_ifindex;
  };

Note the ipv6mr_ifindex instead of the correct ipv6mr_interface.

This wrong name is only used twice in net/ipv6/ipv6_sockglue.c, so it should be
trivial to fix.

Felix

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

* Re: Linux kernel headers violate RFC2553
  2001-06-08 17:57 Linux kernel headers violate RFC2553 Felix von Leitner
@ 2001-06-08 19:05 ` David S. Miller
  2001-06-08 19:12   ` Felix von Leitner
  2001-06-08 21:31   ` David S. Miller
  0 siblings, 2 replies; 6+ messages in thread
From: David S. Miller @ 2001-06-08 19:05 UTC (permalink / raw)
  To: Felix von Leitner; +Cc: linux-kernel


Felix von Leitner writes:
 > glibc works around this, but the diet libc uses the kernel headers and
 > thus exports the wrong API to user land.

Don't user kernel headers for userspace.

Kernel headers and user headers are distinctly different namespaces,
and you have pointed out only one of many places where we use
different names/structures/etc. for some kernel networking headers
vs. what userspace wants.

Later,
David S. Miller
davem@redhat.com

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

* Re: Linux kernel headers violate RFC2553
  2001-06-08 19:05 ` David S. Miller
@ 2001-06-08 19:12   ` Felix von Leitner
  2001-06-08 21:49     ` Linus Torvalds
  2001-06-08 21:31   ` David S. Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Felix von Leitner @ 2001-06-08 19:12 UTC (permalink / raw)
  To: David S. Miller; +Cc: Felix von Leitner, linux-kernel

Thus spake David S. Miller (davem@redhat.com):
>  > glibc works around this, but the diet libc uses the kernel headers and
>  > thus exports the wrong API to user land.
> Don't user kernel headers for userspace.

What choice do I have?
Duplicate everything and then be out of sync when the specs change?

Using glibc-2.1.* for IPv6 did not work for 2.4 kernels for more than
ONE YEAR because of this, then glibc 2.2 became available.  I am not
willing to follow this shining example of "Linux brokenness" that is
still being laughed about by avid BSD followers.

I hereby volunteer to submit patches for all places where the kernel
headers are not RFC compliant.  The kernel headers are actually
_intended_ to be used from user space, as kernel specific parts are
escaped using "#ifdef __KERNEL__" all over the place.  What reason would
there be for this if the kernel headers were not used from user space?

Even when using glibc the kernel headers are included in most programs.

> Kernel headers and user headers are distinctly different namespaces,
> and you have pointed out only one of many places where we use
> different names/structures/etc. for some kernel networking headers
> vs. what userspace wants.

Then, with all due respect, those places should be fixed.

There is no excuse for sloppy code and sloppy interfaces.  At any rate,
"don't use our code, then" is not a valid excuse in my humble opinion.

Felix

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

* Re: Linux kernel headers violate RFC2553
  2001-06-08 19:05 ` David S. Miller
  2001-06-08 19:12   ` Felix von Leitner
@ 2001-06-08 21:31   ` David S. Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David S. Miller @ 2001-06-08 21:31 UTC (permalink / raw)
  To: Felix von Leitner; +Cc: linux-kernel


Felix von Leitner writes:
 > Thus spake David S. Miller (davem@redhat.com):
 > > Don't user kernel headers for userspace.
 > 
 > What choice do I have?

I didn't say anything about choice, I said "don't use kernel headers
for userspace".  What part of it do you not understand.

It was decided long ago that keeping the kernel headers up to snuff
with "user space standard of the day" was not in our interests, so we
don't have "#if _POSIX == 19940XXX" type crap all over the kernel
headers.

In fact, in some headers the structures and names are purposely not
what userspace wants.  In this way nobody is likely to get the ill
conception that they are meant in any way to be used by userspace.

Later,
David S. Miller
davem@redhat.com

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

* Re: Linux kernel headers violate RFC2553
  2001-06-08 19:12   ` Felix von Leitner
@ 2001-06-08 21:49     ` Linus Torvalds
  2001-06-08 23:06       ` Oliver Xymoron
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2001-06-08 21:49 UTC (permalink / raw)
  To: linux-kernel

In article <20010608211247.A12925@codeblau.de>,
Felix von Leitner  <leitner@fefe.de> wrote:
>Thus spake David S. Miller (davem@redhat.com):
>>  > glibc works around this, but the diet libc uses the kernel headers and
>>  > thus exports the wrong API to user land.
>> Don't user kernel headers for userspace.
>
>What choice do I have?
>Duplicate everything and then be out of sync when the specs change?

Yes.

Even more preferably - write user-space headers that have _only_ the
minimum amount of code in them. The kernel headers have a lot of cruft
that is kernel-only, and that means that if you compile user space using
them, your compiles will be slower than they should be.

The basic issue is that the kernel will _refuse_ to follow the
"namespace of the day" rules of C89, C99, POSIX, BSD, SuS, GNU .. the
list goes on. The kernel headers are not meant to be used in user space,
and will not have the strict namespace rules that a lot of standards
spend so much time playing with.

There aren't that many things that are actually useful in the kernel
headers anyway.  Most of them (like the IPv6 stuff) are really specified
in other places in the first place. 

		Linus

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

* Re: Linux kernel headers violate RFC2553
  2001-06-08 21:49     ` Linus Torvalds
@ 2001-06-08 23:06       ` Oliver Xymoron
  0 siblings, 0 replies; 6+ messages in thread
From: Oliver Xymoron @ 2001-06-08 23:06 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

On 8 Jun 2001, Linus Torvalds wrote:

> The basic issue is that the kernel will _refuse_ to follow the
> "namespace of the day" rules of C89, C99, POSIX, BSD, SuS, GNU .. the
> list goes on. The kernel headers are not meant to be used in user space,
> and will not have the strict namespace rules that a lot of standards
> spend so much time playing with.

Add something like this to linux/config.h in 2.5?

#if !defined(__KERNEL__) || !defined(__KERNEL_ME_HARDER__)
#warning "Using kernel headers in userspace apps is unsupported."
#warning "Don't come crying to us when it breaks."
#endif

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.."


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

end of thread, other threads:[~2001-06-08 23:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-08 17:57 Linux kernel headers violate RFC2553 Felix von Leitner
2001-06-08 19:05 ` David S. Miller
2001-06-08 19:12   ` Felix von Leitner
2001-06-08 21:49     ` Linus Torvalds
2001-06-08 23:06       ` Oliver Xymoron
2001-06-08 21:31   ` David S. 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).