]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define
authorHauke Mehrtens <hauke@hauke-m.de>
Mon, 12 Feb 2018 22:59:51 +0000 (23:59 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Wed, 28 Feb 2018 14:47:21 +0000 (08:47 -0600)
commit80b9da7ed4524f5300956791da716ec561801cea
treeb6b712ab891f453c156fd469e62f5e98ecfb54ec
parentde5dce59927d39906750684f0ef4d722394d3b90
uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define

BugLink: https://bugs.launchpad.net/bugs/1752317
commit da360299b6734135a5f66d7db458dcc7801c826a 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: 6926e041a892 ("uapi/if_ether.h: prevent redefinition of struct ethhdr")
Reported-by: Guillaume Nault <g.nault@alphalink.fr>
Cc: <stable@vger.kernel.org> # 4.15
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
include/uapi/linux/if_ether.h
include/uapi/linux/libc-compat.h