Commit 8e870e35 authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by ZhangPeng
Browse files

selftests: mptcp: join: validate backup in MPJ

stable inclusion
from stable-v6.6.45
commit 8213b98e55ce45f101ac96ee913d603b574ebfbb
bugzilla: https://gitee.com/openeuler/kernel/issues/IAJEIR

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



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

commit 935ff5bb8a1cfcdf8e60c8f5c794d0bbbc234437 upstream.

A peer can notify the other one that a subflow has to be treated as
"backup" by two different ways: either by sending a dedicated MP_PRIO
notification, or by setting the backup flag in the MP_JOIN handshake.

The selftests were previously monitoring the former, but not the latter.
This is what is now done here by looking at these new MIB counters when
validating the 'backup' cases:

  MPTcpExtMPJoinSynBackupRx
  MPTcpExtMPJoinSynAckBackupRx

The 'Fixes' tag here below is the same as the one from the previous
commit: this patch here is not fixing anything wrong in the selftests,
but it will help to validate a new fix for an issue introduced by this
commit ID.

Fixes: 4596a2c1 ("mptcp: allow creating non-backup subflows")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent 30a7ce91
Loading
Loading
Loading
Loading
+32 −10
Original line number Diff line number Diff line
@@ -1783,6 +1783,8 @@ chk_prio_nr()
{
	local mp_prio_nr_tx=$1
	local mp_prio_nr_rx=$2
	local mpj_syn=$3
	local mpj_syn_ack=$4
	local count

	print_check "ptx"
@@ -1804,6 +1806,26 @@ chk_prio_nr()
	else
		print_ok
	fi

	print_check "syn backup"
	count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinSynBackupRx")
	if [ -z "$count" ]; then
		print_skip
	elif [ "$count" != "$mpj_syn" ]; then
		fail_test "got $count JOIN[s] syn with Backup expected $mpj_syn"
	else
		print_ok
	fi

	print_check "synack backup"
	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckBackupRx")
	if [ -z "$count" ]; then
		print_skip
	elif [ "$count" != "$mpj_syn_ack" ]; then
		fail_test "got $count JOIN[s] synack with Backup expected $mpj_syn_ack"
	else
		print_ok
	fi
}

chk_subflow_nr()
@@ -2761,7 +2783,7 @@ backup_tests()
		sflags=nobackup speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 1 1 1
		chk_prio_nr 0 1
		chk_prio_nr 0 1 1 0
	fi

	# single address, backup
@@ -2774,7 +2796,7 @@ backup_tests()
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 1 1 1
		chk_add_nr 1 1
		chk_prio_nr 1 1
		chk_prio_nr 1 1 0 0
	fi

	# single address with port, backup
@@ -2787,7 +2809,7 @@ backup_tests()
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 1 1 1
		chk_add_nr 1 1
		chk_prio_nr 1 1
		chk_prio_nr 1 1 0 0
	fi

	if reset "mpc backup" &&
@@ -2796,7 +2818,7 @@ backup_tests()
		speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 0 0 0
		chk_prio_nr 0 1
		chk_prio_nr 0 1 0 0
	fi

	if reset "mpc backup both sides" &&
@@ -2806,7 +2828,7 @@ backup_tests()
		speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 0 0 0
		chk_prio_nr 1 1
		chk_prio_nr 1 1 0 0
	fi

	if reset "mpc switch to backup" &&
@@ -2815,7 +2837,7 @@ backup_tests()
		sflags=backup speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 0 0 0
		chk_prio_nr 0 1
		chk_prio_nr 0 1 0 0
	fi

	if reset "mpc switch to backup both sides" &&
@@ -2825,7 +2847,7 @@ backup_tests()
		sflags=backup speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 0 0 0
		chk_prio_nr 1 1
		chk_prio_nr 1 1 0 0
	fi
}

@@ -3225,7 +3247,7 @@ fullmesh_tests()
		addr_nr_ns2=1 sflags=backup,fullmesh speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 2 2 2
		chk_prio_nr 0 1
		chk_prio_nr 0 1 1 0
		chk_rm_nr 0 1
	fi

@@ -3238,7 +3260,7 @@ fullmesh_tests()
		sflags=nobackup,nofullmesh speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 2 2 2
		chk_prio_nr 0 1
		chk_prio_nr 0 1 1 0
		chk_rm_nr 0 1
	fi
}
@@ -3417,7 +3439,7 @@ userspace_tests()
		sflags=backup speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		chk_join_nr 1 1 0
		chk_prio_nr 0 0
		chk_prio_nr 0 0 0 0
	fi

	# userspace pm type prevents rm_addr