diff options
| author | David Ahern <[email protected]> | 2020-04-20 16:18:43 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2020-04-23 05:07:22 +0000 |
| commit | 257d7d4f0e69f5e8e3d38351bdcab896719dba04 (patch) | |
| tree | f049c1d1032b49cf4cd52751771b27defc1a4f38 /tools/lib/bpf/netlink.c | |
| parent | bpf, selftests: Add test for BPF_STX BPF_B storing R10 (diff) | |
| download | kernel-257d7d4f0e69f5e8e3d38351bdcab896719dba04.tar.gz kernel-257d7d4f0e69f5e8e3d38351bdcab896719dba04.zip | |
libbpf: Only check mode flags in get_xdp_id
The commit in the Fixes tag changed get_xdp_id to only return prog_id
if flags is 0, but there are other XDP flags than the modes - e.g.,
XDP_FLAGS_UPDATE_IF_NOEXIST. Since the intention was only to look at
MODE flags, clear other ones before checking if flags is 0.
Fixes: f07cbad29741 ("libbpf: Fix bpf_get_link_xdp_id flags handling")
Signed-off-by: David Ahern <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: Andrey Ignatov <[email protected]>
Diffstat (limited to 'tools/lib/bpf/netlink.c')
| -rw-r--r-- | tools/lib/bpf/netlink.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/lib/bpf/netlink.c b/tools/lib/bpf/netlink.c index 0b709fd10bba..312f887570b2 100644 --- a/tools/lib/bpf/netlink.c +++ b/tools/lib/bpf/netlink.c @@ -321,6 +321,8 @@ int bpf_get_link_xdp_info(int ifindex, struct xdp_link_info *info, static __u32 get_xdp_id(struct xdp_link_info *info, __u32 flags) { + flags &= XDP_FLAGS_MODES; + if (info->attach_mode != XDP_ATTACHED_MULTI && !flags) return info->prog_id; if (flags & XDP_FLAGS_DRV_MODE) |
