Skip to contentSkip to conversation

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

DISCUSSION Ben Greear 3 participants 7 messages Jan 13, 2017 – Jan 14, 2017

Subsystems (2)
lore
Share & tools
lore

Ben Greear

author
#0 lore raw

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

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
author
#1 lore raw
Quoted 12 lines · Ben Greear

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:

Quoted 9 lines

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

Thanks,
Ben

I forgot the full commit ID, my abbreviation was not sufficient to be unique it seems:

1fe8e0f074c77aa41aaa579345a9e675acbebfa9

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#2 lore raw
In reply to Ben Greear
Quoted 12 lines · On Fri, 13 Jan 2017 11:12:32 -0800 Ben Greear <[email protected]> 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:

Quoted 9 lines

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

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 <linux/' | \
	awk -F: '{print $2}' | \
	sed -e 's/^#include <//' -e 's/>.*$//' | \
	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.

author
#3 lore raw
Quoted 35 lines · Stephen Hemminger
Quoted 12 lines · On Fri, 13 Jan 2017 11:12:32 -0800 Ben Greear <[email protected]> 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:

Quoted 9 lines

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

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 <linux/' | \
	awk -F: '{print $2}' | \
	sed -e 's/^#include <//' -e 's/>.*$//' | \
	sort -u >linux.headers
   $ for f in $(cat linux.headers)
     do cp ~/kernel/net-next/usr/include/$f include/$f
     done
Quoted 3 lines

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?

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#4 lore raw
Quoted 36 lines · On Fri, 13 Jan 2017 11:50:32 -0800 Ben Greear <[email protected]> wrote:
Quoted 35 lines · Stephen Hemminger
Quoted 12 lines · On Fri, 13 Jan 2017 11:12:32 -0800 Ben Greear <[email protected]> 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:

Quoted 9 lines

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

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 <linux/' | \
	awk -F: '{print $2}' | \
	sed -e 's/^#include <//' -e 's/>.*$//' | \
	sort -u >linux.headers
   $ for f in $(cat linux.headers)
     do cp ~/kernel/net-next/usr/include/$f include/$f
     done
Quoted 6 lines
Quoted 3 lines

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.

author
#5 lore raw
Quoted 39 lines · Stephen Hemminger
Quoted 36 lines · On Fri, 13 Jan 2017 11:50:32 -0800 Ben Greear <[email protected]> wrote:
Quoted 35 lines · Stephen Hemminger
Quoted 12 lines · On Fri, 13 Jan 2017 11:12:32 -0800 Ben Greear <[email protected]> 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:

Quoted 9 lines

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

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 <linux/' | \
	awk -F: '{print $2}' | \
	sed -e 's/^#include <//' -e 's/>.*$//' | \
	sort -u >linux.headers
   $ for f in $(cat linux.headers)
     do cp ~/kernel/net-next/usr/include/$f include/$f
     done
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

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.

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

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#6 lore raw
Quoted 44 lines · Ben Greear
Quoted 43 lines · Stephen Hemminger
Quoted 40 lines · On Fri, 13 Jan 2017 11:50:32 -0800 Ben Greear <[email protected]> wrote:
Quoted 38 lines · Stephen Hemminger
Quoted 12 lines · On Fri, 13 Jan 2017 11:12:32 -0800 Ben Greear <[email protected]> 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:

Quoted 9 lines

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

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 <linux/' | \
	awk -F: '{print $2}' | \
	sed -e 's/^#include <//' -e 's/>.*$//' | \
	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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 2 lines

Anyway, I'll let Dave and/or the original committer decide....I'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

Quoted 7 lines

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com