All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: daniel@iogearbox.net, ast@kernel.org
Cc: netdev@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Andrey Ignatov <rdna@fb.com>
Subject: [PATCH bpf] libbpf: Only check mode flags in get_xdp_id
Date: Mon, 20 Apr 2020 10:18:43 -0600	[thread overview]
Message-ID: <20200420161843.46606-1-dsahern@kernel.org> (raw)

From: David Ahern <dsahern@gmail.com>

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 <dsahern@gmail.com>
Cc: Andrey Ignatov <rdna@fb.com>
---
 tools/lib/bpf/netlink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/lib/bpf/netlink.c b/tools/lib/bpf/netlink.c
index 342acacf7cda..692749d87348 100644
--- a/tools/lib/bpf/netlink.c
+++ b/tools/lib/bpf/netlink.c
@@ -352,6 +352,8 @@ int bpf_get_link_xdp_egress_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)
-- 
2.20.1


             reply	other threads:[~2020-04-20 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 16:18 David Ahern [this message]
2020-04-20 16:27 ` [PATCH bpf] libbpf: Only check mode flags in get_xdp_id Andrey Ignatov
2020-04-23  5:08   ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200420161843.46606-1-dsahern@kernel.org \
    --to=dsahern@kernel.org \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rdna@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.