All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf] bpftool: fix compilation failure for net.o with older glibc
@ 2021-01-06 15:59 Alan Maguire
  2021-01-06 21:39 ` Martin KaFai Lau
  2021-01-06 23:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Alan Maguire @ 2021-01-06 15:59 UTC (permalink / raw)
  To: ast, daniel, andrii
  Cc: kafai, songliubraving, yhs, john.fastabend, kpsingh, toke,
	wanghai38, quentin, netdev, bpf, linux-kernel, Alan Maguire

For older glibc ~2.17, #include'ing both linux/if.h and net/if.h
fails due to complaints about redefinition of interface flags:

  CC       net.o
In file included from net.c:13:0:
/usr/include/linux/if.h:71:2: error: redeclaration of enumerator ‘IFF_UP’
  IFF_UP    = 1<<0,  /* sysfs */
  ^
/usr/include/net/if.h:44:5: note: previous definition of ‘IFF_UP’ was here
     IFF_UP = 0x1,  /* Interface is up.  */

The issue was fixed in kernel headers in [1], but since compilation
of net.c picks up system headers the problem can recur.

Dropping #include <linux/if.h> resolves the issue and it is
not needed for compilation anyhow.

[1] https://lore.kernel.org/netdev/1461512707-23058-1-git-send-email-mikko.rapeli__34748.27880641$1462831734$gmane$org@iki.fi/

Fixes: f6f3bac08ff9 ("tools/bpf: bpftool: add net support")
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 tools/bpf/bpftool/net.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c
index 3fae61e..ff3aa0c 100644
--- a/tools/bpf/bpftool/net.c
+++ b/tools/bpf/bpftool/net.c
@@ -11,7 +11,6 @@
 #include <bpf/bpf.h>
 #include <bpf/libbpf.h>
 #include <net/if.h>
-#include <linux/if.h>
 #include <linux/rtnetlink.h>
 #include <linux/socket.h>
 #include <linux/tc_act/tc_bpf.h>
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf] bpftool: fix compilation failure for net.o with older glibc
  2021-01-06 15:59 [PATCH bpf] bpftool: fix compilation failure for net.o with older glibc Alan Maguire
@ 2021-01-06 21:39 ` Martin KaFai Lau
  2021-01-06 23:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Martin KaFai Lau @ 2021-01-06 21:39 UTC (permalink / raw)
  To: Alan Maguire
  Cc: ast, daniel, andrii, songliubraving, yhs, john.fastabend,
	kpsingh, toke, wanghai38, quentin, netdev, bpf, linux-kernel

On Wed, Jan 06, 2021 at 03:59:06PM +0000, Alan Maguire wrote:
> For older glibc ~2.17, #include'ing both linux/if.h and net/if.h
> fails due to complaints about redefinition of interface flags:
> 
>   CC       net.o
> In file included from net.c:13:0:
> /usr/include/linux/if.h:71:2: error: redeclaration of enumerator ‘IFF_UP’
>   IFF_UP    = 1<<0,  /* sysfs */
>   ^
> /usr/include/net/if.h:44:5: note: previous definition of ‘IFF_UP’ was here
>      IFF_UP = 0x1,  /* Interface is up.  */
> 
> The issue was fixed in kernel headers in [1], but since compilation
> of net.c picks up system headers the problem can recur.
> 
> Dropping #include <linux/if.h> resolves the issue and it is
> not needed for compilation anyhow.
Acked-by: Martin KaFai Lau <kafai@fb.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf] bpftool: fix compilation failure for net.o with older glibc
  2021-01-06 15:59 [PATCH bpf] bpftool: fix compilation failure for net.o with older glibc Alan Maguire
  2021-01-06 21:39 ` Martin KaFai Lau
@ 2021-01-06 23:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-06 23:30 UTC (permalink / raw)
  To: Alan Maguire
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, toke, wanghai38, quentin, netdev, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Wed,  6 Jan 2021 15:59:06 +0000 you wrote:
> For older glibc ~2.17, #include'ing both linux/if.h and net/if.h
> fails due to complaints about redefinition of interface flags:
> 
>   CC       net.o
> In file included from net.c:13:0:
> /usr/include/linux/if.h:71:2: error: redeclaration of enumerator ‘IFF_UP’
>   IFF_UP    = 1<<0,  /* sysfs */
>   ^
> /usr/include/net/if.h:44:5: note: previous definition of ‘IFF_UP’ was here
>      IFF_UP = 0x1,  /* Interface is up.  */
> 
> [...]

Here is the summary with links:
  - [bpf] bpftool: fix compilation failure for net.o with older glibc
    https://git.kernel.org/bpf/bpf/c/6f02b540d759

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-06 23:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 15:59 [PATCH bpf] bpftool: fix compilation failure for net.o with older glibc Alan Maguire
2021-01-06 21:39 ` Martin KaFai Lau
2021-01-06 23:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.