[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190415224612.qwxqmuxhojcerdgn@kafai-mbp.dhcp.thefacebook.com>
Date: Mon, 15 Apr 2019 22:46:15 +0000
From: Martin Lau <kafai@...com>
To: Viet Hoang Tran <hoang.tran@...ouvain.be>
CC: "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
"Daniel Borkmann" <daniel@...earbox.net>,
"David S. Miller" <davem@...emloft.net>,
Lawrence Brakmo <brakmo@...com>,
Quentin Monnet <quentin.monnet@...ronome.com>,
"tranviethoang.vn@...il.com" <tranviethoang.vn@...il.com>
Subject: Re: [PATCH bpf] bpf: allow clearing all sock_ops callback flags
On Mon, Apr 15, 2019 at 09:54:55AM +0000, Viet Hoang Tran wrote:
> The helper function bpf_sock_ops_cb_flags_set() can be used to both
> set and clear the sock_ops callback flags. However, its current
> behavior is not consistent. BPF program may clear a flag if more than
> one were set, or replace a flag with another one, but cannot clear all
> flags.
>
> This patch also updates the documentation to clarify the ability to
> clear flags of this helper function.
>
[ ... ]
> diff --git a/net/core/filter.c b/net/core/filter.c
> index fc92ebc4e200..0c4cdfbb2fc7 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4355,8 +4355,7 @@ BPF_CALL_2(bpf_sock_ops_cb_flags_set, struct bpf_sock_ops_kern *, bpf_sock,
> if (!IS_ENABLED(CONFIG_INET) || !sk_fullsock(sk))
> return -EINVAL;
>
> - if (val)
> - tcp_sk(sk)->bpf_sock_ops_cb_flags = val;
> + tcp_sk(sk)->bpf_sock_ops_cb_flags = val;
Acked-by: Martin KaFai Lau <kafai@...com>
>
> return argval & (~BPF_SOCK_OPS_ALL_CB_FLAGS);
> }
> --
> 2.17.1
>
Powered by blists - more mailing lists