[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAA6waG+y97Uw-0OVYXwCz_wRUiDyWSfXr5VmzXofDhAf1Og9pw@mail.gmail.com>
Date: Fri, 17 Jan 2020 10:50:12 +0900
From: Yoshiki Komachi <komachi.yoshiki@...il.com>
To: Petar Penkov <ppenkov.kernel@...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
2020年1月17日(金) 2:45 Petar Penkov <ppenkov.kernel@...il.com>:
>
> 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.
Thank you for kind comments.
I will fix it, and submit the next version later.
Best regards,
--
Yoshiki Komachi
> > key_ports->src = flow_keys->sport;
> > key_ports->dst = flow_keys->dport;
> > }
> > --
> > 1.8.3.1
> >
Powered by blists - more mailing lists