Unverified Commit 944ce05f authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15302 [openEuler-24.03-LTS][linux-6.6.y sync] Backport 6.6.57-6.6.58 LTS Conflicts Patches

Merge Pull Request from: @koishimind 
 
Do nothing because merged(3):
1. Merged as CVE-2024-50200
https://gitee.com/openeuler/kernel/pulls/14013
maple_tree: correct tree corruption on spanning store
2. Merged as CVE-2024-50192
https://gitee.com/openeuler/kernel/pulls/13831
irqchip/gic-v4: Don't allow a VMOVP on a dying VPE
3. As lts special patch, but no need for the branch(No relevant)
selftests: mptcp: remove duplicated variables

Submit after modification(1):
1.Use upstream version for in OLK-6.6 same as upstream(not upstream/linux-6.6.y), so import upstream ver.
selftests: mptcp: join: test for prohibited MPC to port-based endp 
 
Link:https://gitee.com/openeuler/kernel/pulls/15302

 

Reviewed-by: default avatarZhang Peng <zhangpeng362@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents f236c07e e4d6668e
Loading
Loading
Loading
Loading
+85 −30
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ tmpfile=""
cout=""
err=""
capout=""
cappid=""
ns1=""
ns2=""
iptables="iptables"
@@ -969,40 +970,62 @@ check_cestab()
	fi
}

do_transfer()
cond_start_capture()
{
	local listener_ns="$1"
	local connector_ns="$2"
	local cl_proto="$3"
	local srv_proto="$4"
	local connect_addr="$5"

	local port=$((10000 + MPTCP_LIB_TEST_COUNTER - 1))
	local cappid
	local FAILING_LINKS=${FAILING_LINKS:-""}
	local fastclose=${fastclose:-""}
	local speed=${speed:-"fast"}
	local ns="$1"

	:> "$cout"
	:> "$sout"
	:> "$capout"

	if $capture; then
		local capuser
		local capuser capfile
		if [ -z $SUDO_USER ]; then
			capuser=""
		else
			capuser="-Z $SUDO_USER"
		fi

		capfile=$(printf "mp_join-%02u-%s.pcap" "$MPTCP_LIB_TEST_COUNTER" "${listener_ns}")
		capfile=$(printf "mp_join-%02u-%s.pcap" "$MPTCP_LIB_TEST_COUNTER" "$ns")

		echo "Capturing traffic for test $MPTCP_LIB_TEST_COUNTER into $capfile"
		ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &
		ip netns exec "$ns" tcpdump -i any -s 65535 -B 32768 $capuser -w "$capfile" > "$capout" 2>&1 &
		cappid=$!

		sleep 1
	fi
}

cond_stop_capture()
{
	if $capture; then
		sleep 1
		kill $cappid
		cat "$capout"
	fi
}

get_port()
{
	echo "$((10000 + MPTCP_LIB_TEST_COUNTER - 1))"
}

do_transfer()
{
	local listener_ns="$1"
	local connector_ns="$2"
	local cl_proto="$3"
	local srv_proto="$4"
	local connect_addr="$5"
	local port

	local FAILING_LINKS=${FAILING_LINKS:-""}
	local fastclose=${fastclose:-""}
	local speed=${speed:-"fast"}
	port=$(get_port)

	:> "$cout"
	:> "$sout"

	cond_start_capture ${listener_ns}

	NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \
		nstat -n
@@ -1089,10 +1112,7 @@ do_transfer()
	wait $spid
	local rets=$?

	if $capture; then
	    sleep 1
	    kill $cappid
	fi
	cond_stop_capture

	NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \
		nstat | grep Tcp > /tmp/${listener_ns}.out
@@ -1108,7 +1128,6 @@ do_transfer()
		ip netns exec ${connector_ns} ss -Menita 1>&2 -o "dport = :$port"
		cat /tmp/${connector_ns}.out

		cat "$capout"
		return 1
	fi

@@ -1125,13 +1144,7 @@ do_transfer()
	fi
	rets=$?

	if [ $retc -eq 0 ] && [ $rets -eq 0 ];then
		cat "$capout"
		return 0
	fi

	cat "$capout"
	return 1
	[ $retc -eq 0 ] && [ $rets -eq 0 ]
}

make_file()
@@ -2894,6 +2907,32 @@ verify_listener_events()
	fail_test
}

chk_mpc_endp_attempt()
{
	local retl=$1
	local attempts=$2

	print_check "Connect"

	if [ ${retl} = 124 ]; then
		fail_test "timeout on connect"
	elif [ ${retl} = 0 ]; then
		fail_test "unexpected successful connect"
	else
		print_ok

		print_check "Attempts"
		count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPCapableEndpAttempt")
		if [ -z "$count" ]; then
			print_skip
		elif [ "$count" != "$attempts" ]; then
			fail_test "got ${count} MPC attempt[s] on port-based endpoint, expected ${attempts}"
		else
			print_ok
		fi
	fi
}

add_addr_ports_tests()
{
	# signal address with port
@@ -2984,6 +3023,22 @@ add_addr_ports_tests()
		chk_join_nr 2 2 2
		chk_add_nr 2 2 2
	fi

	if reset "port-based signal endpoint must not accept mpc"; then
		local port retl count
		port=$(get_port)

		cond_start_capture ${ns1}
		pm_nl_add_endpoint ${ns1} 10.0.2.1 flags signal port ${port}
		mptcp_lib_wait_local_port_listen ${ns1} ${port}

		timeout 1 ip netns exec ${ns2} \
			./mptcp_connect -t ${timeout_poll} -p $port -s MPTCP 10.0.2.1 >/dev/null 2>&1
		retl=$?
		cond_stop_capture

		chk_mpc_endp_attempt ${retl} 1
	fi
}

syncookies_tests()