]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/iptables/0001-extensions-libxt_bpf-Fix-build-with-old-kernel-versi.patch
iptables: fix build with older kernel headers
[coffee/buildroot.git] / package / iptables / 0001-extensions-libxt_bpf-Fix-build-with-old-kernel-versi.patch
1 From 5beb1582d13d3bfdd0d2b277f5f3154b2fbf4a8e Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Tue, 27 Feb 2018 16:56:55 +0100
4 Subject: [PATCH] extensions: libxt_bpf: Fix build with old kernel versions
5
6 In kernel 3.18 the union bpf_attr does not have a pathname attribute and
7 BPF_OBJ_GET is also not defined in these versions.
8 This was added in Linux commit b2197755b263 ("bpf: add support for
9 persistent maps/progs"). Check for the BPF_FS_MAGIC define which was
10 also added in this Linux commit and only activate this code in case we
11 find that define.
12
13 This fixes a build problem with Linux 3.18.
14 Netfilter bug: #1231
15
16 Fixes: f17f9ace8a8 ("extensions: libxt_bpf: support ebpf pinned objects")
17 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
18 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
19 Signed-off-by: Baruch Siach <baruch@tkos.co.il>
20 ---
21 Patch status: upstream commit 5beb1582d13d
22
23  extensions/libxt_bpf.c | 3 ++-
24  1 file changed, 2 insertions(+), 1 deletion(-)
25
26 diff --git a/extensions/libxt_bpf.c b/extensions/libxt_bpf.c
27 index 9510c190f315..92958247c756 100644
28 --- a/extensions/libxt_bpf.c
29 +++ b/extensions/libxt_bpf.c
30 @@ -22,6 +22,7 @@
31  #include <linux/bpf.h>
32  #endif
33  
34 +#include <linux/magic.h>
35  #include <linux/unistd.h>
36  
37  #define BCODE_FILE_MAX_LEN_B   1024
38 @@ -62,7 +63,7 @@ static const struct xt_option_entry bpf_opts_v1[] = {
39  
40  static int bpf_obj_get(const char *filepath)
41  {
42 -#if defined HAVE_LINUX_BPF_H && defined __NR_bpf
43 +#if defined HAVE_LINUX_BPF_H && defined __NR_bpf && defined BPF_FS_MAGIC
44         union bpf_attr attr;
45  
46         memset(&attr, 0, sizeof(attr));
47 -- 
48 2.16.1
49