My earlier patch to reject non-zero arguments to flow dissector attach
broke attaching via bpftool. Instead of 0 it uses -1 for target_fd.
Fix this by passing a zero argument when attaching the flow dissector.

Fixes: 1b514239e859 ("bpf: flow_dissector: Check value of unused flags to 
BPF_PROG_ATTACH")
Reported-by: Jiri Benc <jb...@redhat.com>
Signed-off-by: Lorenz Bauer <l...@cloudflare.com>
---
 tools/bpf/bpftool/prog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index d942c1e3372c..acdb2c245f0a 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -940,7 +940,7 @@ static int parse_attach_detach_args(int argc, char **argv, 
int *progfd,
        }
 
        if (*attach_type == BPF_FLOW_DISSECTOR) {
-               *mapfd = -1;
+               *mapfd = 0;
                return 0;
        }
 
-- 
2.25.1

Reply via email to