* [PATCH v2] fix compile errors due to unsync linux/in6.h and netinet/in.h
@ 2019-04-18 18:05 Wang YanQing
2019-04-18 20:40 ` Yonghong Song
2019-04-18 23:10 ` Alexei Starovoitov
0 siblings, 2 replies; 3+ messages in thread
From: Wang YanQing @ 2019-04-18 18:05 UTC (permalink / raw)
To: ast; +Cc: daniel, kafai, songliubraving, yhs, shuah, bpf, linux-kernel
I meet below compile errors:
"
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.
My environment:
lsb_release -a:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
dpkg -l | grep libc-dev:
ii libc-dev-bin 2.23-0ubuntu11 amd64 GNU C Library: Development binaries
ii linux-libc-dev:amd64 4.4.0-145.171 amd64 Linux Kernel Headers for development.
The reason is linux/in6.h and netinet/in.h aren't synchronous about how to
handle the same definitions, IPPROTO_HOPOPTS, etc.
This patch fixes the compile errors by moving <netinet/in.h> to before the
<linux/*.h>.
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
Changes
v1-v2:
1:Rewrite the changelog.
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"
--
1.8.5.6.2.g3d8a54e.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] fix compile errors due to unsync linux/in6.h and netinet/in.h
2019-04-18 18:05 [PATCH v2] fix compile errors due to unsync linux/in6.h and netinet/in.h Wang YanQing
@ 2019-04-18 20:40 ` Yonghong Song
2019-04-18 23:10 ` Alexei Starovoitov
1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2019-04-18 20:40 UTC (permalink / raw)
To: Wang YanQing, ast, daniel, Martin Lau, Song Liu, shuah, bpf,
linux-kernel
On 4/18/19 11:05 AM, Wang YanQing wrote:
> I meet below compile errors:
> "
> 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.
>
> My environment:
> lsb_release -a:
> No LSB modules are available.
> Distributor ID: Ubuntu
> Description: Ubuntu 16.04.6 LTS
> Release: 16.04
> Codename: xenial
>
> dpkg -l | grep libc-dev:
> ii libc-dev-bin 2.23-0ubuntu11 amd64 GNU C Library: Development binaries
> ii linux-libc-dev:amd64 4.4.0-145.171 amd64 Linux Kernel Headers for development.
>
> The reason is linux/in6.h and netinet/in.h aren't synchronous about how to
> handle the same definitions, IPPROTO_HOPOPTS, etc.
>
> This patch fixes the compile errors by moving <netinet/in.h> to before the
> <linux/*.h>.
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
Tested and the change makes sense. By changing the include order, now we
have linux checks the existence of macro _NETINET_IN_H instead of
certain versions of glibc checks _UAPI_LINUX_IN6_H which does not exist
for all recent kernels (at least 4.4 and onwards).
Acked-by: Yonghong Song <yhs@fb.com>
> ---
> Changes
> v1-v2:
> 1:Rewrite the changelog.
>
> 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"
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] fix compile errors due to unsync linux/in6.h and netinet/in.h
2019-04-18 18:05 [PATCH v2] fix compile errors due to unsync linux/in6.h and netinet/in.h Wang YanQing
2019-04-18 20:40 ` Yonghong Song
@ 2019-04-18 23:10 ` Alexei Starovoitov
1 sibling, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2019-04-18 23:10 UTC (permalink / raw)
To: Wang YanQing, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, Yonghong Song, Shuah Khan, bpf, LKML
On Thu, Apr 18, 2019 at 11:06 AM Wang YanQing <udknight@gmail.com> wrote:
>
> I meet below compile errors:
> "
> 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.
>
> My environment:
> lsb_release -a:
> No LSB modules are available.
> Distributor ID: Ubuntu
> Description: Ubuntu 16.04.6 LTS
> Release: 16.04
> Codename: xenial
>
> dpkg -l | grep libc-dev:
> ii libc-dev-bin 2.23-0ubuntu11 amd64 GNU C Library: Development binaries
> ii linux-libc-dev:amd64 4.4.0-145.171 amd64 Linux Kernel Headers for development.
>
> The reason is linux/in6.h and netinet/in.h aren't synchronous about how to
> handle the same definitions, IPPROTO_HOPOPTS, etc.
>
> This patch fixes the compile errors by moving <netinet/in.h> to before the
> <linux/*.h>.
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
Added 'selftests/bpf' to commit log and pushed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-18 23:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18 18:05 [PATCH v2] fix compile errors due to unsync linux/in6.h and netinet/in.h Wang YanQing
2019-04-18 20:40 ` Yonghong Song
2019-04-18 23:10 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).