From nobody Wed Dec 4 19:02:18 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8C501DDE9; Mon, 4 Mar 2024 16:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709570698; cv=none; b=TEB7Sljq89U8HoIw3ZESKZUiviFJ9hyImFzi05z7oESOZSIrHQ5jDfg4ObWxYUMJvqvMxAgNJT3DJK3CinTHpBaFZNAhk/Jpj95aC2GVXwl9AE4J0z8pabRaxZOPMXgelZUmqr+ugTG8i+J316393+9DSJ86fF1TjQ3kEksn+QA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709570698; c=relaxed/simple; bh=myyfQe8E3oc1FJ5YvqbEmh7bRvQTBtBJrRZOMIcKjFg=; h=Subject:To:Cc:From:Date:In-Reply-To:Message-ID:MIME-Version: Content-Type; b=MPKSwntVSE/fOoEdIfty0MmbolVs53UCyHr6hp4IThNRKGlR/Kf5/HqTLdV3Brf78VQsKGiodI5LVS97Z063EErbT8TfcXJktfI4WqMIiaEsmIOYEFEICd3iwMUAYd6ulvYVPbhm2jxbLNg7TblM8TKJdxpKj/LLkC7OzmYvzlk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Psxe5Rqa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Psxe5Rqa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9AFBC433C7; Mon, 4 Mar 2024 16:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709570698; bh=myyfQe8E3oc1FJ5YvqbEmh7bRvQTBtBJrRZOMIcKjFg=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=Psxe5Rqa0f8lWPKwNrv41002S8V1owOabqJYTpiReSEA/epEgfJ+BzMRMt77KKeg3 c+X4X217hb0G1NDodXum7/dp05HBJeSWt3CCMZyeeccX/I3NCWOPgFtBex7ywMSwb3 9HYCb3CwoJ6+KUoE+ou6kQmMm3pIgth33NbcxyXA= Subject: Patch "selftests: mptcp: add evts_get_info helper" has been added to the 6.7-stable tree To: geliang.tang@suse.com,gregkh@linuxfoundation.org,kuba@kernel.org,martineau@kernel.org,matttbe@kernel.org,mptcp@lists.linux.dev Cc: From: Date: Mon, 04 Mar 2024 17:44:55 +0100 In-Reply-To: <20240304133827.1989736-8-matttbe@kernel.org> Message-ID: <2024030455-gopher-runner-a1a9@gregkh> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-stable: commit X-Patchwork-Hint: ignore Content-Type: text/plain; charset="utf-8" This is a note to let you know that I've just added the patch titled selftests: mptcp: add evts_get_info helper to the 6.7-stable tree which can be found at: http://www.kernel.org/git/?p=3Dlinux/kernel/git/stable/stable-queue.git= ;a=3Dsummary The filename of the patch is: selftests-mptcp-add-evts_get_info-helper.patch and it can be found in the queue-6.7 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. From stable+bounces-25926-greg=3Dkroah.com@vger.kernel.org Mon Mar 4 14:39= :47 2024 From: "Matthieu Baerts (NGI0)" Date: Mon, 4 Mar 2024 14:38:29 +0100 Subject: selftests: mptcp: add evts_get_info helper To: stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: MPTCP Upstream , Geliang Tang , Matthieu Baerts , Mat Martineau , Jakub Kicinski Message-ID: <20240304133827.1989736-8-matttbe@kernel.org> From: Geliang Tang commit 06848c0f341ee3f9226ed01e519c72e4d2b6f001 upstream. This patch adds a new helper get_info_value(), using 'sed' command to parse the value of the given item name in the line with the given keyword, to make chk_mptcp_info() and pedit_action_pkts() more readable. Also add another helper evts_get_info() to use get_info_value() to parse the output of 'pm_nl_ctl events' command, to make all the userspace pm selftests more readable, both in mptcp_join.sh and userspace_pm.sh. Reviewed-by: Matthieu Baerts Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau Link: https://lore.kernel.org/r/20231128-send-net-next-2023107-v4-2-8d6b941= 50f6b@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 19 ++-- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 10 ++ tools/testing/selftests/net/mptcp/userspace_pm.sh | 86 +++++++++--------= ----- 3 files changed, 57 insertions(+), 58 deletions(-) --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1845,10 +1845,8 @@ chk_mptcp_info() =20 print_check "mptcp_info ${info1:0:8}=3D$exp1:$exp2" =20 - cnt1=3D$(ss -N $ns1 -inmHM | grep "$info1:" | - sed -n 's/.*\('"$info1"':\)\([[:digit:]]*\).*$/\2/p;q') - cnt2=3D$(ss -N $ns2 -inmHM | grep "$info2:" | - sed -n 's/.*\('"$info2"':\)\([[:digit:]]*\).*$/\2/p;q') + cnt1=3D$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value "$info1" "$info1") + cnt2=3D$(ss -N $ns2 -inmHM | mptcp_lib_get_info_value "$info2" "$info2") # 'ss' only display active connections and counters that are not 0. [ -z "$cnt1" ] && cnt1=3D0 [ -z "$cnt2" ] && cnt2=3D0 @@ -2824,13 +2822,13 @@ verify_listener_events() return fi =20 - type=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(type:\)\([[:digit:]]*\= ).*$/\2/p;q') - family=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(family:\)\([[:digit:= ]]*\).*$/\2/p;q') - sport=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(sport:\)\([[:digit:]]= *\).*$/\2/p;q') + type=3D$(mptcp_lib_evts_get_info type "$evt" "$e_type") + family=3D$(mptcp_lib_evts_get_info family "$evt" "$e_type") + sport=3D$(mptcp_lib_evts_get_info sport "$evt" "$e_type") if [ $family ] && [ $family =3D $AF_INET6 ]; then - saddr=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(saddr6:\)\([0-9a-f:.= ]*\).*$/\2/p;q') + saddr=3D$(mptcp_lib_evts_get_info saddr6 "$evt" "$e_type") else - saddr=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(saddr4:\)\([0-9.]*\)= .*$/\2/p;q') + saddr=3D$(mptcp_lib_evts_get_info saddr4 "$evt" "$e_type") fi =20 if [ $type ] && [ $type =3D $e_type ] && @@ -3225,8 +3223,7 @@ fastclose_tests() pedit_action_pkts() { tc -n $ns2 -j -s action show action pedit index 100 | \ - grep "packets" | \ - sed 's/.*"packets":\([0-9]\+\),.*/\1/' + mptcp_lib_get_info_value \"packets\" packets } =20 fail_tests() --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -208,6 +208,16 @@ mptcp_lib_result_print_all_tap() { done } =20 +# get the value of keyword $1 in the line marked by keyword $2 +mptcp_lib_get_info_value() { + grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q' +} + +# $1: info name ; $2: evts_ns ; $3: event type +mptcp_lib_evts_get_info() { + mptcp_lib_get_info_value "${1}" "^type:${3:-1}," < "${2}" +} + # $1: PID mptcp_lib_kill_wait() { [ "${1}" -eq 0 ] && return 0 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -238,14 +238,11 @@ make_connection() local server_token local server_serverside =20 - client_token=3D$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\= 2/p;q' "$client_evts") - client_port=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2= /p;q' "$client_evts") - client_serverside=3D$(sed --unbuffered -n 's/.*\(server_side:\)\([[:digit= :]]*\).*$/\2/p;q'\ - "$client_evts") - server_token=3D$(grep "type:1," "$server_evts" | - sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q') - server_serverside=3D$(grep "type:1," "$server_evts" | - sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q= ') + client_token=3D$(mptcp_lib_evts_get_info token "$client_evts") + client_port=3D$(mptcp_lib_evts_get_info sport "$client_evts") + client_serverside=3D$(mptcp_lib_evts_get_info server_side "$client_evts") + server_token=3D$(mptcp_lib_evts_get_info token "$server_evts") + server_serverside=3D$(mptcp_lib_evts_get_info server_side "$server_evts") =20 print_test "Established IP${is_v6} MPTCP Connection ns2 =3D> ns1" if [ "$client_token" !=3D "" ] && [ "$server_token" !=3D "" ] && [ "$clie= nt_serverside" =3D 0 ] && @@ -331,16 +328,16 @@ verify_announce_event() local dport local id =20 - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") - token=3D$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") + type=3D$(mptcp_lib_evts_get_info type "$evt" $e_type) + token=3D$(mptcp_lib_evts_get_info token "$evt" $e_type) if [ "$e_af" =3D "v6" ] then - addr=3D$(sed --unbuffered -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q' = "$evt") + addr=3D$(mptcp_lib_evts_get_info daddr6 "$evt" $e_type) else - addr=3D$(sed --unbuffered -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$ev= t") + addr=3D$(mptcp_lib_evts_get_info daddr4 "$evt" $e_type) fi - dport=3D$(sed --unbuffered -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") - id=3D$(sed --unbuffered -n 's/.*\(rem_id:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") + dport=3D$(mptcp_lib_evts_get_info dport "$evt" $e_type) + id=3D$(mptcp_lib_evts_get_info rem_id "$evt" $e_type) =20 check_expected "type" "token" "addr" "dport" "id" } @@ -358,7 +355,7 @@ test_announce() $client_addr_id dev ns2eth1 > /dev/null 2>&1 =20 local type - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= server_evts") + type=3D$(mptcp_lib_evts_get_info type "$server_evts") print_test "ADD_ADDR 10.0.2.2 (ns2) =3D> ns1, invalid token" if [ "$type" =3D "" ] then @@ -437,9 +434,9 @@ verify_remove_event() local token local id =20 - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") - token=3D$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") - id=3D$(sed --unbuffered -n 's/.*\(rem_id:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") + type=3D$(mptcp_lib_evts_get_info type "$evt" $e_type) + token=3D$(mptcp_lib_evts_get_info token "$evt" $e_type) + id=3D$(mptcp_lib_evts_get_info rem_id "$evt" $e_type) =20 check_expected "type" "token" "id" } @@ -457,7 +454,7 @@ test_remove() $client_addr_id > /dev/null 2>&1 print_test "RM_ADDR id:${client_addr_id} ns2 =3D> ns1, invalid token" local type - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= server_evts") + type=3D$(mptcp_lib_evts_get_info type "$server_evts") if [ "$type" =3D "" ] then test_pass @@ -470,7 +467,7 @@ test_remove() ip netns exec "$ns2" ./pm_nl_ctl rem token "$client4_token" id\ $invalid_id > /dev/null 2>&1 print_test "RM_ADDR id:${invalid_id} ns2 =3D> ns1, invalid id" - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= server_evts") + type=3D$(mptcp_lib_evts_get_info type "$server_evts") if [ "$type" =3D "" ] then test_pass @@ -574,19 +571,19 @@ verify_subflow_events() fi fi =20 - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") - token=3D$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") - family=3D$(sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q= ' "$evt") - dport=3D$(sed --unbuffered -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") - locid=3D$(sed --unbuffered -n 's/.*\(loc_id:\)\([[:digit:]]*\).*$/\2/p;q'= "$evt") - remid=3D$(sed --unbuffered -n 's/.*\(rem_id:\)\([[:digit:]]*\).*$/\2/p;q'= "$evt") + type=3D$(mptcp_lib_evts_get_info type "$evt" $e_type) + token=3D$(mptcp_lib_evts_get_info token "$evt" $e_type) + family=3D$(mptcp_lib_evts_get_info family "$evt" $e_type) + dport=3D$(mptcp_lib_evts_get_info dport "$evt" $e_type) + locid=3D$(mptcp_lib_evts_get_info loc_id "$evt" $e_type) + remid=3D$(mptcp_lib_evts_get_info rem_id "$evt" $e_type) if [ "$family" =3D "$AF_INET6" ] then - saddr=3D$(sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q'= "$evt") - daddr=3D$(sed --unbuffered -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q'= "$evt") + saddr=3D$(mptcp_lib_evts_get_info saddr6 "$evt" $e_type) + daddr=3D$(mptcp_lib_evts_get_info daddr6 "$evt" $e_type) else - saddr=3D$(sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q' "$e= vt") - daddr=3D$(sed --unbuffered -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$e= vt") + saddr=3D$(mptcp_lib_evts_get_info saddr4 "$evt" $e_type) + daddr=3D$(mptcp_lib_evts_get_info daddr4 "$evt" $e_type) fi =20 check_expected "type" "token" "daddr" "dport" "family" "saddr" "locid" "r= emid" @@ -621,7 +618,7 @@ test_subflows() mptcp_lib_kill_wait $listener_pid =20 local sport - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$server_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$server_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from server to client machine :>"$server_evts" @@ -659,7 +656,7 @@ test_subflows() # Delete the listener from the client ns, if one was created mptcp_lib_kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$server_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$server_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW6 from server to client machine :>"$server_evts" @@ -698,7 +695,7 @@ test_subflows() # Delete the listener from the client ns, if one was created mptcp_lib_kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$server_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$server_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from server to client machine :>"$server_evts" @@ -736,7 +733,7 @@ test_subflows() # Delete the listener from the server ns, if one was created mptcp_lib_kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$client_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$client_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from client to server machine :>"$client_evts" @@ -775,7 +772,7 @@ test_subflows() # Delete the listener from the server ns, if one was created mptcp_lib_kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$client_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$client_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW6 from client to server machine :>"$client_evts" @@ -812,7 +809,7 @@ test_subflows() # Delete the listener from the server ns, if one was created mptcp_lib_kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$client_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$client_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from client to server machine :>"$client_evts" @@ -858,7 +855,7 @@ test_subflows_v4_v6_mix() # Delete the listener from the server ns, if one was created mptcp_lib_kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$client_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$client_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from client to server machine :>"$client_evts" @@ -926,18 +923,13 @@ verify_listener_events() print_test "CLOSE_LISTENER $e_saddr:$e_sport" fi =20 - type=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q') - family=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q') - sport=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q') + type=3D$(mptcp_lib_evts_get_info type $evt $e_type) + family=3D$(mptcp_lib_evts_get_info family $evt $e_type) + sport=3D$(mptcp_lib_evts_get_info sport $evt $e_type) if [ $family ] && [ $family =3D $AF_INET6 ]; then - saddr=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q') + saddr=3D$(mptcp_lib_evts_get_info saddr6 $evt $e_type) else - saddr=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q') + saddr=3D$(mptcp_lib_evts_get_info saddr4 $evt $e_type) fi =20 check_expected "type" "family" "saddr" "sport" Patches currently in stable-queue which might be from kroah.com@vger.kernel= .org are queue-6.7/selftests-mptcp-add-mptcp_lib_is_v6.patch queue-6.7/x86-bugs-use-alternative-instead-of-mds_user_clear-static-key.pat= ch queue-6.7/kvm-vmx-move-verw-closer-to-vmentry-for-mds-mitigation.patch queue-6.7/selftests-mptcp-rm-subflow-with-v4-v4mapped-addr.patch queue-6.7/x86-entry_32-add-verw-just-before-userspace-transition.patch queue-6.7/x86-entry_64-add-verw-just-before-userspace-transition.patch queue-6.7/selftests-mptcp-update-userspace-pm-test-helpers.patch queue-6.7/selftests-mptcp-add-evts_get_info-helper.patch queue-6.7/kvm-vmx-use-bt-jnc-i.e.-eflags.cf-to-select-vmresume-vs.-vmlaunch= .patch queue-6.7/selftests-mptcp-add-chk_subflows_total-helper.patch