selftests: Fix IPv6 address bind tests
Subsystems (3)
PATCH 1/1 selftests: Fix IPv6 address bind tests
IPv6 allows binding a socket to a device then binding to an address not on the device (__inet6_bind -> ipv6_chk_addr with strict flag not set). Update the bind tests to reflect legacy behavior.
Fixes 34d0302ab861 ("selftests: Add ipv6 address bind tests to fcnal-test")
Reported-by Li Zhijian <[email protected]>
Signed-off-by David Ahern <[email protected]>
--- tools/testing/selftests/net/fcnal-test.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
tools/testing/selftests/net/fcnal-test.sh +11 -3
@@ -3461,11 +3461,14 @@ ipv6_addr_bind_novrf() run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b log_test_addr ${a} $? 0 "TCP socket bind to local address after device bind" + # Sadly, the kernel allows binding a socket to a device and then + # binding to an address not on the device. So this test passes + # when it really should not a=${NSA_LO_IP6} log_start - show_hint "Should fail with 'Cannot assign requested address'" + show_hint "Tecnically should fail since address is not on device but kernel allows" run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b - log_test_addr ${a} $? 1 "TCP socket bind to out of scope local address" + log_test_addr ${a} $? 0 "TCP socket bind to out of scope local address" } ipv6_addr_bind_vrf()
@@ -3514,10 +3517,15 @@ ipv6_addr_bind_vrf() run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b log_test_addr ${a} $? 0 "TCP socket bind to local address with device bind" + # Sadly, the kernel allows binding a socket to a device and then + # binding to an address not on the device. The only restriction + # is that the address is valid in the L3 domain. So this test + # passes when it really should not a=${VRF_IP6} log_start + show_hint "Tecnically should fail since address is not on device but kernel allows" run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b - log_test_addr ${a} $? 1 "TCP socket bind to VRF address with device bind" + log_test_addr ${a} $? 0 "TCP socket bind to VRF address with device bind" a=${NSA_LO_IP6} log_start
Signature · 1 line
2.25.1
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 9 lines · On Sat, 11 Dec 2021 11:26:16 -0700 you wrote:
IPv6 allows binding a socket to a device then binding to an address not on the device (
__inet6_bind->ipv6_chk_addrwith strict flag not set). Update the bind tests to reflect legacy behavior.Fixes 34d0302ab861 ("selftests: Add ipv6 address bind tests to fcnal-test")Reported-by Li Zhijian <[email protected]>Signed-off-by David Ahern <[email protected]>[...]
Here is the summary with links:
- [net] selftests: Fix IPv6 address bind tests
https://git.kernel.org/netdev/net/c/28a2686c185e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html