Re: [PATCH bpf 1/2] flow_dissector: Fix to use new variables for port ranges in bpf hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2020年1月17日(金) 2:45 Petar Penkov <ppenkov.kernel@xxxxxxxxx>:
>
> On Thu, Jan 16, 2020 at 1:13 AM Yoshiki Komachi
> <komachi.yoshiki@xxxxxxxxx> 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@xxxxxxxxx>
> > ---
> >  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
> >




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux