[squid-dev] [PATCH] Fix broken cross-include guards in Linux Netfilter code

Kinkie gkinkie at gmail.com
Tue Sep 22 14:29:17 UTC 2015


I wouldn't know how to do it without including netinet/in.h there
before sys/capability.h. But then netinet/in.h would end up being
included everywhere..

On Tue, Sep 22, 2015 at 4:12 PM, Amos Jeffries <squid3 at treenet.co.nz> wrote:
> On 22/09/2015 10:00 p.m., Kinkie wrote:
>> Hello,
>>   recent Linux kernels have a new behavior, by which linux/in.h
>> defines some symbols which are also defined in netinet/in.h. This is
>> currently causing broken builds on redhat rawhide, but others will
>> follow for sure.
>>
>> The Linux developers have included some cross-include guards (in
>> linux/libc-compat.h); problem is, they are currently not working for
>> us.
>>
>> The reason for this failure is in this include chain:
>> - compat/os/linux.h includes linux/capability.h which which includes
>> libc-compat.h.
>> libc-compat.h looks for the include-guards of _NETINET_IN_H, which are
>> not (yet) defined to define a macro preventing redefinnition of the
>> symbols
>> - later on, we include netinet/in.h
>> - later on, we include linux/if.h which includes linux/in.h
>>
>> The attached patch #undef-s the linux/libc-compat.h include guards
>> before including any linux/*.h header but after including
>> netinet/in.h; this causes libc-compat.h to be reevaluated and the
>> correct guards to be defined.
>>
>> It's a hack, but it's proven working. The long route would probably
>> have to be to  rework compat/os/linux which I'm quite wary of.
>>
>> Opinions?
>
> I'd like these bits to be isolated in compat/os/linux.h if at all possible.
>
> NP: this is <http://bugs.squid-cache.org/show_bug.cgi?id=4323>
>
> Amos
>
> _______________________________________________
> squid-dev mailing list
> squid-dev at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-dev



-- 
    Francesco


More information about the squid-dev mailing list