add fastclose testcases
Subsystems (3)
cover add fastclose testcases
This patchset is related to issue #48 and issue #197. The two MP_RST patches are moved from the "add mp_fail testcases" series.
Geliang Tang (6):
mptcp: add the mibs for MP_FASTCLOSE
selftests: mptcp: add the MP_FASTCLOSE mibs check
mptcp: add the mibs for MP_RST
selftests: mptcp: add the MP_RST mibs check
selftests: mptcp: add extra_args in do_transfer
selftests: mptcp: add fastclose testcases
net/mptcp/mib.c | 4 + net/mptcp/mib.h | 4 + net/mptcp/options.c | 5 + .../testing/selftests/net/mptcp/mptcp_join.sh | 135 +++++++++++++++--- 4 files changed, 132 insertions(+), 16 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/6 mptcp: add the mibs for MP_FASTCLOSE
This patch added two more mibs for MP_FASTCLOSE, MPTCP_MIB_MPFASTCLOSETX for the MP_FASTCLOSE sending and MPTCP_MIB_MPFASTCLOSERX for receiving.
Also added a debug log for MP_FASTCLOSE receiving, printed out the recv_key of MP_FASTCLOSE in mptcp_parse_option to show that MP_RST is received.
--- net/mptcp/mib.c | 2 ++ net/mptcp/mib.h | 2 ++ net/mptcp/options.c | 3 +++ 3 files changed, 7 insertions(+)
net/mptcp/mib.c +2 -0
@@ -49,6 +49,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {SNMP_MIB_ITEM ("MPPrioRx" ,MPTCP_MIB_MPPRIORX ),SNMP_MIB_ITEM ("MPFailTx" ,MPTCP_MIB_MPFAILTX ),SNMP_MIB_ITEM ("MPFailRx" ,MPTCP_MIB_MPFAILRX ), +SNMP_MIB_ITEM ("MPFastcloseTx" ,MPTCP_MIB_MPFASTCLOSETX ), +SNMP_MIB_ITEM ("MPFastcloseRx" ,MPTCP_MIB_MPFASTCLOSERX ),SNMP_MIB_ITEM ("RcvPruned" ,MPTCP_MIB_RCVPRUNED ),SNMP_MIB_ITEM ("SubflowStale" ,MPTCP_MIB_SUBFLOWSTALE ), SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
net/mptcp/mib.h +2 -0
@@ -42,6 +42,8 @@ enum linux_mptcp_mib_field {MPTCP_MIB_MPPRIORX ,/* Received a MP_PRIO */ MPTCP_MIB_MPFAILTX ,/* Transmit a MP_FAIL */ MPTCP_MIB_MPFAILRX ,/* Received a MP_FAIL */ +MPTCP_MIB_MPFASTCLOSETX ,/* Transmit a MP_FASTCLOSE */ +MPTCP_MIB_MPFASTCLOSERX ,/* Received a MP_FASTCLOSE */ MPTCP_MIB_RCVPRUNED ,/* Incoming packet dropped due to memory limit */ MPTCP_MIB_SUBFLOWSTALE ,/* Subflows entered 'stale' status */ MPTCP_MIB_SUBFLOWRECOVER, /* Subflows returned to active status after being stale */
net/mptcp/options.c +3 -0
@@ -323,6 +323,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, mp_opt->rcvr_key =get_unaligned_be64 (ptr); ptr +=8 ; mp_opt->suboptions |=OPTION_MPTCP_FASTCLOSE ; +pr_debug ("MP_FASTCLOSE: recv_key=%llu" , mp_opt->rcvr_key);break ;case MPTCPOPT_RST :
@@ -832,6 +833,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { *size += opt_size; remaining -= opt_size; +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_MPFASTCLOSETX ); }/* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */ if (mptcp_established_options_rst (sk, skb, &opt_size, remaining, opts)) {
@@ -1124,6 +1126,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) msk->local_key == mp_opt.rcvr_key) {WRITE_ONCE (msk->rcv_fastclose, true);mptcp_schedule_work ((struct sock *)msk); +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_MPFASTCLOSERX ); } if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) &&
Signature · 1 line
2.34.1
PATCH 2/6 selftests: mptcp: add the MP_FASTCLOSE mibs check
In reply to Geliang TangThis patch added a new function chk_fclose_nr() to check the numbers of the MP_FASTCLOSE sending and receiving mibs.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +32 -0
@@ -834,6 +834,38 @@ chk_infi_nr() [ "${dump_stats}" = 1 ] && dump_stats } +chk_fclose_nr() +{ + local fclose_tx=$1 + local fclose_rx=$2 + local count + local dump_stats + + printf "%-${nr_blank}s %s" " " "ctx" + count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPFastcloseTx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$fclose_tx" ]; then + echo "[fail] got $count MP_FASTCLOSE[s] TX expected $fclose_tx" + ret=1 + dump_stats=1 + else + echo -n "[ ok ]" + fi + + echo -n " - fclzrx" + count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFastcloseRx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$fclose_rx" ]; then + echo "[fail] got $count MP_FASTCLOSE[s] RX expected $fclose_rx" + ret=1 + dump_stats=1 + else + echo "[ ok ]" + fi + + [ "${dump_stats}" = 1 ] && dump_stats +} + chk_join_nr() { local msg="$1"
Signature · 1 line
2.34.1
PATCH 3/6 mptcp: add the mibs for MP_RST
In reply to Geliang TangThis patch added two more mibs for MP_RST, MPTCP_MIB_MPRSTTX for the MP_RST sending and MPTCP_MIB_MPRSTRX for the MP_RST receiving.
--- net/mptcp/mib.c | 2 ++ net/mptcp/mib.h | 2 ++ net/mptcp/options.c | 2 ++ 3 files changed, 6 insertions(+)
net/mptcp/mib.c +2 -0
@@ -51,6 +51,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {SNMP_MIB_ITEM ("MPFailRx" ,MPTCP_MIB_MPFAILRX ),SNMP_MIB_ITEM ("MPFastcloseTx" ,MPTCP_MIB_MPFASTCLOSETX ),SNMP_MIB_ITEM ("MPFastcloseRx" ,MPTCP_MIB_MPFASTCLOSERX ), +SNMP_MIB_ITEM ("MPRstTx" ,MPTCP_MIB_MPRSTTX ), +SNMP_MIB_ITEM ("MPRstRx" ,MPTCP_MIB_MPRSTRX ),SNMP_MIB_ITEM ("RcvPruned" ,MPTCP_MIB_RCVPRUNED ),SNMP_MIB_ITEM ("SubflowStale" ,MPTCP_MIB_SUBFLOWSTALE ), SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
net/mptcp/mib.h +2 -0
@@ -44,6 +44,8 @@ enum linux_mptcp_mib_field {MPTCP_MIB_MPFAILRX ,/* Received a MP_FAIL */ MPTCP_MIB_MPFASTCLOSETX ,/* Transmit a MP_FASTCLOSE */ MPTCP_MIB_MPFASTCLOSERX ,/* Received a MP_FASTCLOSE */ +MPTCP_MIB_MPRSTTX ,/* Transmit a MP_RST */ +MPTCP_MIB_MPRSTRX ,/* Received a MP_RST */ MPTCP_MIB_RCVPRUNED ,/* Incoming packet dropped due to memory limit */ MPTCP_MIB_SUBFLOWSTALE ,/* Subflows entered 'stale' status */ MPTCP_MIB_SUBFLOWRECOVER, /* Subflows returned to active status after being stale */
net/mptcp/options.c +2 -0
@@ -839,6 +839,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,if (mptcp_established_options_rst (sk, skb, &opt_size, remaining, opts)) { *size += opt_size; remaining -= opt_size; +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_MPRSTTX ); }return true; }
@@ -1161,6 +1162,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) subflow->reset_seen =1 ; subflow->reset_reason = mp_opt.reset_reason; subflow->reset_transient = mp_opt.reset_transient; +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_MPRSTRX ); }if (!(mp_opt.suboptions &OPTION_MPTCP_DSS ))
Signature · 1 line
2.34.1
PATCH 4/6 selftests: mptcp: add the MP_RST mibs check
In reply to Geliang TangThis patch added a new function chk_rst_nr() to check the numbers of the MP_RST sending and receiving mibs.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +42 -0
@@ -802,6 +802,47 @@ chk_fail_nr() [ "${dump_stats}" = 1 ] && dump_stats } +chk_rst_nr() +{ + local rst_tx=$1 + local rst_rx=$2 + local invert=${3:-""} + local count + local dump_stats + + if [ -z $invert ]; then + ns_tx=$ns1 + ns_rx=$ns2 + elif [ $invert = "invert" ]; then + ns_tx=$ns2 + ns_rx=$ns1 + fi + + printf "%-${nr_blank}s %s" " " "rtx" + count=`ip netns exec $ns_tx nstat -as | grep MPTcpExtMPRstTx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$rst_tx" ]; then + echo "[fail] got $count MP_RST[s] TX expected $rst_tx" + ret=1 + dump_stats=1 + else + echo -n "[ ok ]" + fi + + echo -n " - rstrx " + count=`ip netns exec $ns_rx nstat -as | grep MPTcpExtMPRstRx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$rst_rx" ]; then + echo "[fail] got $count MP_RST[s] RX expected $rst_rx" + ret=1 + dump_stats=1 + else + echo "[ ok ]" + fi + + [ "${dump_stats}" = 1 ] && dump_stats +} + chk_infi_nr() { local mp_infi_nr_tx=$1
@@ -920,6 +961,7 @@ chk_join_nr() if [ $checksum -eq 1 ]; then chk_csum_nr chk_fail_nr 0 0 + chk_rst_nr 0 0 chk_infi_nr 0 0 fi }
Signature · 1 line
2.34.1
PATCH 5/6 selftests: mptcp: add extra_args in do_transfer
In reply to Geliang TangInstead of using a global variable mptcp_connect, this patch added a new local variable extra_args in do_transfer() to store the extra argments passing to the mptcp_connect commands.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +12 -12
@@ -12,7 +12,6 @@ cout="" ksft_skip=4 timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) -mptcp_connect="" capture=0 checksum=0 ip_mptcp=0
@@ -454,12 +453,13 @@ do_transfer() NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ nstat -n + local extra_args if [ $speed = "fast" ]; then - mptcp_connect="./mptcp_connect -j" + extra_args="-j" elif [ $speed = "slow" ]; then - mptcp_connect="./mptcp_connect -r 50" + extra_args="-r 50" elif [ $speed = "least" ]; then - mptcp_connect="./mptcp_connect -r 10" + extra_args="-r 10" fi local local_addr
@@ -472,13 +472,13 @@ do_transfer() if [ "$test_link_fail" -eq 2 ];then timeout ${timeout_test} \ ip netns exec ${listener_ns} \ - $mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ - ${local_addr} < "$sinfail" > "$sout" & + ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ + $extra_args ${local_addr} < "$sinfail" > "$sout" & else timeout ${timeout_test} \ ip netns exec ${listener_ns} \ - $mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ - ${local_addr} < "$sin" > "$sout" & + ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ + $extra_args ${local_addr} < "$sin" > "$sout" & fi spid=$!
@@ -487,15 +487,15 @@ do_transfer() if [ "$test_link_fail" -eq 0 ];then timeout ${timeout_test} \ ip netns exec ${connector_ns} \ - $mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ - $connect_addr < "$cin" > "$cout" & + ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ + $extra_args $connect_addr < "$cin" > "$cout" & else ( cat "$cinfail" ; sleep 2; link_failure $listener_ns ; cat "$cinfail" ) | \ tee "$cinsent" | \ timeout ${timeout_test} \ ip netns exec ${connector_ns} \ - $mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ - $connect_addr > "$cout" & + ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ + $extra_args $connect_addr > "$cout" & fi cpid=$!
Signature · 1 line
2.34.1
PATCH 6/6 selftests: mptcp: add fastclose testcases
In reply to Geliang TangThis patch added the self tests for MP_FASTCLOSE. Added a new argment fastclose for the function do_transfer(). Passed the extra argments '-I 2' and '-I 3' to the mptcp_connect commands to disconnect the connections to trigger the MP_FASTCLOSE sending and receiving. Used chk_fclose_nr to check the MP_FASTCLOSE mibs and used chk_rst_nr to check the MP_RST mibs.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +33 -4
@@ -424,6 +424,7 @@ do_transfer() addr_nr_ns2="$8" speed="$9" sflags="${10}" + fastclose="${11}" port=$((10000+$TEST_COUNT)) TEST_COUNT=$((TEST_COUNT+1))
@@ -462,6 +463,13 @@ do_transfer() extra_args="-r 10" fi + if [ $fastclose -eq 2 ]; then + # disconnect + extra_args="$extra_args -I 2" + elif [ $fastclose -eq 3 ]; then + extra_args="$extra_args -I 3" + fi + local local_addr if is_v6 "${connect_addr}"; then local_addr="::"
@@ -607,7 +615,7 @@ do_transfer() fi fi - if [ ! -z $sflags ]; then + if [ $sflags != "null" ]; then sleep 1 for netns in "$ns1" "$ns2"; do pm_nl_show_endpoints $netns | while read line; do
@@ -698,7 +706,8 @@ run_tests() addr_nr_ns1="${5:-0}" addr_nr_ns2="${6:-0}" speed="${7:-fast}" - sflags="${8:-""}" + sflags="${8:-null}" + fastclose="${9:-0}" # create the input file for the failure test when # the first failure test run
@@ -725,7 +734,7 @@ run_tests() fi do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \ - ${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${sflags} + ${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${sflags} ${fastclose} } dump_stats()
@@ -2277,6 +2286,21 @@ userspace_tests() chk_rm_nr 0 0 } +fastclose_tests() +{ + reset + run_tests $ns1 $ns2 10.0.1.1 0 0 0 fast null 2 + chk_join_nr "fastclose test 1" 0 0 0 + chk_fclose_nr 1 1 + chk_rst_nr 1 1 invert + + reset + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow null 3 + chk_join_nr "fastclose test 2" 0 0 0 + chk_fclose_nr 2 2 + chk_rst_nr 2 2 invert +} + all_tests() { subflows_tests
@@ -2295,6 +2319,7 @@ all_tests() deny_join_id0_tests fullmesh_tests userspace_tests + fastclose_tests } # [$1: error message]
@@ -2322,6 +2347,7 @@ usage() echo " -d deny_join_id0_tests" echo " -m fullmesh_tests" echo " -u userspace_tests" + echo " -z fastclose_tests" echo " -c capture pcap files" echo " -C enable data checksum" echo " -i use ip mptcp"
@@ -2353,7 +2379,7 @@ if [ $do_all_tests -eq 1 ]; then exit $ret fi -while getopts 'fesltra64bpkdmuchCSi' opt; do +while getopts 'fesltra64bpkdmuchzCSi' opt; do case $opt in f) subflows_tests
@@ -2403,6 +2429,9 @@ while getopts 'fesltra64bpkdmuchCSi' opt; do u) userspace_tests ;; + z) + fastclose_tests + ;; c) ;; C)
Signature · 1 line
2.34.1