libbpf: Add a support for getting xdp prog id on ifindex

Since we have a dedicated netlink attributes for xdp setup on a
particular interface, it is now possible to retrieve the program id that
is currently attached to the interface. The use case is targeted for
sample xdp programs, which will store the program id just after loading
bpf program onto iface. On shutdown, the sample will make sure that it
can unload the program by querying again the iface and verifying that
both program id's matches.

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>
This commit is contained in:
Maciej Fijalkowski
2019-02-01 22:42:29 +01:00
committed by Daniel Borkmann
parent 743e568c15
commit 50db9f0731
3 changed files with 87 additions and 0 deletions

View File

@@ -132,4 +132,5 @@ LIBBPF_0.0.2 {
bpf_probe_prog_type;
bpf_map_lookup_elem_flags;
bpf_object__find_map_fd_by_name;
bpf_get_link_xdp_id;
} LIBBPF_0.0.1;