Re: [PATCH] uapi: fix linux/tls.h userspace compilation error

2017-11-15 Thread Mikko Rapeli
On Tue, Nov 14, 2017 at 06:30:11AM +0300, Dmitry V. Levin wrote:
> Move inclusion of a private kernel header 
> from uapi/linux/tls.h to its only user - net/tls.h,
> to fix the following linux/tls.h userspace compilation error:
> 
> /usr/include/linux/tls.h:41:21: fatal error: net/tcp.h: No such file or 
> directory
> 
> As to this point uapi/linux/tls.h was totaly unusuable for userspace,
> cleanup this header file further by moving other redundant includes
> to net/tls.h.
> 
> Fixes: 3c4d7559159b ("tls: kernel TLS support")
> Cc: <sta...@vger.kernel.org> # v4.13+
> Signed-off-by: Dmitry V. Levin <l...@altlinux.org>

Acked-by: Mikko Rapeli <mikko.rap...@iki.fi>

> ---
>  include/net/tls.h| 4 
>  include/uapi/linux/tls.h | 4 
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/net/tls.h b/include/net/tls.h
> index b89d397dd62f..c06db1eadac2 100644
> --- a/include/net/tls.h
> +++ b/include/net/tls.h
> @@ -35,6 +35,10 @@
>  #define _TLS_OFFLOAD_H
>  
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
>  
>  #include 
>  
> diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
> index d5e0682ab837..293b2cdad88d 100644
> --- a/include/uapi/linux/tls.h
> +++ b/include/uapi/linux/tls.h
> @@ -35,10 +35,6 @@
>  #define _UAPI_LINUX_TLS_H
>  
>  #include 
> -#include 
> -#include 
> -#include 
> -#include 
>  
>  /* TLS socket options */
>  #define TLS_TX   1   /* Set transmit parameters */
> 
> -- 
> ldv


Re: [PATCH v06 35/36] uapi linux/tls.h: don't include in user space

2017-09-18 Thread Mikko Rapeli
On Mon, Sep 04, 2017 at 07:15:11PM +0300, Dmitry V. Levin wrote:
> On Wed, Aug 09, 2017 at 02:25:54AM +0300, Dmitry V. Levin wrote:
> > On Sun, Aug 06, 2017 at 06:44:26PM +0200, Mikko Rapeli wrote:
> > > It is not needed and not part of uapi headers, but causes
> > > user space compilation error:
> > > 
> > > fatal error: net/tcp.h: No such file or directory
> > >  #include 
> > >  ^
> > > 
> > > Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> > > Cc: Dave Watson <davejwat...@fb.com>
> > > Cc: Ilya Lesokhin <il...@mellanox.com>
> > > Cc: Aviad Yehezkel <avia...@mellanox.com>
> > > ---
> > >  include/uapi/linux/tls.h | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
> > > index cc1d21db35d8..d87c698623f2 100644
> > > --- a/include/uapi/linux/tls.h
> > > +++ b/include/uapi/linux/tls.h
> > > @@ -37,7 +37,9 @@
> > >  #include 
> > >  #include 
> > >  #include 
> > > +#ifdef __KERNEL__
> > >  #include 
> > > +#endif
> > 
> > Let's move it to include/net/tls.h instead.
> 
> So everybody ignored this and *new* uapi header was released
> in a totally unusable form along with v4.13.

Should issues like these be filed into bugzilla instead?

Maybe emails are easier to ignore than bugzilla tickets.

-Mikko


Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space

2017-08-06 Thread Mikko Rapeli
On Sun, Aug 06, 2017 at 05:42:13PM -0400, Willem de Bruijn wrote:
> On Sun, Aug 6, 2017 at 5:33 PM, Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> > On Sun, Aug 06, 2017 at 05:24:20PM -0400, Willem de Bruijn wrote:
> >> >> > +#ifdef __KERNEL__
> >> >> > +#include 
> >> >> > +#else
> >> >> > +#include 
> >> >> > +#endif /* __KERNEL__ */
> >> >>
> >> >> This will break applications that include  manually.
> >> >> I previously sent a patch to use libc-compat to make compilation succeed
> >> >> when both are included in the case where  is included 
> >> >> after
> >> >> .
> >> >>
> >> >>   https://lkml.org/lkml/2016/9/12/872
> >> >>
> >> >> The inverse will require changes to the libc header to avoid redefining
> >> >> symbols already defined by 
> >> >>
> >> >> The second patch in that 2-patch set included 
> >> >> unconditionally after the fix. This broke builds that also included
> >> >>  in the wrong order. I did not resubmit the first patch as a
> >> >> stand-alone, as it is not sufficient to avoid breakage.
> >> >
> >> > I wasn't aware of your change, but I was about to send this to fix the
> >> > case when glibc  is included before :
> >> >
> >> > https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66
> >>
> >> There are a few differences between the two. Including  does not
> >> unconditionally define all the symbols. Some are conditional on additional
> >> state, such as __timespec_defined.
> >
> > Yep, your patch seems better for libc-compat.h. Could you send it again?
> 
> Okay. Or feel free to include it in the patchset if that helps resolve
> dependencies.

If you don't have the time, I will send tomorrow a new version of this
patch which fixes the commit topic and before that your libc-compat.h change
so both could be applied together.

Feel free to be faster :)

> >> > I don't like leaving a few dozen non-compiling header files into uapi.
> >>
> >> I agree, but I do not see a simple solution.
> >>
> >> Unless libc has the analogous change, including either  or
> >>  in userspace can unfortunately cause breakage.
> >>
> >> The added include if __KERNEL__ is defined should be safe, though.
> >
> > Yes, for the kernel side, but your libc-compat change would nice for
> > userspace, where something will break for sure, but providing source
> > API compatibility is sometimes impossible.
> >
> > To summarize, this change from me, and your libc-compat.c for time.h, or?
> 
> I'm still afraid that this patch as is will break builds that include
>  first.

I agree, but I also want uapi headers to cleanly compile. I know this might
break stuff on userspace side which rely on these broken header file
dependencies, but if the fix to just re-order include
statements I'm fine with it, also when the complaints hit my inbox.

If I had the CPU time, memory and disk space, I'd do a full yocto distro
build to see how badly userspace could break but I don't at home.

-Mikko


Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space

2017-08-06 Thread Mikko Rapeli
On Sun, Aug 06, 2017 at 05:24:20PM -0400, Willem de Bruijn wrote:
> >> > +#ifdef __KERNEL__
> >> > +#include 
> >> > +#else
> >> > +#include 
> >> > +#endif /* __KERNEL__ */
> >>
> >> This will break applications that include  manually.
> >> I previously sent a patch to use libc-compat to make compilation succeed
> >> when both are included in the case where  is included after
> >> .
> >>
> >>   https://lkml.org/lkml/2016/9/12/872
> >>
> >> The inverse will require changes to the libc header to avoid redefining
> >> symbols already defined by 
> >>
> >> The second patch in that 2-patch set included 
> >> unconditionally after the fix. This broke builds that also included
> >>  in the wrong order. I did not resubmit the first patch as a
> >> stand-alone, as it is not sufficient to avoid breakage.
> >
> > I wasn't aware of your change, but I was about to send this to fix the
> > case when glibc  is included before :
> >
> > https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66
> 
> There are a few differences between the two. Including  does not
> unconditionally define all the symbols. Some are conditional on additional
> state, such as __timespec_defined.

Yep, your patch seems better for libc-compat.h. Could you send it again?

> > but you also ran into problems where  is included before
> >  which need fixes in libc header side.
> >
> > So how to proceed with these?
> 
> The libc-compat change is a good fix that can be submitted on its own.

Yes, please do so.

> > I don't like leaving a few dozen non-compiling header files into uapi.
> 
> I agree, but I do not see a simple solution.
> 
> Unless libc has the analogous change, including either  or
>  in userspace can unfortunately cause breakage.
> 
> The added include if __KERNEL__ is defined should be safe, though.

Yes, for the kernel side, but your libc-compat change would nice for
userspace, where something will break for sure, but providing source
API compatibility is sometimes impossible.

To summarize, this change from me, and your libc-compat.c for time.h, or?

-Mikko


Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space

2017-08-06 Thread Mikko Rapeli
On Sun, Aug 06, 2017 at 04:26:50PM -0400, Willem de Bruijn wrote:
> On Sun, Aug 6, 2017 at 4:23 PM, Willem de Bruijn
> <willemdebruijn.ker...@gmail.com> wrote:
> > On Sun, Aug 6, 2017 at 12:44 PM, Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> >> linux/time.h conflicts with user space header time.h. Try to be compatible
> >> with both.
> >>
> >> Fixes userspace compilation error:
> >>
> >> error: array type has incomplete element type
> >>  struct timespec ts[3];
> >>
> >> Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> >> Cc: Willem de Bruijn <will...@google.com>
> >> Cc: Soheil Hassas Yeganeh <soh...@google.com>
> >> Cc: netdev@vger.kernel.org
> >> ---
> >>  include/uapi/linux/errqueue.h | 6 ++
> >>  1 file changed, 6 insertions(+)
> >>
> >> diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
> >> index 07bdce1f444a..b310b2c6d94f 100644
> >> --- a/include/uapi/linux/errqueue.h
> >> +++ b/include/uapi/linux/errqueue.h
> >> @@ -3,6 +3,12 @@
> >>
> >>  #include 
> >>
> >> +#ifdef __KERNEL__
> >> +#include 
> >> +#else
> >> +#include 
> >> +#endif /* __KERNEL__ */
> >
> > This will break applications that include  manually.
> 
> Also, the patch title reads "include  in user space",
> but it includes  in that environment.

Oops, missed while squashing some commits. Will fix. Thanks!

-Mikko


Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space

2017-08-06 Thread Mikko Rapeli
On Sun, Aug 06, 2017 at 04:23:16PM -0400, Willem de Bruijn wrote:
> On Sun, Aug 6, 2017 at 12:44 PM, Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> > linux/time.h conflicts with user space header time.h. Try to be compatible
> > with both.
> >
> > Fixes userspace compilation error:
> >
> > error: array type has incomplete element type
> >  struct timespec ts[3];
> >
> > Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> > Cc: Willem de Bruijn <will...@google.com>
> > Cc: Soheil Hassas Yeganeh <soh...@google.com>
> > Cc: netdev@vger.kernel.org
> > ---
> >  include/uapi/linux/errqueue.h | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
> > index 07bdce1f444a..b310b2c6d94f 100644
> > --- a/include/uapi/linux/errqueue.h
> > +++ b/include/uapi/linux/errqueue.h
> > @@ -3,6 +3,12 @@
> >
> >  #include 
> >
> > +#ifdef __KERNEL__
> > +#include 
> > +#else
> > +#include 
> > +#endif /* __KERNEL__ */
> 
> This will break applications that include  manually.
> I previously sent a patch to use libc-compat to make compilation succeed
> when both are included in the case where  is included after
> .
> 
>   https://lkml.org/lkml/2016/9/12/872
> 
> The inverse will require changes to the libc header to avoid redefining
> symbols already defined by 
> 
> The second patch in that 2-patch set included 
> unconditionally after the fix. This broke builds that also included
>  in the wrong order. I did not resubmit the first patch as a
> stand-alone, as it is not sufficient to avoid breakage.

I wasn't aware of your change, but I was about to send this to fix the
case when glibc  is included before :

https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66

but you also ran into problems where  is included before
 which need fixes in libc header side.

So how to proceed with these?

I don't like leaving a few dozen non-compiling header files into uapi.

-Mikko


[PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space

2017-08-06 Thread Mikko Rapeli
linux/time.h conflicts with user space header time.h. Try to be compatible
with both.

Fixes userspace compilation error:

error: array type has incomplete element type
 struct timespec ts[3];

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
Cc: Willem de Bruijn <will...@google.com>
Cc: Soheil Hassas Yeganeh <soh...@google.com>
Cc: netdev@vger.kernel.org
---
 include/uapi/linux/errqueue.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
index 07bdce1f444a..b310b2c6d94f 100644
--- a/include/uapi/linux/errqueue.h
+++ b/include/uapi/linux/errqueue.h
@@ -3,6 +3,12 @@
 
 #include 
 
+#ifdef __KERNEL__
+#include 
+#else
+#include 
+#endif /* __KERNEL__ */
+
 struct sock_extended_err {
__u32   ee_errno;   
__u8ee_origin;
-- 
2.13.3



[PATCH v06 35/36] uapi linux/tls.h: don't include in user space

2017-08-06 Thread Mikko Rapeli
It is not needed and not part of uapi headers, but causes
user space compilation error:

fatal error: net/tcp.h: No such file or directory
 #include 
 ^

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
Cc: Dave Watson <davejwat...@fb.com>
Cc: Ilya Lesokhin <il...@mellanox.com>
Cc: Aviad Yehezkel <avia...@mellanox.com>
---
 include/uapi/linux/tls.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
index cc1d21db35d8..d87c698623f2 100644
--- a/include/uapi/linux/tls.h
+++ b/include/uapi/linux/tls.h
@@ -37,7 +37,9 @@
 #include 
 #include 
 #include 
+#ifdef __KERNEL__
 #include 
+#endif
 
 /* TLS socket options */
 #define TLS_TX 1   /* Set transmit parameters */
-- 
2.13.3



[PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space

2017-08-06 Thread Mikko Rapeli
This libc header has sockaddr definition in user space.

Fixes user space compilation errors like these from kernel headers including
only linux/socket.h:

error: field ‘ifru_addr’ has incomplete type
struct sockaddr ifru_addr;
error: field ‘_sockaddr’ has incomplete type
struct sockaddr  _sockaddr;
error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’

With this following uapi headers now compile in user space:

rdma/rdma_user_rxe.h
linux/vm_sockets.h
linux/ncp_fs.h
linux/nfc.h
linux/phonet.h

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
Cc: netdev@vger.kernel.org
Cc: Dmitry V. Levin <l...@altlinux.org>
---
 include/uapi/linux/socket.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 76ab0c68561e..8a81197cc08b 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -1,6 +1,10 @@
 #ifndef _UAPI_LINUX_SOCKET_H
 #define _UAPI_LINUX_SOCKET_H
 
+#ifndef __KERNEL__
+#include 
+#endif
+
 /*
  * Desired design of maximum size and alignment (see RFC2553)
  */
-- 
2.13.3



[PATCH v06 20/36] uapi linux/scc.h: include linux/sockios.h

2017-08-06 Thread Mikko Rapeli
Fixes userspace compilation error:

error: ‘SIOCDEVPRIVATE’ undeclared here (not in a function)
  SIOCSCCRESERVED = SIOCDEVPRIVATE

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
Cc: netdev@vger.kernel.org
Cc: linux-h...@vger.kernel.org
Cc: Joerg Reuter <jreu...@yaina.de>
---
 include/uapi/linux/scc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/scc.h b/include/uapi/linux/scc.h
index 72b6b8153374..2992b88ca4ce 100644
--- a/include/uapi/linux/scc.h
+++ b/include/uapi/linux/scc.h
@@ -3,6 +3,7 @@
 #ifndef _UAPI_SCC_H
 #define _UAPI_SCC_H
 
+#include 
 
 /* selection of hardware types */
 
-- 
2.13.3



[PATCH v06 01/36] Add scripts/headers_compile_test.sh: compile test for exported uapi headers

2017-08-06 Thread Mikko Rapeli
Users of kernel uapi header files would be happier if they did not
contain kernel specific parts and would contain #include statements
for all other header files that they depend on, and in general would
compile also in user space. If Linux kernal uapi headers compile in
user space, then they can also be used to do ABI and API compatibility
checks against different kernel versions. ABI checks can also be used
by Linux distribution build systems like yocto/bitbake to avoid
recompiling dependencies if changes are ABI compatible.

For each header file exported to userspace, this script tries to
compile it together with minimal header files from GCC and libc, and
reports results.

In the test execution environment, libc and GCC header file locations
are parsed from gcc compiler configuration.

Some gcc and kernel headers depend on libc headers which are made available
by copying from the compiler default location to a temporary location and
removing possibly existing kernel headers from this directory. This is a bit
of a hack but seems to work in multiple environments so test can be
executed without installing headers to /usr/include and compiling a full
Linux distribution on top.

Tested natively on:

Debian unstable, i586-linux-gnu and gcc 4.9.2
Raspbian Wheezy, arm-linux-gnueabihf and gcc 4.6.3
Ubuntu 12.04 LTS, x86_64-linux-gnu and gcc 4.6.3

Tested cross compilation using standard CROSS_COMPILE=/path/to/gcc with:

arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 
4.9-2014.09) 4.9.2 20140904 (prerelease)

Execute the script in the directory where kernel header files are installed.
For example with kernel tree from v4.13-rc3-216-g0a23ea65ce9f on x86 i586:

$ make headers_install
$ cd usr/include
$ ../../scripts/headers_compile_test.sh
...
Kernel header compile test statistics:

42 files failed the kernel header compile test.
821 files passed the kernel header compile test.

Once all these errors have been fixed, this test could be added to
'make headers_check'.

In addition to plain compile test, there is also a glibc header
compatibility test, which compiles all kernel uapi headers against a
non-conflicting set of all GNU libc headers. The test covers
variants where kernel header is included before libc header
and libc header before kernel header.

Tested in Debian unstable with libc6 version 2.24-14.

Example execution with output:

$ make headers_install
$ cd usr/include
$ ../../scripts/headers_compile_test.sh -lk
Testing that 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE/libc_headers.h
 compiles
cc -Wall -c -nostdinc -I /usr/lib/gcc/i686-linux-gnu/6/include -I 
/usr/lib/gcc/i686-linux-gnu/6/include-fixed -I . -I 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE -I 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE/i686-linux-gnu
 -o /dev/null /home/mcfrisk/src/linux-2.6/usr/include/drm/i810_drm.h
PASSED: drm/i810_drm.h
cc -Wall -c -nostdinc -I /usr/lib/gcc/i686-linux-gnu/6/include -I 
/usr/lib/gcc/i686-linux-gnu/6/include-fixed -I . -I 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE -I 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE/i686-linux-gnu
 -o /dev/null 
/home/mcfrisk/src/linux-2.6/usr/include/drm/i810_drm.h_libc_before_kernel.h
...
In file included from /home/mcfrisk/src/linux-2.6/usr/include/asm/sigcontext.h_l
ibc_before_kernel.h:2:0:
./asm/sigcontext.h:291:8: error: redefinition of ‘struct sigcontext’
 struct sigcontext {
^~
In file included from /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_inclu
de.qd5RuE/signal.h:306:0,
 from /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_inclu
de.qd5RuE/sys/param.h:28,
 from /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_inclu
de.qd5RuE/resolv.h:62,
 from /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_inclu
de.qd5RuE/libc_headers.h:103,
 from /home/mcfrisk/src/linux-2.6/usr/include/asm/sigcontext.h_l
ibc_before_kernel.h:1:
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE/bits/sigcont
ext.h:93:8: note: originally defined here
 struct sigcontext
^~
FAILED libc before kernel test: asm/sigcontext.h
...
Kernel header compile test statistics:

42 files failed the kernel header compile test.
821 files passed the kernel header compile test.

libc and kernel header compatibility test statistics:
73 files failed libc before kernel include test.
790 files passed libc before kernel include test.

Since I've been stubborn enough to work with this script and fixes to the
test failures for a few years, I added my self to MAINTAINERS.

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
Cc: Alexander Stein <alexander.st...@systec-electronic.com>
Cc: Gabriel Laskar <gabr...@lse.epita.fr>
Cc: Dmitry V. Levin <l...@altlinux.org>
Cc: Arnd Bergmann <a...@arndb.de>
Cc: ne

Re: uapi: MAX_ADDR_LEN vs. numeric 32

2017-08-04 Thread Mikko Rapeli
On Sat, Aug 05, 2017 at 01:25:19AM +0300, Dmitry V. Levin wrote:
>
> On Sat, Aug 05, 2017 at 12:33:25AM +0300, Mikko Rapeli wrote:
> > 
> > I find using MAX_ADDR_LEN better than numeric 32, though I doubt this will
> > change any time soon. Would you mind if I change packet_diag.h and
> > if_link.h to use that instead and fix the userspace compilation
> > problems by including netdevice.h?
> 
> The alternative fix, that is, to include 
> which pulls in other headers and a lot of definitions with them,
> has been mentioned in the discussion, too.
> We decided that the fix that was applied would be the least of all evils.

Ok, that's fine then. I'll drop my netdevice.h inclusion patch.

Thanks,

-Mikko


uapi: MAX_ADDR_LEN vs. numeric 32

2017-08-04 Thread Mikko Rapeli
Hi,

First, thanks Dmitry for fixing several uapi compilation problems in
user space. I got a bit demotivated about the slow review progress, e.g.
no feedback what so ever, on some of the patches, but lets try again...

I rebased my tree now and saw

commit 745cb7f8a5de0805cade3de3991b7a95317c7c73
Author: Dmitry V. Levin 
Date:   Tue Mar 7 23:50:50 2017 +0300

uapi: fix linux/packet_diag.h userspace compilation error

which does:

--- a/include/uapi/linux/packet_diag.h
+++ b/include/uapi/linux/packet_diag.h
@@ -64,7 +64,7 @@ struct packet_diag_mclist {
__u32   pdmc_count;
__u16   pdmc_type;
__u16   pdmc_alen;
-   __u8pdmc_addr[MAX_ADDR_LEN];
+   __u8pdmc_addr[32]; /* MAX_ADDR_LEN */
 };
 
 struct packet_diag_ring {

In my tree I had fixed that case with:

--- a/include/uapi/linux/packet_diag.h
+++ b/include/uapi/linux/packet_diag.h
@@ -2,6 +2,7 @@
 #define __PACKET_DIAG_H__
 
 #include 
+#include 
 
 struct packet_diag_req {
__u8sdiag_family;

since netdevice.h has the definition also in user space

#define MAX_ADDR_LEN32  /* Largest hardware address length */

I find using MAX_ADDR_LEN better than numeric 32, though I doubt this will
change any time soon. Would you mind if I change packet_diag.h and
if_link.h to use that instead and fix the userspace compilation
problems by including netdevice.h?

Thanks,

-Mikko


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-16 Thread Mikko Rapeli
On Thu, Mar 16, 2017 at 07:59:12AM +, David Woodhouse wrote:
> On Sun, 2017-03-12 at 23:00 +0100, Hauke Mehrtens wrote:
> > __USE_MISC is glibc specific and not available in musl libc. Only do
> > this check when glibc is used. This fixes a problem with musl libc.
> > ...
> > -/* Coordinate with glibc net/if.h header. */
> > -#if defined(_NET_IF_H) && defined(__USE_MISC)
> > +/* Coordinate with libc net/if.h header. */
> > +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
> 
> I *really* don't like building up a plethora of knowledge about
> specific libc implementations in the kernel. As a general rule, if we
> have *anything* that depends on __GLIBC__ then we are Doing It Wrong™.

Kernel does not depend on glibc but uapi headers check for some defintions
so that userspace code can include both libc and kernel header files
without compiler errors.

This interface between kernel and libc header files is messy due to long
history of copying header files from kernel to libc implementations etc
and thus this kind of ifdef magic with in depth knowledge of various
libc's defintions is currently unavoidable.

-Mikko


Re: [PATCH 4/4] uapi/if_ether.h: prevent redefinition of struct ethhdr

2017-03-13 Thread Mikko Rapeli
On Sun, Mar 12, 2017 at 11:00:39PM +0100, Hauke Mehrtens wrote:
> From: David Heidelberger <david.heidelber...@ixit.cz>
> 
> Musl provides its own ethhdr struct definition. Add a guard to prevent
> its definition of the appropriate musl header has already been included.
> 
> Signed-off-by: John Spencer <maillist-li...@barfooze.de>
> Tested-by: David Heidelberger <david.heidelber...@ixit.cz>
> Signed-off-by: Jonas Gorski <j...@openwrt.org>

Acked-by: Mikko Rapeli <mikko.rap...@iki.fi>

> ---
>  include/uapi/linux/if_ether.h|  3 +++
>  include/uapi/linux/libc-compat.h | 11 +++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
> index 5bc9bfd816b7..fb5ab8c1e753 100644
> --- a/include/uapi/linux/if_ether.h
> +++ b/include/uapi/linux/if_ether.h
> @@ -22,6 +22,7 @@
>  #define _UAPI_LINUX_IF_ETHER_H
>  
>  #include 
> +#include 
>  
>  /*
>   *   IEEE 802.3 Ethernet magic constants.  The frame sizes omit the preamble
> @@ -142,11 +143,13 @@
>   *   This is an Ethernet frame header.
>   */
>  
> +#if __UAPI_DEF_ETHHDR
>  struct ethhdr {
>   unsigned char   h_dest[ETH_ALEN];   /* destination eth addr */
>   unsigned char   h_source[ETH_ALEN]; /* source ether addr*/
>   __be16  h_proto;/* packet type ID field */
>  } __attribute__((packed));
> +#endif
>  
>  
>  #endif /* _UAPI_LINUX_IF_ETHER_H */
> diff --git a/include/uapi/linux/libc-compat.h 
> b/include/uapi/linux/libc-compat.h
> index ce2fa8a4ced6..c92d32f213d1 100644
> --- a/include/uapi/linux/libc-compat.h
> +++ b/include/uapi/linux/libc-compat.h
> @@ -87,6 +87,14 @@
>  
>  #endif /* _NET_IF_H */
>  
> +/* musl defines the ethhdr struct itself in its netinet/if_ether.h.
> + * Glibc just includes the kernel header and uses a different guard. */
> +#if defined(_NETINET_IF_ETHER_H)
> +#define __UAPI_DEF_ETHHDR0
> +#else
> +#define __UAPI_DEF_ETHHDR1
> +#endif
> +
>  /* Coordinate with glibc netinet/in.h header. */
>  #if defined(_NETINET_IN_H)
>  
> @@ -182,6 +190,9 @@
>  /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
>  #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
>  
> +/* Definitions for if_ether.h */
> +#define __UAPI_DEF_ETHHDR1
> +
>  /* Definitions for in.h */
>  #define __UAPI_DEF_IN_ADDR   1
>  #define __UAPI_DEF_IN_IPPROTO1
> -- 
> 2.11.0
> 


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-13 Thread Mikko Rapeli
On Sun, Mar 12, 2017 at 11:00:38PM +0100, Hauke Mehrtens wrote:
> __USE_MISC is glibc specific and not available in musl libc. Only do
> this check when glibc is used. This fixes a problem with musl libc.

> Signed-off-by: Hauke Mehrtens <ha...@hauke-m.de>

Acked-by: Mikko Rapeli <mikko.rap...@iki.fi>

> ---
>  include/uapi/linux/libc-compat.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/libc-compat.h 
> b/include/uapi/linux/libc-compat.h
> index 49a8cc3138ae..ce2fa8a4ced6 100644
> --- a/include/uapi/linux/libc-compat.h
> +++ b/include/uapi/linux/libc-compat.h
> @@ -51,8 +51,8 @@
>  /* We have included libc headers... */
>  #if !defined(__KERNEL__)
>  
> -/* Coordinate with glibc net/if.h header. */
> -#if defined(_NET_IF_H) && defined(__USE_MISC)
> +/* Coordinate with libc net/if.h header. */
> +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
>  
>  /* GLIBC headers included first so don't define anything
>   * that would already be defined. */
> -- 
> 2.11.0
> 


Re: [PATCH 2/4] uapi glibc compat: fix build if libc defines IFF_ECHO

2017-03-13 Thread Mikko Rapeli
On Sun, Mar 12, 2017 at 11:00:37PM +0100, Hauke Mehrtens wrote:
> musl 1.1.15 defines IFF_ECHO and the other net_device_flags options.
> When a user application includes linux/if.h and net/if.h the compile
> will fail.
> 
> Activate __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO only when
> it is needed. This should also make this work in case glibc will add
> these defines.
> 
> Signed-off-by: Hauke Mehrtens <ha...@hauke-m.de>

Acked-by: Mikko Rapeli <mikko.rap...@iki.fi>

> ---
>  include/uapi/linux/libc-compat.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/uapi/linux/libc-compat.h 
> b/include/uapi/linux/libc-compat.h
> index 7c1fead03c50..49a8cc3138ae 100644
> --- a/include/uapi/linux/libc-compat.h
> +++ b/include/uapi/linux/libc-compat.h
> @@ -64,9 +64,11 @@
>  /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
>  #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
>  /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
> +#ifndef IFF_ECHO
>  #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
>  #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
>  #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
> +#endif /* IFF_ECHO */
>  
>  #else /* _NET_IF_H */
>  
> -- 
> 2.11.0
> 


Re: [PATCH 1/4] uapi glibc compat: add libc compat code when not build for kernel

2017-03-13 Thread Mikko Rapeli
On Sun, Mar 12, 2017 at 11:00:36PM +0100, Hauke Mehrtens wrote:
> Instead of checking if this header file is used in the glibc, check if
> iti is not used in kernel context, this way it will also work with
> other libc implementations like musl.
> 
> Signed-off-by: Hauke Mehrtens <ha...@hauke-m.de>

Accked-by: Mikko Rapeli <mikko.rap...@iki.fi>

> ---
>  include/uapi/linux/libc-compat.h | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/uapi/linux/libc-compat.h 
> b/include/uapi/linux/libc-compat.h
> index 44b8a6bd5fe1..7c1fead03c50 100644
> --- a/include/uapi/linux/libc-compat.h
> +++ b/include/uapi/linux/libc-compat.h
> @@ -48,8 +48,8 @@
>  #ifndef _UAPI_LIBC_COMPAT_H
>  #define _UAPI_LIBC_COMPAT_H
>  
> -/* We have included glibc headers... */
> -#if defined(__GLIBC__)
> +/* We have included libc headers... */
> +#if !defined(__KERNEL__)
>  
>  /* Coordinate with glibc net/if.h header. */
>  #if defined(_NET_IF_H) && defined(__USE_MISC)
> @@ -168,7 +168,7 @@
>  /* If we did not see any headers from any supported C libraries,
>   * or we are being included in the kernel, then define everything
>   * that we need. */
> -#else /* !defined(__GLIBC__) */
> +#else /* defined(__KERNEL__) */
>  
>  /* Definitions for if.h */
>  #define __UAPI_DEF_IF_IFCONF 1
> @@ -208,6 +208,6 @@
>  /* Definitions for xattr.h */
>  #define __UAPI_DEF_XATTR 1
>  
> -#endif /* __GLIBC__ */
> +#endif /* __KERNEL__ */
>  
>  #endif /* _UAPI_LIBC_COMPAT_H */
> -- 
> 2.11.0
> 


Re: Commit 1fe8e0... (include more headers in if_tunnel.h) breaks my user-space build.

2017-01-13 Thread Mikko Rapeli
On Fri, Jan 13, 2017 at 02:11:41PM -0800, Ben Greear wrote:
> On 01/13/2017 02:08 PM, Stephen Hemminger wrote:
> >On Fri, 13 Jan 2017 11:50:32 -0800
> >Ben Greear <gree...@candelatech.com> wrote:
> >
> >>On 01/13/2017 11:41 AM, Stephen Hemminger wrote:
> >>>On Fri, 13 Jan 2017 11:12:32 -0800
> >>>Ben Greear <gree...@candelatech.com> wrote:
> >>>
> >>>>I am including netinet/ip.h, and also linux/if_tunnel.h, and the 
> >>>>linux/ip.h conflicts with
> >>>>netinet/ip.h.
> >>>>
> >>>>Maybe my build environment is screwed up, but maybe also it would be 
> >>>>better to
> >>>>just let the user include appropriate headers before including if_tunnel.h
> >>>>and revert this patch?
> >>>>
> >>>>
> >>>>include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and 
> >>>>linux/in6.h
> >>>>
> >>>> Fixes userspace compilation errors like:
> >>>>
> >>>> error: field ‘iph’ has incomplete type
> >>>> error: field ‘prefix’ has incomplete type
> >>>>
> >>>> Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> >>>> Signed-off-by: David S. Miller <da...@davemloft.net>
> >>>>
> >>>>Thanks,
> >>>>Ben
> >>>>
> >>>
> >>>What I ended up doing for iproute2 was including all headers used by the 
> >>>source
> >>>based on sanitized kernel headers.  Basically
> >>>  $ git grep '^#include  >>>   awk -F: '{print $2}' | \
> >>>   sed -e 's/^#include .*$//' | \
> >>>   sort -u >linux.headers
> >>>   $ for f in $(cat linux.headers)
> >>> do cp ~/kernel/net-next/usr/include/$f include/$f
> >>> done
> >>>
> >>>You can't take only some of the headers, once you decide to diverge from 
> >>>glibc provided
> >>>headers, you got to take them all.
> >>>
> >>
> >>I do grab a copy of the linux kernel headers and compile against that, but 
> >>netinet/ip.h is
> >>coming from the OS.  Do you mean I should not include netinet/ip.h and 
> >>instead use linux/ip.h?
> >
> >I don't think you can mix netinet/ip.h and linux/ip.h, yes that is a mess.
> >
> 
> Well, I still like the idea of reverting this patch..that way user-space does 
> not have to use
> linux/ip.h, and that lets them use netinet/ip.h and if_tunnel.h.

I might have patches for glibc compat for your case in
https://github.com/mcfrisk/linux/commits/headers_test_v06
if you include glibc headers first and then kernel uapi ones.

> Anyway, I'll let Dave and/or the original committer decideI've reverted 
> it in my local tree
> so I am able to build again...

My changes make uapi headers compile as they are in userspace. That exposes
problems like this for which user space has had workarounds for decades.
Sorry for that. The glibc compat fixes should help.

-Mikko

> Thanks,
> Ben
> 
> -- 
> Ben Greear <gree...@candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
> 


Re: [PATCH] Revert "include/uapi/linux/atm_zatm.h: include linux/time.h"

2016-11-11 Thread Mikko Rapeli
Hi,

On Thu, Nov 10, 2016 at 07:08:39PM -0500, Mike Frysinger wrote:
> This reverts commit cf00713a655d ("include/uapi/linux/atm_zatm.h: include
> linux/time.h").
> 
> This attempted to fix userspace breakage that no longer existed when
> the patch was merged.  Almost one year earlier, commit 70ba07b675b5
> ("atm: remove 'struct zatm_t_hist'") deleted the struct in question.

Acked-by: Mikko Rapeli <mikko.rap...@iki.fi>

Yep, sorry about this. My development branches are living for too long and
I should check each patch again before submitting. Simply rebasing is too easy.
Maybe Arnd could have spotted this earlier but scripts/get_maintainer.pl
didn't add him to Cc.

> After this patch was merged, we now have to deal with people being
> unable to include this header in conjunction with standard C library
> headers like stdlib.h (which linux-atm does).  Example breakage:
> x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I./../q2931 -I./../saal \
>   -I.  -DCPPFLAGS_TEST  -I../../src/include -O2 -march=native -pipe -g \
>   -frecord-gcc-switches -freport-bug -Wimplicit-function-declaration \
>   -Wnonnull -Wstrict-aliasing -Wparentheses -Warray-bounds \
>   -Wfree-nonheap-object -Wreturn-local-addr -fno-strict-aliasing -Wall \
>   -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -c zntune.c
> In file included from /usr/include/linux/atm_zatm.h:17:0,
>  from zntune.c:17:
> /usr/include/linux/time.h:9:8: error: redefinition of ‘struct timespec’
>  struct timespec {
> ^
> In file included from /usr/include/sys/select.h:43:0,
>  from /usr/include/sys/types.h:219,
>  from /usr/include/stdlib.h:314,
>  from zntune.c:9:
> /usr/include/time.h:120:8: note: originally defined here
>  struct timespec
> ^

Well, this would help with the linux/time.h and glibc time.h conflicts:

https://patchwork.kernel.org/patch/9294305/

if linux/time.h is included after .

Unfortunately I don't know when or if ever that will be applied.

-Mikko

> Signed-off-by: Mike Frysinger <vap...@gentoo.org>
> ---
>  include/uapi/linux/atm_zatm.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/include/uapi/linux/atm_zatm.h b/include/uapi/linux/atm_zatm.h
> index 5cd4d4d2dd1d..9c9c6ad55f14 100644
> --- a/include/uapi/linux/atm_zatm.h
> +++ b/include/uapi/linux/atm_zatm.h
> @@ -14,7 +14,6 @@
>  
>  #include 
>  #include 
> -#include 
>  
>  #define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
>   /* get pool statistics */
> -- 
> 2.9.0
> 


Re: linux/atm_zatm.h not really usable in userspace since cf00713a655d3019be7faa184402f16c43a0fed3

2016-10-15 Thread Mikko Rapeli
On Sat, Oct 15, 2016 at 03:33:22PM +0100, Pascal Terjan wrote:
> On 15 October 2016 at 15:09, Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> > On Sat, Oct 15, 2016 at 01:05:10PM +0100, Pascal Terjan wrote:
> >> It is no longer possible to include  + userspace
> >> headers using time, for example  , this broke for example
> >> the build of linux-atm.
> >>
> >> Reproducer:
> >>
> >> $ cat test.c
> >> #include 
> >> #include 
> >
> > If possible, please reverse the order of includes to first include glibc
> > headers and then Linux kernel uapi ones.
> 
> That was what I tried first but this didn't help:
> 
> In file included from /usr/include/linux/atm_zatm.h:17:0,
>  from test.c:2:
> /usr/include/linux/time.h:9:8: error: redefinition of 'struct timespec'
>  struct timespec {
> ^
> In file included from /usr/include/sys/select.h:43:0,
>  from /usr/include/sys/types.h:219,
>  from /usr/include/stdlib.h:314,
>  from test.c:1:
> /usr/include/time.h:120:8: note: originally defined here
>  struct timespec
> ^
> In file included from /usr/include/linux/atm_zatm.h:17:0,>  
> from test.c:2:
>  from test.c:2:
> /usr/include/linux/time.h:15:8: error: redefinition of 'struct timeval'
>  struct timeval {
> ^
> In file included from /usr/include/sys/select.h:45:0,
>  from /usr/include/sys/types.h:219,
>  from /usr/include/stdlib.h:314,
>  from test.c:1:
> /usr/include/bits/time.h:30:8: note: originally defined here
>  struct timeval
> ^
> > Kernel uapi headers did not declare their header file dependencies correctly
> > and I've been fixing them. I have also tried to fix compatibility issues
> > with glibc headers, but unfortunately they only work when glibc headers
> > are included before kernel headers. Userspace which has been relying on
> > the magic include order for various uapi headers is now unfortunately
> > affected. Sorry about that.
> 
> In this case no order works, it seems the kernel doesn't handle it in
> time.h unlike many other headers

Ok, then https://patchwork.kernel.org/patch/9294305/ hasn't been applied yet.
You can apply that or revert cf00713a655d3019be7faa184402f16c43a0fed3
for the time being.

It's a bit tricky to push through changes touching uapi headers for various
kernel sub systems since they may get applied at different order and time.

-Mikko


Re: linux/atm_zatm.h not really usable in userspace since cf00713a655d3019be7faa184402f16c43a0fed3

2016-10-15 Thread Mikko Rapeli
On Sat, Oct 15, 2016 at 01:05:10PM +0100, Pascal Terjan wrote:
> It is no longer possible to include  + userspace
> headers using time, for example  , this broke for example
> the build of linux-atm.
> 
> Reproducer:
> 
> $ cat test.c
> #include 
> #include 

If possible, please reverse the order of includes to first include glibc
headers and then Linux kernel uapi ones.

Kernel uapi headers did not declare their header file dependencies correctly
and I've been fixing them. I have also tried to fix compatibility issues
with glibc headers, but unfortunately they only work when glibc headers
are included before kernel headers. Userspace which has been relying on
the magic include order for various uapi headers is now unfortunately
affected. Sorry about that.

-Mikko

> $ gcc -c test.c
> In file included from /usr/include/sys/select.h:43:0,
>  from /usr/include/sys/types.h:219,
>  from /usr/include/stdlib.h:314,
>  from test.c:2:
> /usr/include/time.h:120:8: error: redefinition of 'struct timespec'
>  struct timespec
> ^
> In file included from /usr/include/linux/atm_zatm.h:17:0,
>  from test.c:1:
> /usr/include/linux/time.h:9:8: note: originally defined here
>  struct timespec {
> ^
> In file included from /usr/include/sys/select.h:45:0,
>  from /usr/include/sys/types.h:219,
>  from /usr/include/stdlib.h:314,
>  from test.c:2:
> /usr/include/bits/time.h:30:8: error: redefinition of 'struct timeval'
>  struct timeval
> ^
> In file included from /usr/include/linux/atm_zatm.h:17:0,
>  from test.c:1:
> /usr/include/linux/time.h:15:8: note: originally defined here
>  struct timeval {
> ^


Re: userspace build broken by include changes

2016-10-15 Thread Mikko Rapeli
Hi,

On Sat, Oct 15, 2016 at 12:40:43PM +0100, Pascal Terjan wrote:
> rp-pppoe plugin of ppp no longer builds:
> 
> In file included from pppoe.h:87:0,
>  from plugin.c:29:
> /usr/include/linux/in.h:28:3: error: redeclaration of enumerator 'IPPROTO_IP'
>IPPROTO_IP = 0,  /* Dummy protocol for TCP  */
>^
> /usr/include/netinet/in.h:42:5: note: previous definition of
> 'IPPROTO_IP' was here
>  IPPROTO_IP = 0,/* Dummy protocol for TCP.  */
> 
> Short reproducer:
> 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> 
> Full log:
> http://pkgsubmit.mageia.org/autobuild/cauldron/x86_64/core/2016-10-12/ppp-2.4.7-8.mga6.src.rpm/build.0.20161012185227.log
> 
> Moving the include of linux/if.h after netinet/in.h fixes it.
> 
> I guess the breakage is caused by
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux?id=eafe92114308acf14e45c6c3d154a5dad5523d1a
> but the commit doesn't look wrong to me.

These kernel uapi headers did not declare their dependencies correctly
and this patch fixed it. Many uapi headers from kernel unfortunately
conflict with glibc and other userspace headers, and userspace code is often
relying on this behavior, e.g. has had a working order of includes.

My patch series has compatibility changes so that kernel headers can be
included after glibc ones.

Unfortunately I haven't had time to provide similar patches to glibc so
things might breaks if kernel headers are included before glibc headers.

So the best I can do for now is to ask you to change the userspace include
order to first include glibc headers and then kernel uapi ones.

This is an unfortunate kernel header API break, sorry. ABI's are not affected
though.

-Mikko


Re: [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header file compatibility fixes

2016-08-23 Thread Mikko Rapeli
On Mon, Aug 22, 2016 at 04:32:51PM -0700, David Miller wrote:
> You have to post this properly to the netdev list.
> 
> If netdev is not CC:'d it doesn't get properly logged in patchwork,
> and won't be applied.

Sorry, get_maintainers.pl did not find netdev list for these patches.

Could you update MAINTAINERS so that networking stuff from include/linux/uapi/
finds netdev?

I could propose patches but they are bound to be incomplete so networking devs
could do this faster and with fewer review iterations.

This problem seems to be quite common though. Maybe the uapi split did not
update MAINTAINER file with include/uapi files.

-Mikko


[PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes

2016-08-23 Thread Mikko Rapeli
Fixes these userspace compile errors and warnings when glibc
netrose/rose.h is included before linux/rose.h:

linux/rose.h:25:0: warning: "SIOCRSGCAUSE" redefined
linux/rose.h:26:0: warning: "SIOCRSSCAUSE" redefined
linux/rose.h:27:0: warning: "SIOCRSL2CALL" redefined
linux/rose.h:28:0: warning: "SIOCRSSL2CALL" redefined
linux/rose.h:29:0: warning: "SIOCRSACCEPT" redefined
linux/rose.h:30:0: warning: "SIOCRSCLRRT" redefined
linux/rose.h:31:0: warning: "SIOCRSGL2CALL" redefined
linux/rose.h:32:0: warning: "SIOCRSGFACILITIES" redefined
linux/rose.h:47:3: error: conflicting types for ‘rose_address’
linux/rose.h:49:8: error: redefinition of ‘struct sockaddr_rose’
linux/rose.h:57:8: error: redefinition of ‘struct full_sockaddr_rose’
linux/rose.h:65:8: error: redefinition of ‘struct rose_route_struct’
linux/rose.h:74:8: error: redefinition of ‘struct rose_cause_struct’
linux/rose.h:79:8: error: redefinition of ‘struct rose_facilities_struct’

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/libc-compat.h | 30 ++
 include/uapi/linux/rose.h| 15 +++
 2 files changed, 45 insertions(+)

diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 01bb521..acc2e75 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -209,6 +209,27 @@
 
 #endif /* defined(__NETIPX_IPX_H) */
 
+/* Coordinate with glibc netrose/rose.h */
+#if defined(_NETROSE_ROSE_H)
+#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES   0
+#define __UAPI_DEF_ROSE_ADDRESS0
+#define __UAPI_DEF_SOCKADDR_ROSE   0
+#define __UAPI_DEF_FULL_SOCKADDR_ROSE  0
+#define __UAPI_DEF_ROSE_ROUTE_STRUCT   0
+#define __UAPI_DEF_ROSE_CAUSE_STRUCT   0
+#define __UAPI_DEF_ROSE_FACILITIES_STRUCT  0
+
+#else /* defined(_NETROSE_ROSE_H) */
+#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES   1
+#define __UAPI_DEF_ROSE_ADDRESS1
+#define __UAPI_DEF_SOCKADDR_ROSE   1
+#define __UAPI_DEF_FULL_SOCKADDR_ROSE  1
+#define __UAPI_DEF_ROSE_ROUTE_STRUCT   1
+#define __UAPI_DEF_ROSE_CAUSE_STRUCT   1
+#define __UAPI_DEF_ROSE_FACILITIES_STRUCT  1
+
+#endif /* defined(_NETROSE_ROSE_H) */
+
 /* Definitions for sys/uio.h */
 #if defined(_SYS_UIO_H)
 #define __UAPI_DEF_IOVEC   0
@@ -283,6 +304,15 @@
 #define __UAPI_DEF_IPX_CONFIG_DATA 1
 #define __UAPI_DEF_IPX_ROUTE_DEF   1
 
+/* Definitions for rose.h */
+#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES   1
+#define __UAPI_DEF_ROSE_ADDRESS1
+#define __UAPI_DEF_SOCKADDR_ROSE   1
+#define __UAPI_DEF_FULL_SOCKADDR_ROSE  1
+#define __UAPI_DEF_ROSE_ROUTE_STRUCT   1
+#define __UAPI_DEF_ROSE_CAUSE_STRUCT   1
+#define __UAPI_DEF_ROSE_FACILITIES_STRUCT  1
+
 /* Definitions for uio.h */
 #define __UAPI_DEF_IOVEC   1
 
diff --git a/include/uapi/linux/rose.h b/include/uapi/linux/rose.h
index 1fcfe95..c39499c 100644
--- a/include/uapi/linux/rose.h
+++ b/include/uapi/linux/rose.h
@@ -7,6 +7,7 @@
 #ifndefROSE_KERNEL_H
 #defineROSE_KERNEL_H
 
+#include 
 #include 
 #include 
 
@@ -22,6 +23,7 @@
 #defineROSE_QBITINCL   6
 #defineROSE_HOLDBACK   7
 
+#if __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES
 #defineSIOCRSGCAUSE(SIOCPROTOPRIVATE+0)
 #defineSIOCRSSCAUSE(SIOCPROTOPRIVATE+1)
 #defineSIOCRSL2CALL(SIOCPROTOPRIVATE+2)
@@ -30,6 +32,7 @@
 #defineSIOCRSCLRRT (SIOCPROTOPRIVATE+4)
 #defineSIOCRSGL2CALL   (SIOCPROTOPRIVATE+5)
 #defineSIOCRSGFACILITIES   (SIOCPROTOPRIVATE+6)
+#endif /* __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES */
 
 #defineROSE_DTE_ORIGINATED 0x00
 #defineROSE_NUMBER_BUSY0x01
@@ -42,10 +45,13 @@
 #defineROSE_LOCAL_PROCEDURE0x13
 #defineROSE_SHIP_ABSENT0x39
 
+#if __UAPI_DEF_ROSE_ADDRESS
 typedef struct {
charrose_addr[5];
 } rose_address;
+#endif /* __UAPI_DEF_ROSE_ADDRESS */
 
+#if __UAPI_DEF_SOCKADDR_ROSE
 struct sockaddr_rose {
__kernel_sa_family_t srose_family;
rose_addresssrose_addr;
@@ -53,7 +59,9 @@ struct sockaddr_rose {
int srose_ndigis;
ax25_addresssrose_digi;
 };
+#endif /* __UAPI_DEF_SOCKADDR_ROSE */
 
+#if __UAPI_DEF_FULL_SOCKADDR_ROSE
 struct full_sockaddr_rose {
__kernel_sa_family_t srose_family;
rose_addresssrose_addr;
@@ -61,7 +69,9 @@ struct full_sockaddr_rose {
unsigned intsrose_ndigis;
ax2

[PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes

2016-08-23 Thread Mikko Rapeli
Fixes these userspace compile error when glibc netax25/ax25.h is included
before linux/ax25.h:

linux/ax25.h:28:0: warning: "SIOCAX25GETUID" redefined
linux/ax25.h:38:0: warning: "SIOCAX25GETINFO" redefined
linux/ax25.h:47:3: error: conflicting types for ‘ax25_address’
linux/ax25.h:49:8: error: redefinition of ‘struct sockaddr_ax25’
linux/ax25.h:58:8: error: redefinition of ‘struct full_sockaddr_ax25’
linux/ax25.h:63:8: error: redefinition of ‘struct ax25_routes_struct’
linux/ax25.h:70:8: error: redefinition of ‘struct ax25_route_opt_struct’
linux/ax25.h:77:8: error: redefinition of ‘struct ax25_ctl_struct’
linux/ax25.h:98:8: error: redefinition of ‘struct ax25_info_struct’
linux/ax25.h:111:8: error: redefinition of ‘struct ax25_fwd_struct’

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/ax25.h| 22 +
 include/uapi/linux/libc-compat.h | 41 
 2 files changed, 63 insertions(+)

diff --git a/include/uapi/linux/ax25.h b/include/uapi/linux/ax25.h
index 74c89a4..e296c8a 100644
--- a/include/uapi/linux/ax25.h
+++ b/include/uapi/linux/ax25.h
@@ -6,6 +6,7 @@
 #ifndefAX25_KERNEL_H
 #defineAX25_KERNEL_H
 
+#include 
 #include 
 
 #define AX25_MTU   256
@@ -25,6 +26,7 @@
 
 #define AX25_KILL  99
 
+#if __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD
 #define SIOCAX25GETUID (SIOCPROTOPRIVATE+0)
 #define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1)
 #define SIOCAX25DELUID (SIOCPROTOPRIVATE+2)
@@ -34,46 +36,61 @@
 #define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9)
 #define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10)
 #define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11)
+#endif /* __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD */
 #define SIOCAX25DEVCTL  (SIOCPROTOPRIVATE+12)
+/* glibc uses SIOCPROTOPRIVATE+9 for SIOCAX25GETINFO */
+#if __UAPI_DEF_SIOCAX25GETINFO
 #define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13)
+#endif /* __UAPI_DEF_SIOCAX25GETINFO */
 
 #define AX25_SET_RT_IPMODE 2
 
 #define AX25_NOUID_DEFAULT 0
 #define AX25_NOUID_BLOCK   1
 
+#if __UAPI_DEF_AX25_ADDRESS
 typedef struct {
charax25_call[7];   /* 6 call + SSID (shifted ascii!) */
 } ax25_address;
+#endif /* __UAPI_DEF_AX25_ADDRESS */
 
+#if __UAPI_DEF_SOCKADDR_AX25
 struct sockaddr_ax25 {
__kernel_sa_family_t sax25_family;
ax25_addresssax25_call;
int sax25_ndigis;
/* Digipeater ax25_address sets follow */
 };
+#endif /* __UAPI_DEF_SOCKADDR_AX25 */
 
 #define sax25_uid  sax25_ndigis
 
+#if __UAPI_DEF_FULL_SOCKADDR_AX25
 struct full_sockaddr_ax25 {
struct sockaddr_ax25 fsa_ax25;
ax25_addressfsa_digipeater[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_FULL_SOCKADDR_AX25 */
 
+#if __UAPI_DEF_AX25_ROUTES_STRUCT
 struct ax25_routes_struct {
ax25_addressport_addr;
ax25_addressdest_addr;
unsigned char   digi_count;
ax25_addressdigi_addr[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_AX25_ROUTES_STRUCT */
 
+#if __UAPI_DEF_AX25_ROUTES_OPT_STRUCT
 struct ax25_route_opt_struct {
ax25_addressport_addr;
ax25_addressdest_addr;
int cmd;
int arg;
 };
+#endif /* __UAPI_DEF_AX25_ROUTES_OPT_STRUCT */
 
+#if __UAPI_DEF_AX25_CTL_STRUCT
 struct ax25_ctl_struct {
 ax25_addressport_addr;
 ax25_addresssource_addr;
@@ -83,6 +100,7 @@ struct ax25_ctl_struct {
 unsigned char   digi_count;
 ax25_addressdigi_addr[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_AX25_CTL_STRUCT */
 
 /* this will go away. Please do not export to user land */
 struct ax25_info_struct_deprecated {
@@ -95,6 +113,7 @@ struct ax25_info_struct_deprecated {
unsigned intrcv_q, snd_q;
 };
 
+#if __UAPI_DEF_AX25_INFO_STRUCT
 struct ax25_info_struct {
unsigned intn2, n2count;
unsigned intt1, t1timer;
@@ -107,10 +126,13 @@ struct ax25_info_struct {
unsigned intpaclen;
unsigned intwindow;
 };
+#endif /* __UAPI_DEF_AX25_INFO_STRUCT */
 
+#if __UAPI_DEF_AX25_FWD_STRUCT
 struct ax25_fwd_struct {
ax25_addressport_from;
ax25_addressport_to;
 };
+#endif /* __UAPI_DEF_AX25_FWD_STRUCT */
 
 #endif
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index f793b09..01bb521 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -100,6 +100,35 @@
 
 #endif /* _NET_IF_H */
 
+/* Coordinate with glibc netax25/ax25.h header. */
+#if defined(_NETAX25_AX25_H)
+
+#define __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD0
+#define __UAPI_DEF_SIOCAX25GETINFO 0
+#define __UAPI_DEF_AX25_ADDRESS0
+#define __UAPI_DEF_SOCKADDR_AX25   0
+#define __UAPI_DEF_FULL_SOCKADDR_AX25  

[PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header file compatibility fixes

2016-08-23 Thread Mikko Rapeli
Fixes this userspace compile error when glibc netinet/ip_icmp.h is included
before linux/icmp.h:

linux/icmp.h:68:8: error: redefinition of ‘struct icmphdr’

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/icmp.h|  4 +++-
 include/uapi/linux/libc-compat.h | 10 ++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/icmp.h b/include/uapi/linux/icmp.h
index fddd9d7..cd38005 100644
--- a/include/uapi/linux/icmp.h
+++ b/include/uapi/linux/icmp.h
@@ -17,6 +17,7 @@
 #ifndef _UAPI_LINUX_ICMP_H
 #define _UAPI_LINUX_ICMP_H
 
+#include 
 #include 
 
 #define ICMP_ECHOREPLY 0   /* Echo Reply   */
@@ -64,7 +65,7 @@
 #define ICMP_EXC_TTL   0   /* TTL count exceeded   */
 #define ICMP_EXC_FRAGTIME  1   /* Fragment Reass time exceeded */
 
-
+#if __UAPI_DEF_ICMPHDR
 struct icmphdr {
   __u8 type;
   __u8 code;
@@ -82,6 +83,7 @@ struct icmphdr {
__u8reserved[4];
   } un;
 };
+#endif /* __UAPI_DEF_ICMPHDR */
 
 
 /*
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 40190a4..8a5a7cc 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -154,6 +154,13 @@
 
 #endif /* _NETINET_IN_H */
 
+/* Coordinate with glibc netinet/ip_icmp.h header. */
+#if defined(__NETINET_IP_ICMP_H)
+#define __UAPI_DEF_ICMPHDR 0
+#else /* defined(__NETINET_IP_ICMP_H) */
+#define __UAPI_DEF_ICMPHDR 1
+#endif /* defined(__NETINET_IP_ICMP_H) */
+
 /* Coordinate with glibc netipx/ipx.h header. */
 #if defined(__NETIPX_IPX_H)
 
@@ -218,6 +225,9 @@
 #define __UAPI_DEF_IN6_PKTINFO 1
 #define __UAPI_DEF_IP6_MTUINFO 1
 
+/* Definitions for icmp.h */
+#define __UAPI_DEF_ICMPHDR 1
+
 /* Definitions for ipx.h */
 #define __UAPI_DEF_SOCKADDR_IPX1
 #define __UAPI_DEF_IPX_ROUTE_DEFINITION1
-- 
2.8.1



[PATCH v05 72/72] uapi route.h: glibc net/route.h compat fix

2016-08-23 Thread Mikko Rapeli
Fixes this userspace compile error when net/route.h is included before
linux/route.h:

linux/route.h:30:8: error: redefinition of ‘struct rtentry’

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/libc-compat.h | 10 ++
 include/uapi/linux/route.h   |  4 +++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 07a3462..16ba7dc 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -230,6 +230,13 @@
 
 #endif /* defined(_NETROSE_ROSE_H) */
 
+/* Coordinate with glibc net/route.h */
+#if defined(_NET_ROUTE_H)
+#define __UAPI_DEF_RTENTRY 0
+#else /* defined(_NET_ROUTE_H) */
+#define __UAPI_DEF_RTENTRY 1
+#endif /* defined(_NET_ROUTE_H) */
+
 /* Coordinate with glibc pty.h */
 #if defined(_PTY_H)
 #define __UAPI_DEF_TERMIOS 0
@@ -369,6 +376,9 @@
 #define __UAPI_DEF_ROSE_CAUSE_STRUCT   1
 #define __UAPI_DEF_ROSE_FACILITIES_STRUCT  1
 
+/* Definitions for route.h */
+#define __UAPI_DEF_RTENTRY 1
+
 /* Definitions for time.h */
 #define __UAPI_DEF_TIMESPEC1
 #define __UAPI_DEF_TIMEVAL 1
diff --git a/include/uapi/linux/route.h b/include/uapi/linux/route.h
index 6600708..7b77ef2 100644
--- a/include/uapi/linux/route.h
+++ b/include/uapi/linux/route.h
@@ -23,10 +23,12 @@
 #ifndef _LINUX_ROUTE_H
 #define _LINUX_ROUTE_H
 
+#include 
 #include 
 #include 
 
 /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */
+#if __UAPI_DEF_RTENTRY
 struct rtentry {
unsigned long   rt_pad1;
struct sockaddr rt_dst; /* target address   */
@@ -45,7 +47,7 @@ struct rtentry {
unsigned long   rt_window;  /* Window clamping  */
unsigned short  rt_irtt;/* Initial RTT  */
 };
-
+#endif /* __UAPI_DEF_RTENTRY */
 
 #defineRTF_UP  0x0001  /* route usable 
*/
 #defineRTF_GATEWAY 0x0002  /* destination is a gateway 
*/
-- 
2.8.1



Re: [PATCH v05 38/72] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h

2016-08-23 Thread Mikko Rapeli
On Mon, Aug 22, 2016 at 12:39:38PM -0700, Stephen Hemminger wrote:
> On Mon, 22 Aug 2016 20:32:55 +0200
> Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> 
> > Fixes userspace compiler error:
> > 
> > error: unknown type name ‘uint32_t’
> > 
> > Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> > ---
> >  include/uapi/linux/openvswitch.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/uapi/linux/openvswitch.h 
> > b/include/uapi/linux/openvswitch.h
> > index d95a301..645499a 100644
> > --- a/include/uapi/linux/openvswitch.h
> > +++ b/include/uapi/linux/openvswitch.h
> > @@ -632,8 +632,8 @@ enum ovs_hash_alg {
> >   * @hash_basis: basis used for computing hash.
> >   */
> >  struct ovs_action_hash {
> > -   uint32_t  hash_alg; /* One of ovs_hash_alg. */
> > -   uint32_t  hash_basis;
> > +   __u32  hash_alg; /* One of ovs_hash_alg. */
> > +   __u32  hash_basis;
> >  };
> >  
> >  /**
> 
> This is a a real issue, but being buried in a huge patch series of include
> file stuff I don't think anyone would see it.

The mechanism for finding this issue the same as finding a missing header file
dependency: the uapi header userspace compile test.

https://lkml.org/lkml/2016/8/22/659

I'm using "scripts/get_maintainers.pl --no-rolestats" to fill in the Cc: list
for git send-email so if MAINTAINERS is uptodate, then correct lists and
maintainers should have the received the patches.

-Mikko


Re: [PATCH v05 21/72] include/uapi/linux/if_pppox.h: include linux/if.h

2016-08-23 Thread Mikko Rapeli
On Mon, Aug 22, 2016 at 12:37:45PM -0700, Stephen Hemminger wrote:
> On Mon, 22 Aug 2016 20:32:38 +0200
> Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> 
> > Fixes userspace compilation error:
> > 
> > error: ‘IFNAMSIZ’ undeclared here (not in a function)
> > 
> > Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> > ---
> >  include/uapi/linux/if_pppox.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
> > index e128769..473c3c4 100644
> > --- a/include/uapi/linux/if_pppox.h
> > +++ b/include/uapi/linux/if_pppox.h
> > @@ -21,6 +21,7 @@
> >  #include 
> >  
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  
> 
> I went back to the first patch in LKML for this series.
> It seems your goal is that every include file should be standalone,
> i.e it must include every definition it uses.
> 
> I disagree with this premise. It just makes things harder to maintain with
> no real gain for any existing program.  What is the motivation for all this
> useless churn? Is there some silly style rule that should be fixed instead?

With over 700 uapi headers exported to userspace by Linux kernel, how
do I find out the 'correct' order of including them if they can not be
included alone? Any hints on automating that?

My first trial was to include all of the uapi headers as a single bunch to
abi checker tool which calls gcc on them, but the compilation result was
so bad and hopeless that I decided to try feeding each header file one by
one to the compiler and here I am over two years later still fixing these
issues.

I came up with the rule because to me it makes sense. Several kernel
devs agree with this approach and have accepted patches.

If your kernel subsystem uapi headers have a single entry point header file,
then all of the others can just depend on that and be done with it.
For example most (if not all) drm driver specific headers include .

-Mikko


[PATCH v05 22/72] include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and linux/in6.h

2016-08-22 Thread Mikko Rapeli
Fixes userspace compilation errors like:

error: field ‘iph’ has incomplete type
error: field ‘prefix’ has incomplete type

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if_tunnel.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 1046f55..777b6cd 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -2,6 +2,9 @@
 #define _UAPI_IF_TUNNEL_H_
 
 #include 
+#include 
+#include 
+#include 
 #include 
 
 
-- 
2.8.1



[PATCH v05 64/72] include/uapi/linux/ipx.h: fix conflicting defitions with glibc netipx/ipx.h

2016-08-22 Thread Mikko Rapeli
Fixes these compiler warnings via libc-compat.h when glibc netipx/ipx.h is
included before linux/ipx.h:

./linux/ipx.h:9:8: error: redefinition of ‘struct sockaddr_ipx’
./linux/ipx.h:26:8: error: redefinition of ‘struct ipx_route_definition’
./linux/ipx.h:32:8: error: redefinition of ‘struct ipx_interface_definition’
./linux/ipx.h:49:8: error: redefinition of ‘struct ipx_config_data’
./linux/ipx.h:58:8: error: redefinition of ‘struct ipx_route_def’

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/ipx.h | 13 -
 include/uapi/linux/libc-compat.h | 26 ++
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/ipx.h b/include/uapi/linux/ipx.h
index 3d48014..30f031d 100644
--- a/include/uapi/linux/ipx.h
+++ b/include/uapi/linux/ipx.h
@@ -1,11 +1,13 @@
 #ifndef _IPX_H_
 #define _IPX_H_
+#include  /* for compatibility with glibc netipx/ipx.h */
 #include 
 #include 
 #include 
 #define IPX_NODE_LEN   6
 #define IPX_MTU576
 
+#if __UAPI_DEF_SOCKADDR_IPX
 struct sockaddr_ipx {
__kernel_sa_family_t sipx_family;
__be16  sipx_port;
@@ -14,6 +16,7 @@ struct sockaddr_ipx {
__u8sipx_type;
unsigned char   sipx_zero;  /* 16 byte fill */
 };
+#endif /* __UAPI_DEF_SOCKADDR_IPX */
 
 /*
  * So we can fit the extra info for SIOCSIFADDR into the address nicely
@@ -23,12 +26,15 @@ struct sockaddr_ipx {
 #define IPX_DLTITF 0
 #define IPX_CRTITF 1
 
+#if __UAPI_DEF_IPX_ROUTE_DEFINITION
 struct ipx_route_definition {
__be32ipx_network;
__be32ipx_router_network;
unsigned char ipx_router_node[IPX_NODE_LEN];
 };
+#endif /* __UAPI_DEF_IPX_ROUTE_DEFINITION */
 
+#if __UAPI_DEF_IPX_INTERFACE_DEFINITION
 struct ipx_interface_definition {
__be32ipx_network;
unsigned char ipx_device[16];
@@ -45,16 +51,20 @@ struct ipx_interface_definition {
 #define IPX_INTERNAL   2
unsigned char ipx_node[IPX_NODE_LEN];
 };
-   
+#endif /* __UAPI_DEF_IPX_INTERFACE_DEFINITION */
+
+#if __UAPI_DEF_IPX_CONFIG_DATA
 struct ipx_config_data {
unsigned char   ipxcfg_auto_select_primary;
unsigned char   ipxcfg_auto_create_interfaces;
 };
+#endif /* __UAPI_DEF_IPX_CONFIG_DATA */
 
 /*
  * OLD Route Definition for backward compatibility.
  */
 
+#if __UAPI_DEF_IPX_ROUTE_DEF
 struct ipx_route_def {
__be32  ipx_network;
__be32  ipx_router_network;
@@ -67,6 +77,7 @@ struct ipx_route_def {
 #define IPX_RT_BLUEBOOK2
 #define IPX_RT_ROUTED  1
 };
+#endif /* __UAPI_DEF_IPX_ROUTE_DEF */
 
 #define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
 #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1)
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index e4f048e..44b8a6b 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -139,6 +139,25 @@
 
 #endif /* _NETINET_IN_H */
 
+/* Coordinate with glibc netipx/ipx.h header. */
+#if defined(__NETIPX_IPX_H)
+
+#define __UAPI_DEF_SOCKADDR_IPX0
+#define __UAPI_DEF_IPX_ROUTE_DEFINITION0
+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION0
+#define __UAPI_DEF_IPX_CONFIG_DATA 0
+#define __UAPI_DEF_IPX_ROUTE_DEF   0
+
+#else /* defined(__NETIPX_IPX_H) */
+
+#define __UAPI_DEF_SOCKADDR_IPX1
+#define __UAPI_DEF_IPX_ROUTE_DEFINITION1
+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION1
+#define __UAPI_DEF_IPX_CONFIG_DATA 1
+#define __UAPI_DEF_IPX_ROUTE_DEF   1
+
+#endif /* defined(__NETIPX_IPX_H) */
+
 /* Definitions for xattr.h */
 #if defined(_SYS_XATTR_H)
 #define __UAPI_DEF_XATTR   0
@@ -179,6 +198,13 @@
 #define __UAPI_DEF_IN6_PKTINFO 1
 #define __UAPI_DEF_IP6_MTUINFO 1
 
+/* Definitions for ipx.h */
+#define __UAPI_DEF_SOCKADDR_IPX1
+#define __UAPI_DEF_IPX_ROUTE_DEFINITION1
+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION1
+#define __UAPI_DEF_IPX_CONFIG_DATA 1
+#define __UAPI_DEF_IPX_ROUTE_DEF   1
+
 /* Definitions for xattr.h */
 #define __UAPI_DEF_XATTR   1
 
-- 
2.8.1



[PATCH v05 21/72] include/uapi/linux/if_pppox.h: include linux/if.h

2016-08-22 Thread Mikko Rapeli
Fixes userspace compilation error:

error: ‘IFNAMSIZ’ undeclared here (not in a function)

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if_pppox.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index e128769..473c3c4 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -21,6 +21,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
-- 
2.8.1



[PATCH v05 62/72] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h

2016-08-22 Thread Mikko Rapeli
Kernel uapi header are supposed to use them. Fixes userspace compile error:

linux/openvswitch.h:583:2: error: unknown type name ‘uint32_t’

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/openvswitch.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 645499a..54c3b4f 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -583,7 +583,7 @@ enum ovs_userspace_attr {
 #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
 
 struct ovs_action_trunc {
-   uint32_t max_len; /* Max packet size in bytes. */
+   __u32 max_len; /* Max packet size in bytes. */
 };
 
 /**
-- 
2.8.1



[PATCH v05 25/72] include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h

2016-08-22 Thread Mikko Rapeli
Fixes userspace compilation errors like:

error: field ‘addr’ has incomplete type
 struct sockaddr_in addr; /* IP address and port to send to */
^
error: field ‘addr’ has incomplete type
 struct sockaddr_in6 addr; /* IP address and port to send to */

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if_pppol2tp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_pppol2tp.h b/include/uapi/linux/if_pppol2tp.h
index 163e8ad..4bd1f55 100644
--- a/include/uapi/linux/if_pppol2tp.h
+++ b/include/uapi/linux/if_pppol2tp.h
@@ -16,7 +16,8 @@
 #define _UAPI__LINUX_IF_PPPOL2TP_H
 
 #include 
-
+#include 
+#include 
 
 /* Structure used to connect() the socket to a particular tunnel UDP
  * socket over IPv4.
-- 
2.8.1



[PATCH v05 26/72] include/uapi/linux/if_pppox.h: include linux/in.h and linux/in6.h

2016-08-22 Thread Mikko Rapeli
Fixes userspace compilation errors:

error: field ‘addr’ has incomplete type
 struct sockaddr_in addr; /* IP address and port to send to */

error: field ‘addr’ has incomplete type
 struct sockaddr_in6 addr; /* IP address and port to send to */

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if_pppox.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index 473c3c4..d37bbb1 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -24,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /* For user-space programs to pick up these definitions
  * which they wouldn't get otherwise without defining __KERNEL__
-- 
2.8.1



[PATCH v05 38/72] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h

2016-08-22 Thread Mikko Rapeli
Fixes userspace compiler error:

error: unknown type name ‘uint32_t’

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/openvswitch.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index d95a301..645499a 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -632,8 +632,8 @@ enum ovs_hash_alg {
  * @hash_basis: basis used for computing hash.
  */
 struct ovs_action_hash {
-   uint32_t  hash_alg; /* One of ovs_hash_alg. */
-   uint32_t  hash_basis;
+   __u32  hash_alg; /* One of ovs_hash_alg. */
+   __u32  hash_basis;
 };
 
 /**
-- 
2.8.1



[PATCH v05 41/72] include/uapi/linux/atm_zatm.h: include linux/time.h

2016-08-22 Thread Mikko Rapeli
Fixes userspace compile error:

error: field ‘real’ has incomplete type
 struct timeval real;  /* real (wall-clock) time */

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/atm_zatm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/atm_zatm.h b/include/uapi/linux/atm_zatm.h
index 9c9c6ad..5cd4d4d 100644
--- a/include/uapi/linux/atm_zatm.h
+++ b/include/uapi/linux/atm_zatm.h
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 #define ZATM_GETPOOL   _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
/* get pool statistics */
-- 
2.8.1



Re: [PATCH net] uapi glibc compat: fix compilation when !__USE_MISC in glibc

2016-05-21 Thread Mikko Rapeli
On Thu, May 19, 2016 at 05:26:29PM +0200, Nicolas Dichtel wrote:
> These structures are defined only if __USE_MISC is set in glibc net/if.h
> headers, ie when _BSD_SOURCE or _SVID_SOURCE are defined.

Also, reading /usr/include/features.h from Debian glibc 2.22-4:

...
   The `-ansi' switch to the GNU C compiler, and standards conformance
   options such as `-std=c99', define __STRICT_ANSI__.  If none of
   these are defined, or if _DEFAULT_SOURCE is defined, the default is
   to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
   200809L, as well as enabling miscellaneous functions from BSD and
   SVID.  If more than one of these are defined, they accumulate.  For
   example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
   give you ISO C, 1003.1, and 1003.2, but nothing else.
...
/* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
   _DEFAULT_SOURCE.
...

In the compile test I go with the defaults. I guess I should test all
of these feature variants and in the future check deeper into the glibc
ifdefs.

> CC: Jan Engelhardt <jeng...@inai.de>
> CC: Josh Boyer <jwbo...@fedoraproject.org>
> CC: Stephen Hemminger <shemm...@brocade.com>
> CC: Waldemar Brodkorb <m...@waldemar-brodkorb.de>
> CC: Gabriel Laskar <gabr...@lse.epita.fr>
> CC: Mikko Rapeli <mikko.rap...@iki.fi>
> Fixes: 4a91cb61bb99 ("uapi glibc compat: fix compile errors when glibc 
> net/if.h included before linux/if.h")
> Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>

> ---
>  include/uapi/linux/libc-compat.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/libc-compat.h 
> b/include/uapi/linux/libc-compat.h
> index d5e38c73377c..e4f048ee7043 100644
> --- a/include/uapi/linux/libc-compat.h
> +++ b/include/uapi/linux/libc-compat.h
> @@ -52,7 +52,7 @@
>  #if defined(__GLIBC__)
>  
>  /* Coordinate with glibc net/if.h header. */
> -#if defined(_NET_IF_H)
> +#if defined(_NET_IF_H) && defined(__USE_MISC)
>  
>  /* GLIBC headers included first so don't define anything
>   * that would already be defined. */
> -- 
> 2.8.1
> 


Re: [PATCH v2] uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h

2016-05-09 Thread Mikko Rapeli
On Mon, May 09, 2016 at 11:35:35PM +0200, Pablo Neira Ayuso wrote:
> It seems linux-netdev was not Cc'ed. I cannot find this in David's
> patchwork [1].
> 
> @Mikko: Could you resubmit including netdev@vger.kernel.org? Thanks.

Done: http://patchwork.ozlabs.org/patch/620262/

-Mikko


[PATCH v2] uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h

2016-05-09 Thread Mikko Rapeli
glibc's net/if.h contains copies of definitions from linux/if.h and these
conflict and cause build failures if both files are included by application
source code. Changes in uapi headers, which fixed header file dependencies to
include linux/if.h when it was needed, e.g. commit 1ffad83d, made the
net/if.h and linux/if.h incompatibilities visible as build failures for
userspace applications like iproute2 and xtables-addons.

This patch fixes compile errors when glibc net/if.h is included before
linux/if.h:

./linux/if.h:99:21: error: redeclaration of enumerator ‘IFF_NOARP’
./linux/if.h:98:23: error: redeclaration of enumerator ‘IFF_RUNNING’
./linux/if.h:97:26: error: redeclaration of enumerator ‘IFF_NOTRAILERS’
./linux/if.h:96:27: error: redeclaration of enumerator ‘IFF_POINTOPOINT’
./linux/if.h:95:24: error: redeclaration of enumerator ‘IFF_LOOPBACK’
./linux/if.h:94:21: error: redeclaration of enumerator ‘IFF_DEBUG’
./linux/if.h:93:25: error: redeclaration of enumerator ‘IFF_BROADCAST’
./linux/if.h:92:19: error: redeclaration of enumerator ‘IFF_UP’
./linux/if.h:252:8: error: redefinition of ‘struct ifconf’
./linux/if.h:203:8: error: redefinition of ‘struct ifreq’
./linux/if.h:169:8: error: redefinition of ‘struct ifmap’
./linux/if.h:107:23: error: redeclaration of enumerator ‘IFF_DYNAMIC’
./linux/if.h:106:25: error: redeclaration of enumerator ‘IFF_AUTOMEDIA’
./linux/if.h:105:23: error: redeclaration of enumerator ‘IFF_PORTSEL’
./linux/if.h:104:25: error: redeclaration of enumerator ‘IFF_MULTICAST’
./linux/if.h:103:21: error: redeclaration of enumerator ‘IFF_SLAVE’
./linux/if.h:102:22: error: redeclaration of enumerator ‘IFF_MASTER’
./linux/if.h:101:24: error: redeclaration of enumerator ‘IFF_ALLMULTI’
./linux/if.h:100:23: error: redeclaration of enumerator ‘IFF_PROMISC’

The cases where linux/if.h is included before net/if.h need a similar fix in
the glibc side, or the order of include files can be changed userspace
code as a workaround.

This change was tested in x86 userspace on Debian unstable with
scripts/headers_compile_test.sh:

$ make headers_install && \
  cd usr/include && ../../scripts/headers_compile_test.sh -l -k
...
cc -Wall -c -nostdinc -I /usr/lib/gcc/i586-linux-gnu/5/include -I 
/usr/lib/gcc/i586-linux-gnu/5/include-fixed -I . -I 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.2uX2zH -I 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.2uX2zH/i586-linux-gnu
 -o /dev/null ./linux/if.h_libc_before_kernel.h
PASSED libc before kernel test: ./linux/if.h

Reported-by: Jan Engelhardt <jeng...@inai.de>
Reported-by: Josh Boyer <jwbo...@fedoraproject.org>
Reported-by: Stephen Hemminger <shemm...@brocade.com>
Reported-by: Waldemar Brodkorb <m...@waldemar-brodkorb.de>
Cc: Gabriel Laskar <gabr...@lse.epita.fr>
Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if.h  | 28 +
 include/uapi/linux/libc-compat.h | 44 
 2 files changed, 72 insertions(+)

v1:
http://marc.info/?l=linux-kernel=145485386721798=2

v2:
Added handling for net_device_flags IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO
which are unknown to glibc as suggested by David Miller in
http://marc.info/?l=linux-kernel=145650410726228=2

diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index f802775..e601c8c 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -19,14 +19,20 @@
 #ifndef _LINUX_IF_H
 #define _LINUX_IF_H
 
+#include   /* for compatibility with glibc */
 #include/* for "__kernel_caddr_t" et al */
 #include   /* for "struct sockaddr" et al  */
 #include /* for "__user" et al   */
 
+#if __UAPI_DEF_IF_IFNAMSIZ
 #defineIFNAMSIZ16
+#endif /* __UAPI_DEF_IF_IFNAMSIZ */
 #defineIFALIASZ256
 #include 
 
+/* For glibc compatibility. An empty enum does not compile. */
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 && \
+__UAPI_DEF_IF_NET_DEVICE_FLAGS != 0
 /**
  * enum net_device_flags -  net_device flags
  *
@@ -68,6 +74,8 @@
  * @IFF_ECHO: echo sent packets. Volatile.
  */
 enum net_device_flags {
+/* for compatibility with glibc net/if.h */
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
IFF_UP  = 1<<0,  /* sysfs */
IFF_BROADCAST   = 1<<1,  /* volatile */
IFF_DEBUG   = 1<<2,  /* sysfs */
@@ -84,11 +92,17 @@ enum net_device_flags {
IFF_PORTSEL = 1<<13, /* sysfs */
IFF_AUTOMEDIA   = 1<<14, /* sysfs */
IFF_DYNAMIC = 1<<15, /* sysfs */
+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
IFF_LOWER_UP= 1<<16, /* volatile */
   

Re: [PATCH] uapi glibc compat: fix cases where glibc net/if.h is included before linux/if.h

2016-02-25 Thread Mikko Rapeli
(Adding libc-alpha list, review of https://lkml.org/lkml/2016/2/7/89 )

On Wed, Feb 17, 2016 at 10:46:20AM -0500, David Miller wrote:
> From: Mikko Rapeli <mikko.rap...@iki.fi>
> Date: Sun,  7 Feb 2016 16:03:21 +0200
> 
> > @@ -68,6 +72,8 @@
> >   * @IFF_ECHO: echo sent packets. Volatile.
> >   */
> >  enum net_device_flags {
> > +/* for compatibility with glibc net/if.h */
> > +#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
> > IFF_UP  = 1<<0,  /* sysfs */
> > IFF_BROADCAST   = 1<<1,  /* volatile */
> > IFF_DEBUG   = 1<<2,  /* sysfs */
> > @@ -84,11 +90,14 @@ enum net_device_flags {
> > IFF_PORTSEL = 1<<13, /* sysfs */
> > IFF_AUTOMEDIA   = 1<<14, /* sysfs */
> > IFF_DYNAMIC = 1<<15, /* sysfs */
> > +#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */
> > IFF_LOWER_UP= 1<<16, /* volatile */
> > IFF_DORMANT = 1<<17, /* volatile */
> > IFF_ECHO= 1<<18, /* volatile */
> >  };
> 
> This is going to get messy is IFF_LOWER_UP, IFF_DORMANT, and IFF_ECHO
> get added the the glibc header.  Why not just handle it now with
> another __UAPI_DEF_FOO guard so that the additions to net/if.h can
> deal with this case too.

Do you mean that the enum should be protected with a single guard or
should I have one guard for current conflicts and one for the future
if glibc headers include IFF_LOWER_UP and others?

-Mikko


Re: header conflict introduced by change to netfilter_ipv4/ip_tables.h

2016-02-25 Thread Mikko Rapeli
On Thu, Feb 25, 2016 at 10:08:56PM +0100, Thomas Graf wrote:
> On 01/06/16 at 09:20am, Stephen Hemminger wrote:
> > This commit breaks compilation of iproute2 with net-next.
> > 
> > commit 1ffad83dffd675cd742286ae82dca7d746cb0da8
> > Author: Mikko Rapeli <mikko.rap...@iki.fi>
> > Date:   Thu Oct 15 07:56:30 2015 +0200
> > 
> > netfilter: fix include files for compilation
> > 
> > Add missing header dependencies and other small changes so that each 
> > file
> >     compiles alone in userspace.
> > 
> > Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> > Signed-off-by: Pablo Neira Ayuso <pa...@netfilter.org>
> > 
> > For iproute2, a copy of kernel headers (from make install_headers) is used.
> > After this change. the build of x_tables.c fails because IFNAMSIZ is already
> > defined in net/if.h
> 
> There is another issue with this commit. iptables.h included from m_ipt.c
> includes  xtables.h which includes  which is not
> available on a system without xtables.
> 
> gcc -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations 
> -Wold-style-definition -Wformat=2 -O2 -I../include -DRESOLVE_HOSTNAMES 
> -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE 
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  
> -DHAVE_SETNS -DHAVE_ELF -DCONFIG_GACT -DCONFIG_GACT_PROB 
> -DIPT_LIB_DIR=\"/lib/xtables\" -DYY_NO_INPUT   -c -o m_ipt.o m_ipt.c
> In file included from ../include/iptables.h:5:0,
>  from m_ipt.c:17:
> ../include/xtables.h:34:29: fatal error: xtables-version.h: No such file or 
> directory
>  #include 

I don't see any dependencies from kernel side uapi headers to iptables or
xtables in my tree based on v4.5-rc2. Maybe this is a problem in
iproute2.

-Mikko


Re: header conflict introduced by change to netfilter_ipv4/ip_tables.h

2016-02-25 Thread Mikko Rapeli
On Thu, Feb 25, 2016 at 09:53:32PM +0100, Daniel Borkmann wrote:
> On 02/04/2016 08:13 AM, Josh Boyer wrote:
> >On Thu, Jan 7, 2016 at 2:15 PM, Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> >>On Thu, Jan 07, 2016 at 10:30:40AM -0800, Stephen Hemminger wrote:
> >>>On Thu, 7 Jan 2016 07:29:50 +
> >>>Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> >>>>On Wed, Jan 06, 2016 at 09:20:07AM -0800, Stephen Hemminger wrote:
> >>>>>This commit breaks compilation of iproute2 with net-next.
> >>>>
> >>>>Ok, linux/if.h and libc net/if.h have overlapping defines, and this is not
> >>>>the only one. I saw lots of them in the core dump headers.
> >>>>
> >>>>How should we handle them? Another ifndef for IFNAMSIZ into kernel uapi
> >>>>headers?
> >>>>
> >>>>-Mikko
> >>>
> >>>Probably need to do the same thing that was done previously for these
> >>>kind of conflicts.  This makes make linux/if.h change to adapt to net/if.h
> >>>being included before it.
> >>
> >>Ok, got it. And found include/uapi/linux/libc-compat.h. Did not know about 
> >>it
> >>and was looking for solutions to these problems.
> >>
> >>But now I feel like writing a test script for mixing of kernel uapi
> >>and libc headers to find out how many other collitions are still there.
> >>Not good for the pile of over 70 patches in my branch
> >>https://github.com/torvalds/linux/compare/master...mcfrisk:headers_test_v05
> >>
> >>>Or revert your patch.
> >>
> >>I'm fine with this too.
> >
> >This is causing a number of build failures in Fedora rawhide now.  Did
> >anyone submit a revert or patch to fix this issue?
> 
> Mikko, was there any follow-up patch to fix this? Seems like the build
> error is not yet resolved.

First draft of proper fix:

https://lkml.org/lkml/2016/2/7/89

Will fix review comments from David Miller soon and I need to figure out
how to get the needed fixes to the glibc side too.

The problem from my point of view is that kernel uapi header files have
incomplete dependencies, which were hiding kernel uapi and glibc header file
conflicts.

I will try to systematically fix the kernel uapi and glibc header conflicts
but this will take some time. If you want, you can hide the problem
by reverting the needed header file dependency fixes.

-Mikko


[PATCH] uapi glibc compat: fix cases where glibc net/if.h is included before linux/if.h

2016-02-07 Thread Mikko Rapeli
glibc's net/if.h contains copies of definitions from linux/if.h and these
conflict and cause build failures if both files are included by application
source code. Changes in uapi headers, which fixed header file dependencies to
include linux/if.h when it was needed, made the net/if.h and linux/if.h
incompatibilities visible as build failures for userspace applications
like iproute2.

This patch fixes the cases where glibc net/if.h is included before linux/if.h
by using the linux/libc-compat.h approach.

The cases where linux/if.h is included before net/if.h need a similar fix in
the glibc side, or the order of include files can be changed userspace
code as a workaround.

This change was tested in x86 userspace after 'make headers_install' and
combining these headers with plain glibc and gcc headers. The test included
not just net/if.h but all compiling glibc headers with linux/if.h and it
compiles now without errors and warnings.

 $ cat usr/libc_conflict_test/libc_headers.h
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 //these conflict with each other
 // #include 
 // #include 
 // #include 
 // #include 
 // #include 
 // #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include <_G_config.h>
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 // conflicts with arap headers
 //#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 // conflicts with arpa headers
 //#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 

 $ cat iproute2_bug.h
 #include 
 #include 

 $ cc -Wall -c -nostdinc -I ../include/ -I 
/usr/lib/gcc/i586-linux-gnu/5/include -I 
/usr/lib/gcc/i586-linux-gnu/5/include-fixed -I . -I 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.ddxtNf -I 
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.ddxtNf/i586-linux-gnu
 -o /dev/null ./iproute2_bug.h

Reported-by: Stephen Hemminger <shemm...@brocade.com>
Reported-by: Josh Boyer <jwbo...@fedoraproject.org>
Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if.h  | 21 +
 include/uapi/linux/libc-compat.h | 33 +
 2 files changed, 54 insertions(+)

diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 9cf2394..5a07a67 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -19,11 +19,15 @@
 #ifndef _LINUX_IF_H
 #define _LINUX_IF_H
 
+#include   /* for compatibility with glibc */
 #include/* for "__kernel_caddr_t" et al */
 #include   /* for "struct sockaddr" et al  */
 #include /* for "__user" et al   */
 
+/* For compatibility with glibc net/if.h */
+#if __UAPI_DEF_IF_IFNAMSIZ
 #defineIFNAMSIZ16
+#endif /* __UAPI_DEF_IF_IFNAMSIZ */
 #defineIFALIASZ256
 #include 
 
@@ -68,6 +72,8 @@
  * @IFF_ECHO: echo sent packets. Volatile.
  */
 enum net_device_flags {
+/* for compatibility with glibc net/if.h */
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
IFF_UP  = 1<<0,  /* sysfs */
IFF_BROADCAST   = 1<<1,  /* volatile */
IFF_DEBUG   = 1<<2,  /* sysfs */
@@ -84,11 +90,14 @@ enum net_device_flags {
IFF_PORTSEL = 1<<13, /* sysfs */
IFF_AUTOMEDIA   = 1<<14, /* sysfs */
IFF_DYNAMIC = 1<<15, /* sysfs */
+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */
IFF_LOWER_UP= 1<<16, /* volatile */
IFF_DORMANT 

Kernel uapi and glibc header conflicts (was Re: header conflict introduced by change to netfilter_ipv4/ip_tables.h )

2016-02-07 Thread Mikko Rapeli
On Thu, Jan 07, 2016 at 10:30:40AM -0800, Stephen Hemminger wrote:
> On Thu, 7 Jan 2016 07:29:50 +
> Mikko Rapeli <mikko.rap...@iki.fi> wrote:
> 
> > On Wed, Jan 06, 2016 at 09:20:07AM -0800, Stephen Hemminger wrote:
> > > This commit breaks compilation of iproute2 with net-next.
> > 
> > Ok, linux/if.h and libc net/if.h have overlapping defines, and this is not
> > the only one. I saw lots of them in the core dump headers.
> > 
> > How should we handle them? Another ifndef for IFNAMSIZ into kernel uapi
> > headers?
> > 
> > -Mikko
> 
> Probably need to do the same thing that was done previously for these
> kind of conflicts.  This makes make linux/if.h change to adapt to net/if.h
> being included before it.

So uapi headers now have a libc-compat.h
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/libc-compat.h?id=refs/tags/v4.5-rc2
which tries to detect and fix incompatibilities between Linux kernel and glibc
headers. Part of the fix is then in the kernel side headers and another part
should be in glibc headers, but glibc git repo does not include any of these
fixes yet.

Has the glibc part of this incompatiblity mess been discussed and agreed
with glibc developers?

Many of the conflics arise from propably old glibc headers which had copied
out definitions from the Linux kernel side before it could export any headers
to userspace. I assume that the glibc headers are not allowed to depend and
include Linux kernel uapi headers in deployments but maybe the Linux kernel
headers could be used at glibc compile time to generate needed glibc side
definitions. That would allow having a single source for definitions like 
FNAMSIZ 16.

Has this been considered before?

I'm drafting a test, similar to the kernel uapi header compile test
https://github.com/mcfrisk/linux/blob/headers_test_v05/scripts/headers_compile_test.sh
for the glibc conflicts too, and of course noticed that also glibc headers
conflict with each other. With some workarounds I can test compile each kernel
uapi header against all compiling glibc headers and see the conflicts as
build failures.

-Mikko


Re: header conflict introduced by change to netfilter_ipv4/ip_tables.h

2016-01-06 Thread Mikko Rapeli
On Wed, Jan 06, 2016 at 09:20:07AM -0800, Stephen Hemminger wrote:
> This commit breaks compilation of iproute2 with net-next.

Ok, linux/if.h and libc net/if.h have overlapping defines, and this is not
the only one. I saw lots of them in the core dump headers.

How should we handle them? Another ifndef for IFNAMSIZ into kernel uapi
headers?

-Mikko

> commit 1ffad83dffd675cd742286ae82dca7d746cb0da8
> Author: Mikko Rapeli <mikko.rap...@iki.fi>
> Date:   Thu Oct 15 07:56:30 2015 +0200
> 
> netfilter: fix include files for compilation
> 
> Add missing header dependencies and other small changes so that each file
> compiles alone in userspace.
>     
> Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> Signed-off-by: Pablo Neira Ayuso <pa...@netfilter.org>
> 
> For iproute2, a copy of kernel headers (from make install_headers) is used.
> After this change. the build of x_tables.c fails because IFNAMSIZ is already
> defined in net/if.h
> 
> gcc -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations 
> -Wold-style-definition -Wformat=2 -O2 -I../include -DRESOLVE_HOSTNAMES 
> -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE 
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  
> -DHAVE_SETNS -DHAVE_ELF -DCONFIG_GACT -DCONFIG_GACT_PROB 
> -DIPT_LIB_DIR=\"/lib/xtables\" -DYY_NO_INPUT -Wl,-export-dynamic -shared 
> -fpic -o q_atm.so q_atm.c -latm
> gcc -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations 
> -Wold-style-definition -Wformat=2 -O2 -I../include -DRESOLVE_HOSTNAMES 
> -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE 
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  
> -DHAVE_SETNS -DHAVE_ELF -DCONFIG_GACT -DCONFIG_GACT_PROB 
> -DIPT_LIB_DIR=\"/lib/xtables\" -DYY_NO_INPUT -Wl,-export-dynamic -shared 
> -fpic -o m_xt.so m_xt.c $(pkg-config xtables --cflags --libs)
> In file included from ../include/linux/netfilter_ipv4/ip_tables.h:20:0,
>  from m_xt.c:20:
> ../include/linux/if.h:26:0: warning: "IFNAMSIZ" redefined
>  #define IFNAMSIZ 16
>  ^
> In file included from m_xt.c:17:0:
> /usr/include/net/if.h:129:0: note: this is the location of the previous 
> definition
>  # define IFNAMSIZ IF_NAMESIZE
>  ^
> ../include/linux/if.h:71:2: error: redeclaration of enumerator ‘IFF_UP’
>   IFF_UP= 1<<0,  /* sysfs */
>   ^
> /usr/include/net/if.h:44:5: note: previous definition of ‘IFF_UP’ was here
>  IFF_UP = 0x1,  /* Interface is up.  */
>  ^
> ../include/linux/if.h:72:2: error: redeclaration of enumerator ‘IFF_BROADCAST’
>   IFF_BROADCAST   = 1<<1,  /* __volatile__ */
>   ^
> /usr/include/net/if.h:46:5: note: previous definition of ‘IFF_BROADCAST’ was 
> here
>  IFF_BROADCAST = 0x2, /* Broadcast address valid.  */
>  ^
> ../include/linux/if.h:73:2: error: redeclaration of enumerator ‘IFF_DEBUG’
>   IFF_DEBUG   = 1<<2,  /* sysfs */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 57/79] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h

2015-10-15 Thread Mikko Rapeli
Fixes userspace compiler error:

error: unknown type name ‘uint32_t’

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/openvswitch.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 32e07d8..80c39a1 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -612,8 +612,8 @@ enum ovs_hash_alg {
  * @hash_basis: basis used for computing hash.
  */
 struct ovs_action_hash {
-   uint32_t  hash_alg; /* One of ovs_hash_alg. */
-   uint32_t  hash_basis;
+   __u32  hash_alg; /* One of ovs_hash_alg. */
+   __u32  hash_basis;
 };
 
 /**
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 60/79] include/uapi/linux/atm_zatm.h: include linux/time.h

2015-10-15 Thread Mikko Rapeli
Fixes userspace compile error:

error: field ‘real’ has incomplete type
 struct timeval real;  /* real (wall-clock) time */

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/atm_zatm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/atm_zatm.h b/include/uapi/linux/atm_zatm.h
index 10f0fa2..adbaa6c 100644
--- a/include/uapi/linux/atm_zatm.h
+++ b/include/uapi/linux/atm_zatm.h
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 #define ZATM_GETPOOL   _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
/* get pool statistics */
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 40/79] include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and linux/in6.h

2015-10-15 Thread Mikko Rapeli
Fixes userspace compilation errors like:

error: field ‘iph’ has incomplete type
error: field ‘prefix’ has incomplete type

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if_tunnel.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index af4de90..8afe695 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -2,6 +2,9 @@
 #define _UAPI_IF_TUNNEL_H_
 
 #include 
+#include 
+#include 
+#include 
 #include 
 
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 44/79] include/uapi/linux/if_pppox.h: include linux/in.h and linux/in6.h

2015-10-15 Thread Mikko Rapeli
Fixes userspace compilation errors:

error: field ‘addr’ has incomplete type
 struct sockaddr_in addr; /* IP address and port to send to */

error: field ‘addr’ has incomplete type
 struct sockaddr_in6 addr; /* IP address and port to send to */

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if_pppox.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index 473c3c4..d37bbb1 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -24,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /* For user-space programs to pick up these definitions
  * which they wouldn't get otherwise without defining __KERNEL__
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 43/79] include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h

2015-10-15 Thread Mikko Rapeli
Fixes userspace compilation errors like:

error: field ‘addr’ has incomplete type
 struct sockaddr_in addr; /* IP address and port to send to */
^
error: field ‘addr’ has incomplete type
 struct sockaddr_in6 addr; /* IP address and port to send to */

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if_pppol2tp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_pppol2tp.h b/include/uapi/linux/if_pppol2tp.h
index 163e8ad..4bd1f55 100644
--- a/include/uapi/linux/if_pppol2tp.h
+++ b/include/uapi/linux/if_pppol2tp.h
@@ -16,7 +16,8 @@
 #define _UAPI__LINUX_IF_PPPOL2TP_H
 
 #include 
-
+#include 
+#include 
 
 /* Structure used to connect() the socket to a particular tunnel UDP
  * socket over IPv4.
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 39/79] include/uapi/linux/if_pppox.h: include linux/if.h

2015-10-15 Thread Mikko Rapeli
Fixes userspace compilation error:

error: ‘IFNAMSIZ’ undeclared here (not in a function)

Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
---
 include/uapi/linux/if_pppox.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index e128769..473c3c4 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -21,6 +21,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 81/98] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h

2015-05-30 Thread Mikko Rapeli
Fixes userspace compiler error:

error: unknown type name ‘uint32_t’

Signed-off-by: Mikko Rapeli mikko.rap...@iki.fi
---
 include/uapi/linux/openvswitch.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index bbd49a0..0ab8eca 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -586,8 +586,8 @@ enum ovs_hash_alg {
  * @hash_basis: basis used for computing hash.
  */
 struct ovs_action_hash {
-   uint32_t  hash_alg; /* One of ovs_hash_alg. */
-   uint32_t  hash_basis;
+   __u32  hash_alg; /* One of ovs_hash_alg. */
+   __u32  hash_basis;
 };
 
 /**
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 42/98] include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and linux/in6.h

2015-05-30 Thread Mikko Rapeli
Fixes userspace compilation errors like:

error: field ‘iph’ has incomplete type
error: field ‘prefix’ has incomplete type

Signed-off-by: Mikko Rapeli mikko.rap...@iki.fi
---
 include/uapi/linux/if_tunnel.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index bd3cc11..2a36080 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -2,6 +2,9 @@
 #define _UAPI_IF_TUNNEL_H_
 
 #include linux/types.h
+#include linux/if.h
+#include linux/ip.h
+#include linux/in6.h
 #include asm/byteorder.h
 
 
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 41/98] include/uapi/linux/if_pppox.h: include linux/if.h

2015-05-30 Thread Mikko Rapeli
Fixes userspace compilation error:

error: ‘IFNAMSIZ’ undeclared here (not in a function)

Signed-off-by: Mikko Rapeli mikko.rap...@iki.fi
---
 include/uapi/linux/if_pppox.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index e128769..473c3c4 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -21,6 +21,7 @@
 #include asm/byteorder.h
 
 #include linux/socket.h
+#include linux/if.h
 #include linux/if_ether.h
 #include linux/if_pppol2tp.h
 
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 48/98] include/uapi/linux/if_pppox.h: include linux/in.h and linux/in6.h

2015-05-30 Thread Mikko Rapeli
Fixes userspace compilation errors:

error: field ‘addr’ has incomplete type
 struct sockaddr_in addr; /* IP address and port to send to */

error: field ‘addr’ has incomplete type
 struct sockaddr_in6 addr; /* IP address and port to send to */

Signed-off-by: Mikko Rapeli mikko.rap...@iki.fi
---
 include/uapi/linux/if_pppox.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index 473c3c4..d37bbb1 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -24,6 +24,8 @@
 #include linux/if.h
 #include linux/if_ether.h
 #include linux/if_pppol2tp.h
+#include linux/in.h
+#include linux/in6.h
 
 /* For user-space programs to pick up these definitions
  * which they wouldn't get otherwise without defining __KERNEL__
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 47/98] include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h

2015-05-30 Thread Mikko Rapeli
Fixes userspace compilation errors like:

error: field ‘addr’ has incomplete type
 struct sockaddr_in addr; /* IP address and port to send to */
^
error: field ‘addr’ has incomplete type
 struct sockaddr_in6 addr; /* IP address and port to send to */

Signed-off-by: Mikko Rapeli mikko.rap...@iki.fi
---
 include/uapi/linux/if_pppol2tp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_pppol2tp.h b/include/uapi/linux/if_pppol2tp.h
index 163e8ad..4bd1f55 100644
--- a/include/uapi/linux/if_pppol2tp.h
+++ b/include/uapi/linux/if_pppol2tp.h
@@ -16,7 +16,8 @@
 #define _UAPI__LINUX_IF_PPPOL2TP_H
 
 #include linux/types.h
-
+#include linux/in.h
+#include linux/in6.h
 
 /* Structure used to connect() the socket to a particular tunnel UDP
  * socket over IPv4.
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 84/98] include/uapi/linux/atm_zatm.h: include linux/time.h

2015-05-30 Thread Mikko Rapeli
Fixes userspace compile error:

error: field ‘real’ has incomplete type
 struct timeval real;  /* real (wall-clock) time */

Signed-off-by: Mikko Rapeli mikko.rap...@iki.fi
---
 include/uapi/linux/atm_zatm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/atm_zatm.h b/include/uapi/linux/atm_zatm.h
index 10f0fa2..adbaa6c 100644
--- a/include/uapi/linux/atm_zatm.h
+++ b/include/uapi/linux/atm_zatm.h
@@ -14,6 +14,7 @@
 
 #include linux/atmapi.h
 #include linux/atmioc.h
+#include linux/time.h
 
 #define ZATM_GETPOOL   _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
/* get pool statistics */
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html