* [PATCH bpf] libbpf: Only check mode flags in get_xdp_id
@ 2020-04-20 16:18 David Ahern
2020-04-20 16:27 ` Andrey Ignatov
0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2020-04-20 16:18 UTC (permalink / raw)
To: daniel, ast; +Cc: netdev, David Ahern, Andrey Ignatov
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] libbpf: Only check mode flags in get_xdp_id
2020-04-20 16:18 [PATCH bpf] libbpf: Only check mode flags in get_xdp_id David Ahern
@ 2020-04-20 16:27 ` Andrey Ignatov
2020-04-23 5:08 ` Alexei Starovoitov
0 siblings, 1 reply; 3+ messages in thread
From: Andrey Ignatov @ 2020-04-20 16:27 UTC (permalink / raw)
To: David Ahern; +Cc: daniel, ast, netdev, David Ahern
David Ahern <dsahern@kernel.org> [Mon, 2020-04-20 09:18 -0700]:
> 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>
Makes sense. Thanks.
Acked-by: 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
>
--
Andrey Ignatov
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] libbpf: Only check mode flags in get_xdp_id
2020-04-20 16:27 ` Andrey Ignatov
@ 2020-04-23 5:08 ` Alexei Starovoitov
0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-04-23 5:08 UTC (permalink / raw)
To: Andrey Ignatov
Cc: David Ahern, Daniel Borkmann, Alexei Starovoitov,
Network Development, David Ahern
On Mon, Apr 20, 2020 at 9:27 AM Andrey Ignatov <rdna@fb.com> wrote:
>
> David Ahern <dsahern@kernel.org> [Mon, 2020-04-20 09:18 -0700]:
> > 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>
>
> Makes sense. Thanks.
>
> Acked-by: Andrey Ignatov <rdna@fb.com>
Applied. Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-23 5:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-20 16:18 [PATCH bpf] libbpf: Only check mode flags in get_xdp_id David Ahern
2020-04-20 16:27 ` Andrey Ignatov
2020-04-23 5:08 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).