[Toybox] [PATCH] ip: add missing linux/ip.h header for struct iphdr declaration

Rob Landley rob at landley.net
Fri Jul 10 19:32:10 PDT 2020



On 7/10/20 11:11 AM, Ariadne Conill wrote:
> On Tuesday, July 7, 2020 3:36:47 AM MDT you wrote:
>> On 7/5/20 12:24 PM, ariadne at dereferenced.org wrote:
>>> In Alpine, we are using Linux 5.4 kernel headers.  It is probably a
>>> regression in the headers, but including the header anyway likely makes
>>> sense.
>>>
>>> I think glibc and bionic do not use kernel headers directly.
>>
>> $ find /usr/include -type f | egrep -v '/(linux|asm|asm-generic)/' | xargs
>> grep '#include <linux/' | wc -l
>> 60
>>
>> Although in this case, devuan ascii's /usr/include/linux/if_tunnel.h
>> #includes linux/ip.h. Let's see, in current kernel sources...
>>
>> $ git annotate include/uapi/linux/if_tunnel.h  | grep ip.h
>> 1fe8e0f074c77	(Mikko Rapeli	2016-08-22 20:32:39 +0200	
> 7)#include
>> <linux/ip.h>
>>
>> commit 1fe8e0f074c77aa41aaa579345a9e675acbebfa9
>> Author: Mikko Rapeli <mikko.rapeli at iki.fi>
>> Date:   Mon Aug 22 20:32:39 2016 +0200
>>
>>     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.rapeli at iki.fi>
>>     Signed-off-by: David S. Miller <davem at davemloft.net>
>>
>> So this is a bug that was fixed in upstream kernel sources 4 years ago
>> (v4.8-rc3), and the 5.4 kernel was released November 24, 2019.
>>
>> Are you sure you're using 5.4 kernel headers?
> 
> Yes, Alpine is using 5.4 kernel headers.

$ git checkout v5.4
$ make headers_install
$ grep ip.h usr/include/linux/if_tunnel.h
#include <linux/ip.h>

The one installed by v5.4 has ip.h. I just confirmed it from git.

> $ apk info -W /usr/include/linux/if_tunnel.h 
> /usr/include/linux/if_tunnel.h is owned by linux-headers-5.4.5-r1

Ok. How is it getting a version that doesn't #include <linux/ip.h>? If it's
using actual include/linux/if_tunnel.h

c19e654ddbe38   (Herbert Xu     2008-10-09 11:59:55 -0700       5)#include
<linux/ip.h>

>From 2008. If it's include/uapi/linux/if_tunnel.h:

1fe8e0f074c77   (Mikko Rapeli   2016-08-22 20:32:39 +0200       7)#include
<linux/ip.h>

Which is the aforementioned:

$ git describe 1fe8e0f074c77
v4.8-rc2-209-g1fe8e0f074c7

What is alpine's version changing to remove the include of ip.h? Where did it
get a version without it _from_? Do your build scripts remove it? 5.4 shipped in
November 2019, the commit was 2016.

https://github.com/torvalds/linux/commit/1fe8e0f074c77

I'm being asked to add a workaround for a problem I don't understand.

> Ariadne

Rob



More information about the Toybox mailing list