Skip to content

Commit

Permalink
selftests: mptcp: sockopt: return error if wrong mark
Browse files Browse the repository at this point in the history
When an error was detected when checking the marks, a message was
correctly printed mentioning the error but followed by another one
saying everything was OK and the selftest was not marked as failed as
expected.

Now the 'ret' variable is directly set to 1 in order to make sure the
exit is done with an error, similar to what is done in other functions.
While at it, the error is correctly propagated to the caller.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
Fixes: dc65fe8 ("selftests: mptcp: add packet mark test case")
Cc: stable@vger.kernel.org
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Matthieu Baerts authored and David S. Miller committed Jul 5, 2023
1 parent a5a5990 commit 9ac4c28
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ check_mark()
for v in $values; do
if [ $v -ne 0 ]; then
echo "FAIL: got $tables $values in ns $ns , not 0 - not all expected packets marked" 1>&2
ret=1
return 1
fi
done
Expand Down Expand Up @@ -227,11 +228,11 @@ do_transfer()
fi

if [ $local_addr = "::" ];then
check_mark $listener_ns 6
check_mark $connector_ns 6
check_mark $listener_ns 6 || retc=1
check_mark $connector_ns 6 || retc=1
else
check_mark $listener_ns 4
check_mark $connector_ns 4
check_mark $listener_ns 4 || retc=1
check_mark $connector_ns 4 || retc=1
fi

check_transfer $cin $sout "file received by server"
Expand Down

0 comments on commit 9ac4c28

Please sign in to comment.