samples/bpf: Check the prog id before exiting
authorMaciej Fijalkowski <maciejromanfijalkowski@gmail.com>
Fri, 1 Feb 2019 21:42:30 +0000 (22:42 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 1 Feb 2019 22:37:51 +0000 (23:37 +0100)
commit3b7a8ec2dec3e408288dbc80b8aef25df20ba119
tree234d9207292e271029c3615016f5625e05d3b5d0
parent50db9f0731889b9f3839cab5f44163733eb44f04
samples/bpf: Check the prog id before exiting

Check the program id within the signal handler on polling xdp samples
that were previously converted to libbpf usage. Avoid the situation of
unloading the program that was not attached by sample that is exiting.
Handle also the case where bpf_get_link_xdp_id didn't exit with an error
but the xdp program was not found on an interface.

Reported-by: Michal Papaj <michal.papaj@intel.com>
Reported-by: Jakub Spizewski <jakub.spizewski@intel.com>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
samples/bpf/xdp1_user.c
samples/bpf/xdp_adjust_tail_user.c
samples/bpf/xdp_redirect_cpu_user.c
samples/bpf/xdp_redirect_map_user.c
samples/bpf/xdp_redirect_user.c
samples/bpf/xdp_router_ipv4_user.c
samples/bpf/xdp_rxq_info_user.c
samples/bpf/xdp_sample_pkts_user.c
samples/bpf/xdp_tx_iptunnel_user.c
samples/bpf/xdpsock_user.c