Skip to content

Commit 7e01475

Browse files
dsaherndavem330
authored andcommitted
selftests: Add duplicate config only for MD5 VRF tests
Commit referenced below added configuration in the default VRF that duplicates a VRF to check MD5 passwords are properly used and fail when expected. That config should not be added all the time as it can cause tests to pass that should not (by matching on default VRF setup when it should not). Move the duplicate setup to a function that is only called for the MD5 tests and add a cleanup function to remove it after the MD5 tests. Fixes: 5cad8bc ("fcnal-test: Add TCP MD5 tests for VRF") Signed-off-by: David Ahern <dsahern@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8f2fd39 commit 7e01475

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tools/testing/selftests/net/fcnal-test.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,22 @@ cleanup()
455455
ip netns del ${NSC} >/dev/null 2>&1
456456
}
457457

458+
cleanup_vrf_dup()
459+
{
460+
ip link del ${NSA_DEV2} >/dev/null 2>&1
461+
ip netns pids ${NSC} | xargs kill 2>/dev/null
462+
ip netns del ${NSC} >/dev/null 2>&1
463+
}
464+
465+
setup_vrf_dup()
466+
{
467+
# some VRF tests use ns-C which has the same config as
468+
# ns-B but for a device NOT in the VRF
469+
create_ns ${NSC} "-" "-"
470+
connect_ns ${NSA} ${NSA_DEV2} ${NSA_IP}/24 ${NSA_IP6}/64 \
471+
${NSC} ${NSC_DEV} ${NSB_IP}/24 ${NSB_IP6}/64
472+
}
473+
458474
setup()
459475
{
460476
local with_vrf=${1}
@@ -484,12 +500,6 @@ setup()
484500

485501
ip -netns ${NSB} ro add ${VRF_IP}/32 via ${NSA_IP} dev ${NSB_DEV}
486502
ip -netns ${NSB} -6 ro add ${VRF_IP6}/128 via ${NSA_IP6} dev ${NSB_DEV}
487-
488-
# some VRF tests use ns-C which has the same config as
489-
# ns-B but for a device NOT in the VRF
490-
create_ns ${NSC} "-" "-"
491-
connect_ns ${NSA} ${NSA_DEV2} ${NSA_IP}/24 ${NSA_IP6}/64 \
492-
${NSC} ${NSC_DEV} ${NSB_IP}/24 ${NSB_IP6}/64
493503
else
494504
ip -netns ${NSA} ro add ${NSB_LO_IP}/32 via ${NSB_IP} dev ${NSA_DEV}
495505
ip -netns ${NSA} ro add ${NSB_LO_IP6}/128 via ${NSB_IP6} dev ${NSA_DEV}
@@ -1240,7 +1250,9 @@ ipv4_tcp_vrf()
12401250
log_test_addr ${a} $? 1 "Global server, local connection"
12411251

12421252
# run MD5 tests
1253+
setup_vrf_dup
12431254
ipv4_tcp_md5
1255+
cleanup_vrf_dup
12441256

12451257
#
12461258
# enable VRF global server
@@ -2719,7 +2731,9 @@ ipv6_tcp_vrf()
27192731
log_test_addr ${a} $? 1 "Global server, local connection"
27202732

27212733
# run MD5 tests
2734+
setup_vrf_dup
27222735
ipv6_tcp_md5
2736+
cleanup_vrf_dup
27232737

27242738
#
27252739
# enable VRF global server

0 commit comments

Comments
 (0)