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]
Message-ID: <YfI+b3JQw5w355Zd@Laptop-X1>
Date:   Thu, 27 Jan 2022 14:40:47 +0800
From:   Hangbin Liu <liuhangbin@...il.com>
To:     John Fastabend <john.fastabend@...il.com>
Cc:     netdev@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
        Jakub Kicinski <kuba@...nel.org>,
        "David S . Miller" <davem@...emloft.net>,
        Mathieu Xhonneux <m.xhonneux@...il.com>,
        Lorenz Bauer <lmb@...udflare.com>,
        William Tu <u9012063@...il.com>,
        Toshiaki Makita <toshiaki.makita1@...il.com>,
        Jesper Dangaard Brouer <brouer@...hat.com>
Subject: Re: [PATCH bpf 1/7] selftests/bpf/test_xdp_redirect_multi: use temp
 netns for testing

On Wed, Jan 26, 2022 at 09:34:52PM -0800, John Fastabend wrote:
> Hangbin Liu wrote:
> > Use temp netns instead of hard code name for testing in case the netns
> > already exists.
> > 
> > Remove the hard code interface index when creating the veth interfaces.
> > Because when the system loads some virtual interface modules, e.g. tunnels.
> > the ifindex of 2 will be used and the cmd will fail.
> > 
> > As the netns has not created if checking environment failed. Trap the
> > clean up function after checking env.
> > 
> > Fixes: 8955c1a32987 ("selftests/bpf/xdp_redirect_multi: Limit the tests in netns")
> > Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> > ---
> >  .../selftests/bpf/test_xdp_redirect_multi.sh  | 60 ++++++++++---------
> >  1 file changed, 31 insertions(+), 29 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/test_xdp_redirect_multi.sh b/tools/testing/selftests/bpf/test_xdp_redirect_multi.sh
> > index 05f872740999..cc57cb87e65f 100755
> > --- a/tools/testing/selftests/bpf/test_xdp_redirect_multi.sh
> > +++ b/tools/testing/selftests/bpf/test_xdp_redirect_multi.sh
> > @@ -32,6 +32,11 @@ DRV_MODE="xdpgeneric xdpdrv xdpegress"
> >  PASS=0
> >  FAIL=0
> >  LOG_DIR=$(mktemp -d)
> > +declare -a NS
> > +NS[0]="ns0-$(mktemp -u XXXXXX)"
> > +NS[1]="ns1-$(mktemp -u XXXXXX)"
> > +NS[2]="ns2-$(mktemp -u XXXXXX)"
> > +NS[3]="ns3-$(mktemp -u XXXXXX)"
> >  
> >  test_pass()
> >  {
> > @@ -47,11 +52,9 @@ test_fail()
> >  
> >  clean_up()
> >  {
> > -	for i in $(seq $NUM); do
> > -		ip link del veth$i 2> /dev/null
> > -		ip netns del ns$i 2> /dev/null
> > +	for i in $(seq 0 $NUM); do
> > +		ip netns del ${NS[$i]} 2> /dev/null
> 
> You dropped the `ip link del veth$i` why is this ok?

All the veth interfaces are created and attached in the netns. So remove
the netns should also remove related veth interfaces.

[...]
> ip -n ${NS[$i]} link add veth0 type veth peer name veth$i netns ${NS[0]} 
[...]

Thanks
Hangbin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ