Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: netfilter: missing error check when setting up veth interface

A test for the basic NAT functionality uses ip command which needs veth
device. There is a condition where the kernel support for veth is not
compiled into the kernel and the test script breaks. This patch contains
code for reasonable error display and correct code exit.

Signed-off-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Jeffrin Jose T and committed by
Pablo Neira Ayuso
82ce6eb1 719c7d56

+5 -1
+5 -1
tools/testing/selftests/netfilter/nft_nat.sh
··· 24 24 ip netns add ns1 25 25 ip netns add ns2 26 26 27 - ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 27 + ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 > /dev/null 2>&1 28 + if [ $? -ne 0 ];then 29 + echo "SKIP: No virtual ethernet pair device support in kernel" 30 + exit $ksft_skip 31 + fi 28 32 ip link add veth1 netns ns0 type veth peer name eth0 netns ns2 29 33 30 34 ip -net ns0 link set lo up