[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGdtWsQ4aigyJUjBxmFQ8C5zU_4p-t0K2=uwVg2NxdUQuh-WoQ@mail.gmail.com>
Date: Thu, 16 Jan 2020 09:45:08 -0800
From: Petar Penkov <ppenkov.kernel@...il.com>
To: Yoshiki Komachi <komachi.yoshiki@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH bpf 1/2] flow_dissector: Fix to use new variables for port
ranges in bpf hook
On Thu, Jan 16, 2020 at 1:13 AM Yoshiki Komachi
<komachi.yoshiki@...il.com> wrote:
>
> This patch applies new flag (FLOW_DISSECTOR_KEY_PORTS_RANGE) and
> field (tp_range) to BPF flow dissector to generate appropriate flow
> keys when classified by specified port ranges.
>
> Fixes: 8ffb055beae5 ("cls_flower: Fix the behavior using port ranges with hw-offload")
> Signed-off-by: Yoshiki Komachi <komachi.yoshiki@...il.com>
> ---
> net/core/flow_dissector.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 2dbbb03..06bbcc3 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -876,10 +876,17 @@ static void __skb_flow_bpf_to_target(const struct bpf_flow_keys *flow_keys,
> key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
> }
>
> - if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS)) {
> + if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS))
> key_ports = skb_flow_dissector_target(flow_dissector,
> FLOW_DISSECTOR_KEY_PORTS,
> target_container);
> + else if (dissector_uses_key(flow_dissector,
> + FLOW_DISSECTOR_KEY_PORTS_RANGE))
> + key_ports = skb_flow_dissector_target(flow_dissector,
> + FLOW_DISSECTOR_KEY_PORTS_RANGE,
> + target_container);
> +
> + if (key_ports) {
If the flow dissector uses neither FLOW_DISSECTOR_KEY_PORTS_RANGE, nor
FLOW_DISSECTOR_KEY_PORTS, I believe key_ports would be used
uninitialized here. We should probably explicitly set it to NULL at
the top of this function.
> key_ports->src = flow_keys->sport;
> key_ports->dst = flow_keys->dport;
> }
> --
> 1.8.3.1
>
Powered by blists - more mailing lists