From nobody Mon Sep 16 19:22:34 2024 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C47BC134B0 for ; Mon, 22 May 2023 16:38:30 +0000 (UTC) Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3093a7b71fbso6076785f8f.2 for ; Mon, 22 May 2023 09:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1684773508; x=1687365508; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Efk9cL7Xil38JdYUVreVMvnwva+BSm37z9DnJN1AKng=; b=jB+9QGuVTNE2l91aNgHaOYqMPR6fSZxLklbu//BExWIVJ+Aa3wcoehYjuvM/tY1y64 RszRBVpERgStD/2pj2llYEylJlhWRd9/2Ooql0uLHFIdi2EXi1BKvKfP7oehLM61+kPW 02IIn89uPHHbAVAla4KQve0UPBien8JBZWXnbeSvdJ/htXTs7gzQstxyQFyjI5Hq1pa6 8/X1XjsVmrNCS8c7eaMQdJYlCqeCMLRAiMJJPoBFiTY+AfCfePsKGz0TMOw1xvn+KBwB lZOijJ4dMOMv9Noo4LN7WwAgijIOhAY/fsRw2ARLHWXPcyP3WuDAUjlK2uOH4bfYE+5U lE/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684773508; x=1687365508; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Efk9cL7Xil38JdYUVreVMvnwva+BSm37z9DnJN1AKng=; b=cHFxcwZbX8f2qijt4A9DmTvVfm8iFJIwwQ1FuwrgsRzvA9Y2lCSLVD9xhoML0OowHU HGOD3j9C81mC5gWz+17M8Qgv534x5mWF1JqBx1OQ/hqKmhtzzWcSe8SAiEbAirfFxi6m BPi0qIxhpU8FcBSPnbbXyNYe3x6VHDjdbpgk8Za2Lk851M5OKpd1N6/YIBVMjyK05+uS Mc76B3XGq8LesuYiynr6/qJ1qs/pBNregQVreP2mK1TC/SMnvv7mrr35ViiNxRBptr4c en1CBRYvICVBTNEcwS70ZnLz3Ku18MJ4pUH7vD4MwKbXVl3mvlkS1PNHbbTRZKPlE/ie tQtw== X-Gm-Message-State: AC+VfDwhvUSFLj9PoLepA6jQQ/N1tcD3gkBe6SGi+6jBbC6APkb7c0nS eoEdpZ8858nVy+v7svZ9IgTenwjkey4rw+DnoQG/ag== X-Google-Smtp-Source: ACHHUZ5PwHKZc1xbb+24Ddz0KvyWVI+e0XG58YVzzATz6YRlrlMVSVMK4Z4S/dzzl+dHNnmtJgbDng== X-Received: by 2002:adf:e7c8:0:b0:306:462a:b78d with SMTP id e8-20020adfe7c8000000b00306462ab78dmr8262691wrn.53.1684773508501; Mon, 22 May 2023 09:38:28 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id z20-20020a7bc7d4000000b003f4ecf1fcbcsm12028808wmk.22.2023.05.22.09.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 09:38:28 -0700 (PDT) From: Matthieu Baerts Date: Mon, 22 May 2023 18:37:57 +0200 Subject: [PATCH mptcp-net v2 25/37] selftests: mptcp: join: skip check if MIB counter not supported Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230406-mptcp-issue-368-selftests-old-kernels-v2-25-50313e4f83ab@tessares.net> References: <20230406-mptcp-issue-368-selftests-old-kernels-v2-0-50313e4f83ab@tessares.net> In-Reply-To: <20230406-mptcp-issue-368-selftests-old-kernels-v2-0-50313e4f83ab@tessares.net> To: mptcp@lists.linux.dev Cc: Matthieu Baerts X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=19672; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=rdDKJUN8VY0qIm+v1wuEkeCXkkZUySgdzQArtSu9XyE=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBka5pxaTJYsVA88eUvJbEnAo7fqr1fDIKV1mJWQ PNTXZf3kYCJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZGuacQAKCRD2t4JPQmmg c8c+D/9zxEMkT7SonF5sh1zocR4LmMSkIba8ow8Mcie1/ME7srgpH28WmyUi1ywyS/+Hb+ammsx OiLQvByW0of7xfOYZl6xpneoZQ0IwN3xrEZG0bg5UO6LkbSg2/phaMSVzgVb1Ymj1Zu0GJhyJg+ GYoP3D55EzKXWQ6l4e6FtPMiGExLJ8/RbCbB2bcGrHdfTqroXGKcS4DGx3kIAPao8maDosi14Rt S5w0Rv2NpEkRClHJnEqNSJ7CzG4cK+/zgxxJdjdKdP8RTQhfYgUef7lsvQz7JPOgbjE/3ErhTEi iTcR7Mx82xx8QjmMMuLMwqBxdeZFFuGPr0UrDDSWOTRzdbeIF2Ihkx14tuPSrkJlxdUxa1WORnN NmiCwFXzQYxqeilnvFcDedPh5gHzu5A7ZJGQa3sqS/PFQJvA4cUJZfkBL4b9DB06zdRDgurP41i cZqijg4QrwkSgMBjO/bVLGWboVe+GfiE7Pyw9kenfsshf4FcOuqYxLtNbFLxsJVaIpzeXlIbuk0 ogA3hYMpPdxnPdKngGXh90q+94lBmS2AYXt/0fayU6URHPhKmWc3Pg6/7+tHYbXw1Dg+nhnVige PBegNahAWAgrJ0mUVPur51lMcwVC8RtWvRilAYg2YxW8V+66s3b8GuDKW9jM7NDWzBtsyyBr6IH Kwv1yAC9y3Un2ZQ== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Selftests are supposed to run on any kernels, including the old ones not supporting all MPTCP features. One of them is the MPTCP MIB counters introduced in commit fc518953bc9c ("mptcp: add and use MIB counter infrastructure") and more later. The MPTCP Join selftest heavily relies on these counters. If a counter is not supported by the kernel, it is not displayed when using 'nstat -z'. We can then detect that and skip the verification. A new helper (get_counter()) has been added to do the required checks and return an error if the counter is not available. Note that if we expect to have these features available and if SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var is set to 1, the tests will be marked as failed instead of skipped. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368 Fixes: b08fbf241064 ("selftests: add test-cases for MPTCP MP_JOIN") Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 251 ++++++++++++++------= ---- 1 file changed, 142 insertions(+), 109 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 1a8f7c6fa988..73c513f1e808 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -505,11 +505,25 @@ wait_local_port_listen() done } =20 +# $1: ns ; $2: counter +get_counter() +{ + local ns=3D"${1}" + local counter=3D"${2}" + local count + + count=3D$(ip netns exec ${ns} nstat -asz "${counter}" | awk 'NR=3D=3D1 {n= ext} {print $2}') + if [ -z "${count}" ]; then + mptcp_lib_fail_if_expected_feature "${counter} counter" + return 1 + fi + + echo "${count}" +} + rm_addr_count() { - local ns=3D${1} - - ip netns exec ${ns} nstat -as | grep MPTcpExtRmAddr | awk '{print $2}' + get_counter "${1}" "MPTcpExtRmAddr" } =20 # $1: ns, $2: old rm_addr counter in $ns @@ -532,11 +546,11 @@ wait_mpj() local ns=3D"${1}" local cnt old_cnt =20 - old_cnt=3D$(ip netns exec ${ns} nstat -as | grep MPJoinAckRx | awk '{prin= t $2}') + old_cnt=3D$(get_counter ${ns} "MPTcpExtMPJoinAckRx") =20 local i for i in $(seq 10); do - cnt=3D$(ip netns exec ${ns} nstat -as | grep MPJoinAckRx | awk '{print $= 2}') + cnt=3D$(get_counter ${ns} "MPTcpExtMPJoinAckRx") [ "$cnt" =3D "${old_cnt}" ] || break sleep 0.1 done @@ -1185,12 +1199,13 @@ chk_csum_nr() fi =20 printf "%-${nr_blank}s %s" " " "sum" - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '= {print $2}') - [ -z "$count" ] && count=3D0 + count=3D$(get_counter ${ns1} "MPTcpExtDataCsumErr") if [ "$count" !=3D "$csum_ns1" ]; then extra_msg=3D"$extra_msg ns1=3D$count" fi - if { [ "$count" !=3D $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 0 ]; } = || + if [ -z "$count" ]; then + echo -n "[skip]" + elif { [ "$count" !=3D $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 0 ]; = } || { [ "$count" -lt $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 1 ]; }; = then echo "[fail] got $count data checksum error[s] expected $csum_ns1" fail_test @@ -1198,12 +1213,13 @@ chk_csum_nr() echo -n "[ ok ]" fi echo -n " - csum " - count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '= {print $2}') - [ -z "$count" ] && count=3D0 + count=3D$(get_counter ${ns2} "MPTcpExtDataCsumErr") if [ "$count" !=3D "$csum_ns2" ]; then extra_msg=3D"$extra_msg ns2=3D$count" fi - if { [ "$count" !=3D $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 0 ]; } = || + if [ -z "$count" ]; then + echo -n "[skip]" + elif { [ "$count" !=3D $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 0 ]; = } || { [ "$count" -lt $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 1 ]; }; = then echo "[fail] got $count data checksum error[s] expected $csum_ns2" fail_test @@ -1242,12 +1258,13 @@ chk_fail_nr() fi =20 printf "%-${nr_blank}s %s" " " "ftx" - count=3D$(ip netns exec $ns_tx nstat -as | grep MPTcpExtMPFailTx | awk '{= print $2}') - [ -z "$count" ] && count=3D0 + count=3D$(get_counter ${ns_tx} "MPTcpExtMPFailTx") if [ "$count" !=3D "$fail_tx" ]; then extra_msg=3D"$extra_msg,tx=3D$count" fi - if { [ "$count" !=3D "$fail_tx" ] && [ $allow_tx_lost -eq 0 ]; } || + if [ -z "$count" ]; then + echo -n "[skip]" + elif { [ "$count" !=3D "$fail_tx" ] && [ $allow_tx_lost -eq 0 ]; } || { [ "$count" -gt "$fail_tx" ] && [ $allow_tx_lost -eq 1 ]; }; then echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx" fail_test @@ -1256,12 +1273,13 @@ chk_fail_nr() fi =20 echo -n " - failrx" - count=3D$(ip netns exec $ns_rx nstat -as | grep MPTcpExtMPFailRx | awk '{= print $2}') - [ -z "$count" ] && count=3D0 + count=3D$(get_counter ${ns_rx} "MPTcpExtMPFailRx") if [ "$count" !=3D "$fail_rx" ]; then extra_msg=3D"$extra_msg,rx=3D$count" fi - if { [ "$count" !=3D "$fail_rx" ] && [ $allow_rx_lost -eq 0 ]; } || + if [ -z "$count" ]; then + echo -n "[skip]" + elif { [ "$count" !=3D "$fail_rx" ] && [ $allow_rx_lost -eq 0 ]; } || { [ "$count" -gt "$fail_rx" ] && [ $allow_rx_lost -eq 1 ]; }; then echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx" fail_test @@ -1289,10 +1307,11 @@ chk_fclose_nr() fi =20 printf "%-${nr_blank}s %s" " " "ctx" - count=3D$(ip netns exec $ns_tx nstat -as | grep MPTcpExtMPFastcloseTx | a= wk '{print $2}') - [ -z "$count" ] && count=3D0 - [ "$count" !=3D "$fclose_tx" ] && extra_msg=3D"$extra_msg,tx=3D$count" - if [ "$count" !=3D "$fclose_tx" ]; then + count=3D$(get_counter ${ns_tx} "MPTcpExtMPFastcloseTx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$fclose_tx" ]; then + extra_msg=3D"$extra_msg,tx=3D$count" echo "[fail] got $count MP_FASTCLOSE[s] TX expected $fclose_tx" fail_test else @@ -1300,10 +1319,11 @@ chk_fclose_nr() fi =20 echo -n " - fclzrx" - count=3D$(ip netns exec $ns_rx nstat -as | grep MPTcpExtMPFastcloseRx | a= wk '{print $2}') - [ -z "$count" ] && count=3D0 - [ "$count" !=3D "$fclose_rx" ] && extra_msg=3D"$extra_msg,rx=3D$count" - if [ "$count" !=3D "$fclose_rx" ]; then + count=3D$(get_counter ${ns_rx} "MPTcpExtMPFastcloseRx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$fclose_rx" ]; then + extra_msg=3D"$extra_msg,rx=3D$count" echo "[fail] got $count MP_FASTCLOSE[s] RX expected $fclose_rx" fail_test else @@ -1330,9 +1350,10 @@ chk_rst_nr() fi =20 printf "%-${nr_blank}s %s" " " "rtx" - count=3D$(ip netns exec $ns_tx nstat -as | grep MPTcpExtMPRstTx | awk '{p= rint $2}') - [ -z "$count" ] && count=3D0 - if [ $count -lt $rst_tx ]; then + count=3D$(get_counter ${ns_tx} "MPTcpExtMPRstTx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ $count -lt $rst_tx ]; then echo "[fail] got $count MP_RST[s] TX expected $rst_tx" fail_test else @@ -1340,9 +1361,10 @@ chk_rst_nr() fi =20 echo -n " - rstrx " - count=3D$(ip netns exec $ns_rx nstat -as | grep MPTcpExtMPRstRx | awk '{p= rint $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" -lt "$rst_rx" ]; then + count=3D$(get_counter ${ns_rx} "MPTcpExtMPRstRx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" -lt "$rst_rx" ]; then echo "[fail] got $count MP_RST[s] RX expected $rst_rx" fail_test else @@ -1359,9 +1381,10 @@ chk_infi_nr() local count =20 printf "%-${nr_blank}s %s" " " "itx" - count=3D$(ip netns exec $ns2 nstat -as | grep InfiniteMapTx | awk '{print= $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$infi_tx" ]; then + count=3D$(get_counter ${ns2} "MPTcpExtInfiniteMapTx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$infi_tx" ]; then echo "[fail] got $count infinite map[s] TX expected $infi_tx" fail_test else @@ -1369,9 +1392,10 @@ chk_infi_nr() fi =20 echo -n " - infirx" - count=3D$(ip netns exec $ns1 nstat -as | grep InfiniteMapRx | awk '{print= $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$infi_rx" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtInfiniteMapRx") + if [ -z "$count" ]; then + echo "[skip]" + elif [ "$count" !=3D "$infi_rx" ]; then echo "[fail] got $count infinite map[s] RX expected $infi_rx" fail_test else @@ -1399,9 +1423,10 @@ chk_join_nr() fi =20 printf "%03u %-36s %s" "${TEST_COUNT}" "${title}" "syn" - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '= {print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$syn_nr" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtMPJoinSynRx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$syn_nr" ]; then echo "[fail] got $count JOIN[s] syn expected $syn_nr" fail_test else @@ -1410,9 +1435,10 @@ chk_join_nr() =20 echo -n " - synack" with_cookie=3D$(ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies) - count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinSynAckRx | aw= k '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$syn_ack_nr" ]; then + count=3D$(get_counter ${ns2} "MPTcpExtMPJoinSynAckRx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$syn_ack_nr" ]; then # simult connections exceeding the limit with cookie enabled could go up= to # synack validation as the conn limit can be enforced reliably only after # the subflow creation @@ -1427,9 +1453,10 @@ chk_join_nr() fi =20 echo -n " - ack" - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinAckRx | awk '= {print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$ack_nr" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtMPJoinAckRx") + if [ -z "$count" ]; then + echo "[skip]" + elif [ "$count" !=3D "$ack_nr" ]; then echo "[fail] got $count JOIN[s] ack expected $ack_nr" fail_test else @@ -1459,12 +1486,12 @@ chk_stale_nr() local recover_nr =20 printf "%-${nr_blank}s %-18s" " " "stale" - stale_nr=3D$(ip netns exec $ns nstat -as | grep MPTcpExtSubflowStale | aw= k '{print $2}') - [ -z "$stale_nr" ] && stale_nr=3D0 - recover_nr=3D$(ip netns exec $ns nstat -as | grep MPTcpExtSubflowRecover = | awk '{print $2}') - [ -z "$recover_nr" ] && recover_nr=3D0 =20 - if [ $stale_nr -lt $stale_min ] || + stale_nr=3D$(get_counter ${ns} "MPTcpExtSubflowStale") + recover_nr=3D$(get_counter ${ns} "MPTcpExtSubflowRecover") + if [ -z "$stale_nr" ] || [ -z "$recover_nr" ]; then + echo "[skip]" + elif [ $stale_nr -lt $stale_min ] || { [ $stale_max -gt 0 ] && [ $stale_nr -gt $stale_max ]; } || [ $((stale_nr - recover_nr)) -ne $stale_delta ]; then echo "[fail] got $stale_nr stale[s] $recover_nr recover[s], " \ @@ -1499,12 +1526,12 @@ chk_add_nr() timeout=3D$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) =20 printf "%-${nr_blank}s %s" " " "add" - count=3D$(ip netns exec $ns2 nstat -as MPTcpExtAddAddr | grep MPTcpExtAdd= Addr | awk '{print $2}') - [ -z "$count" ] && count=3D0 - + count=3D$(get_counter ${ns2} "MPTcpExtAddAddr") + if [ -z "$count" ]; then + echo -n "[skip]" # if the test configured a short timeout tolerate greater then expected # add addrs options, due to retransmissions - if [ "$count" !=3D "$add_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count" -l= t "$add_nr" ]; }; then + elif [ "$count" !=3D "$add_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count" = -lt "$add_nr" ]; }; then echo "[fail] got $count ADD_ADDR[s] expected $add_nr" fail_test else @@ -1512,9 +1539,10 @@ chk_add_nr() fi =20 echo -n " - echo " - count=3D$(ip netns exec $ns1 nstat -as MPTcpExtEchoAdd | grep MPTcpExtEch= oAdd | awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$echo_nr" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtEchoAdd") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$echo_nr" ]; then echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr" fail_test else @@ -1523,9 +1551,10 @@ chk_add_nr() =20 if [ $port_nr -gt 0 ]; then echo -n " - pt " - count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtPortAdd | awk '{pr= int $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$port_nr" ]; then + count=3D$(get_counter ${ns2} "MPTcpExtPortAdd") + if [ -z "$count" ]; then + echo "[skip]" + elif [ "$count" !=3D "$port_nr" ]; then echo "[fail] got $count ADD_ADDR[s] with a port-number expected $port_n= r" fail_test else @@ -1533,10 +1562,10 @@ chk_add_nr() fi =20 printf "%-${nr_blank}s %s" " " "syn" - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortSynRx | - awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$syn_nr" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtMPJoinPortSynRx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$syn_nr" ]; then echo "[fail] got $count JOIN[s] syn with a different \ port-number expected $syn_nr" fail_test @@ -1545,10 +1574,10 @@ chk_add_nr() fi =20 echo -n " - synack" - count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinPortSynAckRx= | - awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$syn_ack_nr" ]; then + count=3D$(get_counter ${ns2} "MPTcpExtMPJoinPortSynAckRx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$syn_ack_nr" ]; then echo "[fail] got $count JOIN[s] synack with a different \ port-number expected $syn_ack_nr" fail_test @@ -1557,10 +1586,10 @@ chk_add_nr() fi =20 echo -n " - ack" - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortAckRx | - awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$ack_nr" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtMPJoinPortAckRx") + if [ -z "$count" ]; then + echo "[skip]" + elif [ "$count" !=3D "$ack_nr" ]; then echo "[fail] got $count JOIN[s] ack with a different \ port-number expected $ack_nr" fail_test @@ -1569,10 +1598,10 @@ chk_add_nr() fi =20 printf "%-${nr_blank}s %s" " " "syn" - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortSynRx | - awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$mis_syn_nr" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtMismatchPortSynRx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$mis_syn_nr" ]; then echo "[fail] got $count JOIN[s] syn with a mismatched \ port-number expected $mis_syn_nr" fail_test @@ -1581,10 +1610,10 @@ chk_add_nr() fi =20 echo -n " - ack " - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortAckRx | - awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$mis_ack_nr" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtMismatchPortAckRx") + if [ -z "$count" ]; then + echo "[skip]" + elif [ "$count" !=3D "$mis_ack_nr" ]; then echo "[fail] got $count JOIN[s] ack with a mismatched \ port-number expected $mis_ack_nr" fail_test @@ -1606,12 +1635,12 @@ chk_add_tx_nr() timeout=3D$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) =20 printf "%-${nr_blank}s %s" " " "add TX" - count=3D$(ip netns exec $ns1 nstat -as MPTcpExtAddAddrTx | grep MPTcpExtA= ddAddrTx | awk '{print $2}') - [ -z "$count" ] && count=3D0 - + count=3D$(get_counter ${ns1} "MPTcpExtAddAddrTx") + if [ -z "$count" ]; then + echo -n "[skip]" # if the test configured a short timeout tolerate greater then expected # add addrs options, due to retransmissions - if [ "$count" !=3D "$add_tx_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count"= -lt "$add_tx_nr" ]; }; then + elif [ "$count" !=3D "$add_tx_nr" ] && { [ "$timeout" -gt 1 ] || [ "$coun= t" -lt "$add_tx_nr" ]; }; then echo "[fail] got $count ADD_ADDR[s] TX, expected $add_tx_nr" fail_test else @@ -1619,9 +1648,10 @@ chk_add_tx_nr() fi =20 echo -n " - echo TX " - count=3D$(ip netns exec $ns2 nstat -as MPTcpExtEchoAddTx | grep MPTcpExtE= choAddTx | awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$echo_tx_nr" ]; then + count=3D$(get_counter ${ns2} "MPTcpExtEchoAddTx") + if [ -z "$count" ]; then + echo "[skip]" + elif [ "$count" !=3D "$echo_tx_nr" ]; then echo "[fail] got $count ADD_ADDR echo[s] TX, expected $echo_tx_nr" fail_test else @@ -1695,9 +1725,10 @@ chk_rm_nr() fi =20 printf "%-${nr_blank}s %s" " " "rm " - count=3D$(ip netns exec $addr_ns nstat -as MPTcpExtRmAddr | grep MPTcpExt= RmAddr | awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$rm_addr_nr" ]; then + count=3D$(get_counter ${addr_ns} "MPTcpExtRmAddr") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$rm_addr_nr" ]; then echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" fail_test else @@ -1705,12 +1736,13 @@ chk_rm_nr() fi =20 echo -n " - rmsf " - count=3D$(ip netns exec $subflow_ns nstat -as | grep MPTcpExtRmSubflow | = awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ -n "$simult" ]; then + count=3D$(get_counter ${subflow_ns} "MPTcpExtRmSubflow") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ -n "$simult" ]; then local cnt suffix =20 - cnt=3D$(ip netns exec $addr_ns nstat -as | grep MPTcpExtRmSubflow | awk = '{print $2}') + cnt=3D$(get_counter ${addr_ns} "MPTcpExtRmSubflow") =20 # in case of simult flush, the subflow removal count on each side is # unreliable @@ -1719,14 +1751,12 @@ chk_rm_nr() [ "$count" !=3D "$rm_subflow_nr" ] && suffix=3D"$count in [$rm_subflow_n= r:$((rm_subflow_nr*2))]" if [ $count -ge "$rm_subflow_nr" ] && \ [ "$count" -le "$((rm_subflow_nr *2 ))" ]; then - echo "[ ok ] $suffix" + echo -n "[ ok ] $suffix" else echo "[fail] got $count RM_SUBFLOW[s] expected in range [$rm_subflow_nr= :$((rm_subflow_nr*2))]" fail_test fi - return - fi - if [ "$count" !=3D "$rm_subflow_nr" ]; then + elif [ "$count" !=3D "$rm_subflow_nr" ]; then echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr" fail_test else @@ -1741,9 +1771,10 @@ chk_rm_tx_nr() local rm_addr_tx_nr=3D$1 =20 printf "%-${nr_blank}s %s" " " "rm TX " - count=3D$(ip netns exec $ns2 nstat -as MPTcpExtRmAddrTx | grep MPTcpExtRm= AddrTx | awk '{print $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$rm_addr_tx_nr" ]; then + count=3D$(get_counter ${ns2} "MPTcpExtRmAddrTx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$rm_addr_tx_nr" ]; then echo "[fail] got $count RM_ADDR[s] expected $rm_addr_tx_nr" fail_test else @@ -1780,9 +1811,10 @@ chk_prio_nr() local count =20 printf "%-${nr_blank}s %s" " " "ptx" - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx | awk '{pr= int $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$mp_prio_nr_tx" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtMPPrioTx") + if [ -z "$count" ]; then + echo -n "[skip]" + elif [ "$count" !=3D "$mp_prio_nr_tx" ]; then echo "[fail] got $count MP_PRIO[s] TX expected $mp_prio_nr_tx" fail_test else @@ -1790,9 +1822,10 @@ chk_prio_nr() fi =20 echo -n " - prx " - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioRx | awk '{pr= int $2}') - [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$mp_prio_nr_rx" ]; then + count=3D$(get_counter ${ns1} "MPTcpExtMPPrioRx") + if [ -z "$count" ]; then + echo "[skip]" + elif [ "$count" !=3D "$mp_prio_nr_rx" ]; then echo "[fail] got $count MP_PRIO[s] RX expected $mp_prio_nr_rx" fail_test else @@ -1903,7 +1936,7 @@ wait_attempt_fail() while [ $time -lt $timeout_ms ]; do local cnt =20 - cnt=3D$(ip netns exec $ns nstat -as TcpAttemptFails | grep TcpAttemptFai= ls | awk '{print $2}') + cnt=3D$(get_counter ${ns} "TcpAttemptFails") =20 [ "$cnt" =3D 1 ] && return 1 time=3D$((time + 100)) --=20 2.39.2