Skip to content

Commit

Permalink
selftests: mptcp: join: use 'iptables-legacy' if available
Browse files Browse the repository at this point in the history
commit 0c4cd3f upstream.

IPTables commands using 'iptables-nft' fail on old kernels, at least
5.15 because it doesn't see the default IPTables chains:

  $ iptables -L
  iptables/1.8.2 Failed to initialize nft: Protocol not supported

As a first step before switching to NFTables, we can use iptables-legacy
if available.

Link: multipath-tcp/mptcp_net-next#368
Fixes: 8d014ea ("selftests: mptcp: add ADD_ADDR timeout test case")
Cc: [email protected]
Signed-off-by: Matthieu Baerts <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
matttbe authored and Fishwaldo committed Aug 20, 2023
1 parent 550958d commit 1159b34
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ cinfail=""
cinsent=""
cout=""
ksft_skip=4
iptables="iptables"
ip6tables="ip6tables"
timeout_poll=30
timeout_test=$((timeout_poll * 2 + 1))
mptcp_connect=""
Expand Down Expand Up @@ -126,9 +128,9 @@ reset_with_add_addr_timeout()
local ip="${1:-4}"
local tables

tables="iptables"
tables="${iptables}"
if [ $ip -eq 6 ]; then
tables="ip6tables"
tables="${ip6tables}"
fi

reset
Expand Down Expand Up @@ -171,8 +173,10 @@ if [ $? -ne 0 ];then
exit $ksft_skip
fi

iptables -V > /dev/null 2>&1
if [ $? -ne 0 ];then
if iptables-legacy -V &> /dev/null; then
iptables="iptables-legacy"
ip6tables="ip6tables-legacy"
elif ! iptables -V &> /dev/null; then
echo "SKIP: Could not run all tests without iptables tool"
exit $ksft_skip
fi
Expand Down

0 comments on commit 1159b34

Please sign in to comment.