[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200420162715.GA91440@rdna-mbp>
Date: Mon, 20 Apr 2020 09:27:15 -0700
From: Andrey Ignatov <rdna@...com>
To: David Ahern <dsahern@...nel.org>
CC: <daniel@...earbox.net>, <ast@...nel.org>, <netdev@...r.kernel.org>,
David Ahern <dsahern@...il.com>
Subject: Re: [PATCH bpf] libbpf: Only check mode flags in get_xdp_id
David Ahern <dsahern@...nel.org> [Mon, 2020-04-20 09:18 -0700]:
> From: David Ahern <dsahern@...il.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@...il.com>
> Cc: Andrey Ignatov <rdna@...com>
Makes sense. Thanks.
Acked-by: Andrey Ignatov <rdna@...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
Powered by blists - more mailing lists