提交 82e419d3 编写于 作者: D David Ahern 提交者: Zheng Zengkai

selftests: Fix raw socket bind tests with VRF

stable inclusion
from stable-v5.10.88
commit 08896ecfffc33eaffabe8f01ec7ba9ae219b3b5d
bugzilla: 186058 https://gitee.com/openeuler/kernel/issues/I4QW6A

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=08896ecfffc33eaffabe8f01ec7ba9ae219b3b5d

--------------------------------

[ Upstream commit 0f108ae4 ]

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: 75b2b2b3 ("selftests: Add ipv4 address bind tests to fcnal-test")
Reported-by: NLi Zhijian <lizhijian@fujitsu.com>
Signed-off-by: NDavid Ahern <dsahern@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 2b28f97b
...@@ -1747,8 +1747,9 @@ ipv4_addr_bind_vrf() ...@@ -1747,8 +1747,9 @@ ipv4_addr_bind_vrf()
for a in ${NSA_IP} ${VRF_IP} for a in ${NSA_IP} ${VRF_IP}
do do
log_start log_start
show_hint "Socket not bound to VRF, but address is in VRF"
run_cmd nettest -s -R -P icmp -l ${a} -b 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 log_start
run_cmd nettest -s -R -P icmp -l ${a} -d ${NSA_DEV} -b run_cmd nettest -s -R -P icmp -l ${a} -d ${NSA_DEV} -b
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册