Skip to content

Commit 6f02b54

Browse files
alan-maguireanakryiko
authored andcommitted
bpftool: Fix compilation failure for net.o with older glibc
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: f6f3bac ("tools/bpf: bpftool: add net support") Signed-off-by: Alan Maguire <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 6720869 commit 6f02b54

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

tools/bpf/bpftool/net.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <bpf/bpf.h>
1212
#include <bpf/libbpf.h>
1313
#include <net/if.h>
14-
#include <linux/if.h>
1514
#include <linux/rtnetlink.h>
1615
#include <linux/socket.h>
1716
#include <linux/tc_act/tc_bpf.h>

0 commit comments

Comments
 (0)