Skip to content

Commit 257d7d4

Browse files
dsahernAlexei Starovoitov
authored andcommitted
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: f07cbad ("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]>
1 parent d2b6c3a commit 257d7d4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/lib/bpf/netlink.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ int bpf_get_link_xdp_info(int ifindex, struct xdp_link_info *info,
321321

322322
static __u32 get_xdp_id(struct xdp_link_info *info, __u32 flags)
323323
{
324+
flags &= XDP_FLAGS_MODES;
325+
324326
if (info->attach_mode != XDP_ATTACHED_MULTI && !flags)
325327
return info->prog_id;
326328
if (flags & XDP_FLAGS_DRV_MODE)

0 commit comments

Comments
 (0)