From: Yonghong Song <yhs@fb.com>
To: Wang YanQing <udknight@gmail.com>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
Martin Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
"shuah@kernel.org" <shuah@kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] selftests/bpf: fix compile errors with older glibc
Date: Thu, 18 Apr 2019 05:09:53 +0000 [thread overview]
Message-ID: <ecd56ebd-d19f-8834-9373-088ad7c9a725@fb.com> (raw)
In-Reply-To: <20190417174839.GA16679@udknight>
On 4/17/19 10:48 AM, Wang YanQing wrote:
> The older glibc (for example, 2.23) doesn't handle __UAPI_DEF_*
> in libc-compat.h properly, and it bring below compile errors:
I have an even old glibc 2.17 and it still works. Not sure
why it failed here. Could you explain more?
But I applied the change, it still works with 2.17 glibc and gcc 4.8.5.
So change probably safe.
> "
> In file included from test_tcpnotify_kern.c:12:
> /usr/include/netinet/in.h:101:5: error: expected identifier
> IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
> ^
> /usr/include/linux/in6.h:131:26: note: expanded from macro 'IPPROTO_HOPOPTS'
> ^
> In file included from test_tcpnotify_kern.c:12:
> /usr/include/netinet/in.h:103:5: error: expected identifier
> IPPROTO_ROUTING = 43, /* IPv6 routing header. */
> ^
> /usr/include/linux/in6.h:132:26: note: expanded from macro 'IPPROTO_ROUTING'
> ^
> In file included from test_tcpnotify_kern.c:12:
> /usr/include/netinet/in.h:105:5: error: expected identifier
> IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
> ^
> /usr/include/linux/in6.h:133:26: note: expanded from macro 'IPPROTO_FRAGMENT'
> "
> The same compile errors are reported for test_tcpbpf_kern.c too.
>
> This patch fixes the compile errors by moving <netinet/in.h> to before the
> <linux/*.h>.
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
> tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c | 2 +-
> tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> index 74f73b3..c7c3240 100644
> --- a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> +++ b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0
> #include <stddef.h>
> #include <string.h>
> +#include <netinet/in.h>
> #include <linux/bpf.h>
> #include <linux/if_ether.h>
> #include <linux/if_packet.h>
> @@ -9,7 +10,6 @@
> #include <linux/types.h>
> #include <linux/socket.h>
> #include <linux/tcp.h>
> -#include <netinet/in.h>
> #include "bpf_helpers.h"
> #include "bpf_endian.h"
> #include "test_tcpbpf.h"
> diff --git a/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c b/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
> index edbca20..ec6db6e 100644
> --- a/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
> +++ b/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0
> #include <stddef.h>
> #include <string.h>
> +#include <netinet/in.h>
> #include <linux/bpf.h>
> #include <linux/if_ether.h>
> #include <linux/if_packet.h>
> @@ -9,7 +10,6 @@
> #include <linux/types.h>
> #include <linux/socket.h>
> #include <linux/tcp.h>
> -#include <netinet/in.h>
> #include "bpf_helpers.h"
> #include "bpf_endian.h"
> #include "test_tcpnotify.h"
>
next prev parent reply other threads:[~2019-04-18 5:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-17 17:48 Wang YanQing
2019-04-18 5:09 ` Yonghong Song [this message]
2019-04-18 17:11 ` Wang YanQing
2019-04-18 18:00 ` Wang YanQing
2019-04-18 20:33 ` Yonghong Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ecd56ebd-d19f-8834-9373-088ad7c9a725@fb.com \
--to=yhs@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=songliubraving@fb.com \
--cc=udknight@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®