• Hauke Mehrtens's avatar
    uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define · cb4f43bf
    Hauke Mehrtens authored
    commit da360299 upstream.
    
    This fixes a compile problem of some user space applications by not
    including linux/libc-compat.h in uapi/if_ether.h.
    
    linux/libc-compat.h checks which "features" the header files, included
    from the libc, provide to make the Linux kernel uapi header files only
    provide no conflicting structures and enums. If a user application mixes
    kernel headers and libc headers it could happen that linux/libc-compat.h
    gets included too early where not all other libc headers are included
    yet. Then the linux/libc-compat.h would not prevent all the
    redefinitions and we run into compile problems.
    This patch removes the include of linux/libc-compat.h from
    uapi/if_ether.h to fix the recently introduced case, but not all as this
    is more or less impossible.
    
    It is no problem to do the check directly in the if_ether.h file and not
    in libc-compat.h as this does not need any fancy glibc header detection
    as glibc never provided struct ethhdr and should define
    __UAPI_DEF_ETHHDR by them self when they will provide this.
    
    The following test program did not compile correctly any more:
    
    #include <linux/if_ether.h>
    #include <netinet/in.h>
    #include <linux/in.h>
    
    int main(void)
    {
    	return 0;
    }
    
    Fixes: 6926e041 ("uapi/if_ether.h: prevent redefinition of struct ethhdr")
    Reported-by: 's avatarGuillaume Nault <g.nault@alphalink.fr>
    Cc: <stable@vger.kernel.org> # 4.15
    Signed-off-by: 's avatarHauke Mehrtens <hauke@hauke-m.de>
    Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
    Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    cb4f43bf
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
REPORTING-BUGS Loading commit data...