lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 8 Aug 2021 22:49:32 +0530
From:   Muhammad Falak Reyaz <falakreyaz@...il.com>
To:     Yonghong Song <yhs@...com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
        "open list:NETWORKING DRIVERS" <netdev@...r.kernel.org>,
        KP Singh <kpsingh@...nel.org>,
        Song Liu <songliubraving@...com>,
        Martin KaFai Lau <kafai@...com>,
        John Fastabend <john.fastabend@...il.com>,
        Jesper Dangaard Brouer <hawk@...nel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        "David S . Miller" <davem@...emloft.net>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] samples: bpf: xdp1: remove duplicate code to find protocol

On Sun, Aug 8, 2021 at 10:23 PM Yonghong Song <yhs@...com> wrote:
>
>
>
> On 8/8/21 5:24 AM, Muhammad Falak R Wani wrote:
> > The code to find h_vlan_encapsulated_proto is duplicated.
> > Remove the extra block.
> >
> > Signed-off-by: Muhammad Falak R Wani <falakreyaz@...il.com>
> > ---
> >   samples/bpf/xdp1_kern.c | 9 ---------
> >   1 file changed, 9 deletions(-)
> >
> > diff --git a/samples/bpf/xdp1_kern.c b/samples/bpf/xdp1_kern.c
> > index 34b64394ed9c..a35e064d7726 100644
> > --- a/samples/bpf/xdp1_kern.c
> > +++ b/samples/bpf/xdp1_kern.c
> > @@ -57,15 +57,6 @@ int xdp_prog1(struct xdp_md *ctx)
> >
> >       h_proto = eth->h_proto;
> >
> > -     if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
> > -             struct vlan_hdr *vhdr;
> > -
> > -             vhdr = data + nh_off;
> > -             nh_off += sizeof(struct vlan_hdr);
> > -             if (data + nh_off > data_end)
> > -                     return rc;
> > -             h_proto = vhdr->h_vlan_encapsulated_proto;
>
> No. This is not a duplicate. The h_proto in the above line will be used
> in the below "if" condition.
>
> > -     }
> >       if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
> >               struct vlan_hdr *vhdr;
> >
> >
Apologies :(
I now realize, it could be double vlan encapsulated.
Would it make sense to add an explicit comment for newbies like me ?
I can send a patch, if it is okay.

-mfrw

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ