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: <01747e34-c655-4dbf-bda9-544f4e3f8ebd@machnikowski.net>
Date: Sat, 10 Feb 2024 09:48:09 +0100
From: Maciek Machnikowski <maciek@...hnikowski.net>
To: David Wei <dw@...idwei.uk>, Jakub Kicinski <kuba@...nel.org>,
 Jiri Pirko <jiri@...nulli.us>, Sabrina Dubroca <sd@...asysnail.net>,
 netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next v9 3/3] netdevsim: add selftest for forwarding
 skb between connected ports


On 10/02/2024 01:32, David Wei wrote:
> +###
> +### Code start
> +###
> +
> +modprobe netdevsim
> +
> +# linking
> +
> +echo $NSIM_DEV_1_ID > $NSIM_DEV_SYS_NEW
> +echo $NSIM_DEV_2_ID > $NSIM_DEV_SYS_NEW
> +
> +setup_ns
> +
> +NSIM_DEV_1_FD=$((RANDOM % 1024))
> +exec {NSIM_DEV_1_FD}</var/run/netns/nssv
> +NSIM_DEV_1_IFIDX=$(ip netns exec nssv cat /sys/class/net/$NSIM_DEV_1_NAME/ifindex)
> +
> +NSIM_DEV_2_FD=$((RANDOM % 1024))
> +exec {NSIM_DEV_2_FD}</var/run/netns/nscl
> +NSIM_DEV_2_IFIDX=$(ip netns exec nscl cat /sys/class/net/$NSIM_DEV_2_NAME/ifindex)
> +
> +echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX $NSIM_DEV_2_FD:2000" > $NSIM_DEV_SYS_LINK 2>/dev/null
> +if [ $? -eq 0 ]; then
> +	echo "linking with non-existent netdevsim should fail"
> +	exit 1
> +fi
> +
> +echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX 2000:$NSIM_DEV_2_IFIDX" > $NSIM_DEV_SYS_LINK 2>/dev/null
> +if [ $? -eq 0 ]; then
> +	echo "linking with non-existent netnsid should fail"
> +	exit 1
> +fi
> +
> +echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX $NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX" > $NSIM_DEV_SYS_LINK 2>/dev/null
> +if [ $? -eq 0 ]; then
> +	echo "linking with self should fail"
> +	exit 1
> +fi
> +
> +echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX $NSIM_DEV_2_FD:$NSIM_DEV_2_IFIDX" > $NSIM_DEV_SYS_LINK
> +if [ $? -ne 0 ]; then
> +	echo "linking netdevsim1 with netdevsim2 should succeed"
> +	exit 1
> +fi
> +
> +# argument error checking
> +
> +echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX $NSIM_DEV_2_FD:a" > $NSIM_DEV_SYS_LINK 2>/dev/null
> +if [ $? -eq 0 ]; then
> +	echo "invalid arg should fail"
> +	exit 1
> +fi
> +
> +# send/recv packets
> +
> +socat_check || exit 4

This check will cause the script to exit without cleaning up the devices
and namespaces. Move it to the top, or cleanup on error

Thanks,
Maciek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ