Skip to content

Commit

Permalink
selftests: Fix raw socket bind tests with VRF
Browse files Browse the repository at this point in the history
Commit referenced below added negative socket bind tests for VRF. The
socket binds should fail since the address to bind to is in a VRF yet
the socket is not bound to the VRF or a device within it. Update the
expected return code to check for 1 (bind failure) so the test passes
when the bind fails as expected. Add a 'show_hint' comment to explain
why the bind is expected to fail.

Fixes: 75b2b2b ("selftests: Add ipv4 address bind tests to fcnal-test")
Reported-by: Li Zhijian <[email protected]>
Signed-off-by: David Ahern <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
dsahern authored and davem330 committed Dec 12, 2021
1 parent 7e01475 commit 0f108ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/testing/selftests/net/fcnal-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1810,8 +1810,9 @@ ipv4_addr_bind_vrf()
for a in ${NSA_IP} ${VRF_IP}
do
log_start
show_hint "Socket not bound to VRF, but address is in VRF"
run_cmd nettest -s -R -P icmp -l ${a} -b
log_test_addr ${a} $? 0 "Raw socket bind to local address"
log_test_addr ${a} $? 1 "Raw socket bind to local address"

log_start
run_cmd nettest -s -R -P icmp -l ${a} -I ${NSA_DEV} -b
Expand Down

0 comments on commit 0f108ae

Please sign in to comment.