Re: [PATCH v3 bpf] tools: bpftool: Add missing close before bpftool net attach exit

2020-11-11 Thread Michal Rostecki
goto cleanup; } if (json_output) jsonw_null(json_wtr); - return 0; + err = 0; + +cleanup: + close(progfd); + return err; } static int do_detach(int argc, char **argv) LGTM, thanks! Reviewed-By: Michal Rostecki

Re: [PATCH bpf] tools: bpftool: Add missing close before bpftool net attach exit

2020-11-09 Thread Michal Rostecki
On 11/9/20 8:04 AM, Wang Hai wrote: progfd is created by prog_parse_fd(), before 'bpftool net attach' exit, it should be closed. Fixes: 04949ccc273e ("tools: bpftool: add net attach command to attach XDP on interface") Signed-off-by: Wang Hai --- tools/bpf/bpftool/net.c | 2 ++ 1 file chang

[PATCH bpf v3] libbpf: Return btf_fd for load_sk_storage_btf

2019-05-29 Thread Michal Rostecki
_btf_* functions. - Rename libbpf__probe_raw_btf function to libbpf__load_raw_btf and return a BTF descriptor. Fixes: d7c4b3980c18 ("libbpf: detect supported kernel BTF features and sanitize BTF") Signed-off-by: Michal Rostecki --- tools/lib/bpf/libbpf.c | 28

Re: [PATCH bpf-next 0/2] Move bpf_printk to bpf_helpers.h

2019-05-17 Thread Michal Rostecki
On Thu, May 16, 2019 at 11:43:03AM -0700, Alexei Starovoitov wrote: > On Thu, May 16, 2019 at 4:21 AM Michal Rostecki > wrote: > > > > This series of patches move the commonly used bpf_printk macro to > > bpf_helpers.h which is already included in all BPF programs which &

[PATCH bpf-next v2 1/2] selftests: bpf: Move bpf_printk to bpf_helpers.h

2019-05-16 Thread Michal Rostecki
bpf_printk is a macro which is commonly used to print out debug messages in BPF programs and it was copied in many selftests and samples. Since all of them include bpf_helpers.h, this change moves the macro there. Signed-off-by: Michal Rostecki --- tools/testing/selftests/bpf/bpf_helpers.h

[PATCH bpf-next v2 2/2] samples: bpf: Do not define bpf_printk macro

2019-05-16 Thread Michal Rostecki
The bpf_printk macro was moved to bpf_helpers.h which is included in all example programs. Signed-off-by: Michal Rostecki --- samples/bpf/hbm_kern.h | 11 ++- samples/bpf/tcp_basertt_kern.c | 7 --- samples/bpf/tcp_bufs_kern.c| 7 --- samples/bpf

[PATCH bpf-next v2 0/2] Move bpf_printk to bpf_helpers.h

2019-05-16 Thread Michal Rostecki
This series of patches move the commonly used bpf_printk macro to bpf_helpers.h which is already included in all BPF programs which defined that macro on their own. v1->v2: - If HBM_DEBUG is not defined in hbm sample, undefine bpf_printk and set an empty macro for it. Michal Rostecki

[PATCH bpf-next 1/2] selftests: bpf: Move bpf_printk to bpf_helpers.h

2019-05-16 Thread Michal Rostecki
bpf_printk is a macro which is commonly used to print out debug messages in BPF programs and it was copied in many selftests and samples. Since all of them include bpf_helpers.h, this change moves the macro there. Signed-off-by: Michal Rostecki --- tools/testing/selftests/bpf/bpf_helpers.h

[PATCH bpf-next 2/2] samples: bpf: Do not define bpf_printk macro

2019-05-16 Thread Michal Rostecki
The bpf_printk macro was moved to bpf_helpers.h which is included in all example programs. Signed-off-by: Michal Rostecki --- samples/bpf/hbm_kern.h | 12 +++- samples/bpf/hbm_out_kern.c | 2 ++ samples/bpf/tcp_basertt_kern.c | 7 --- samples/bpf

[PATCH bpf-next 0/2] Move bpf_printk to bpf_helpers.h

2019-05-16 Thread Michal Rostecki
This series of patches move the commonly used bpf_printk macro to bpf_helpers.h which is already included in all BPF programs which defined that macro on their own. Michal Rostecki (2): selftests: bpf: Move bpf_printk to bpf_helpers.h samples: bpf: Do not define bpf_printk macro samples/bpf

[PATCH bpf] libbpf: Check if map names are not NULL

2019-03-20 Thread Michal Rostecki
ibbpf: Provide basic API support to specify BPF obj name") Fixes: d7be143b67c2 ("libbpf: Support expected_attach_type at prog load") Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") Signed-off-by: Michal Rostecki --- tools/lib/bpf/bpf.c | 14 +- 1 fi