Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'mptcp-misc-features-for-v6-20-7-0'

Matthieu Baerts says:

====================
mptcp: misc. features for v6.20/7.0

This series contains a few independent new features, and small fixes for
net-next:

- Patches 1-2: two small fixes linked to the MPTCP receive buffer that
are not urgent, requiring code that has been recently changed, and is
needed for the next patch. Because we are at the end of the cycle, it
seems easier to send them to net-next, instead of dealing with
conflicts between net and net-next.

- Patch 3: a refactoring to simplify the code around MPTCP DRS.

- Patch 4: a new trace event for MPTCP to help debugging receive buffer
auto-tuning issues.

- Patch 5: align internal MPTCP PM structure with NL specs, just to
manipulate the same thing.

- Patch 6: convert some min_t(int, ...) to min(): cleaner, and to avoid
future warnings.

- Patch 7: [removed]

- Patch 8: sort all #include in MPTCP Diag tool in the selftests to
prevent future potential conflicts and ease the reading.

- Patches 9-11: improve the MPTCP Join selftest by waiting for an event
instead of a "random" sleep.

- Patches 12-14: some small cleanups in the selftests, seen while
working on the previous patches.

- Patch 15: avoid marking subtests as skipped while still validating
most checks when executing the last MPTCP selftests on older kernels.
====================

Link: https://patch.msgid.link/20260203-net-next-mptcp-misc-feat-6-20-v1-0-31ec8bfc56d1@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+188 -113
+80
include/trace/events/mptcp.h
··· 5 5 #if !defined(_TRACE_MPTCP_H) || defined(TRACE_HEADER_MULTI_READ) 6 6 #define _TRACE_MPTCP_H 7 7 8 + #include <linux/ipv6.h> 9 + #include <linux/tcp.h> 8 10 #include <linux/tracepoint.h> 11 + #include <net/ipv6.h> 12 + #include <net/tcp.h> 13 + #include <linux/sock_diag.h> 14 + #include <net/rstreason.h> 9 15 10 16 #define show_mapping_status(status) \ 11 17 __print_symbolic(status, \ ··· 184 178 __entry->skb) 185 179 ); 186 180 181 + #include <trace/events/net_probe_common.h> 182 + 183 + TRACE_EVENT(mptcp_rcvbuf_grow, 184 + 185 + TP_PROTO(struct sock *sk, int time), 186 + 187 + TP_ARGS(sk, time), 188 + 189 + TP_STRUCT__entry( 190 + __field(int, time) 191 + __field(__u32, rtt_us) 192 + __field(__u32, copied) 193 + __field(__u32, inq) 194 + __field(__u32, space) 195 + __field(__u32, ooo_space) 196 + __field(__u32, rcvbuf) 197 + __field(__u32, rcv_wnd) 198 + __field(__u8, scaling_ratio) 199 + __field(__u16, sport) 200 + __field(__u16, dport) 201 + __field(__u16, family) 202 + __array(__u8, saddr, 4) 203 + __array(__u8, daddr, 4) 204 + __array(__u8, saddr_v6, 16) 205 + __array(__u8, daddr_v6, 16) 206 + __field(const void *, skaddr) 207 + ), 208 + 209 + TP_fast_assign( 210 + struct mptcp_sock *msk = mptcp_sk(sk); 211 + struct inet_sock *inet = inet_sk(sk); 212 + bool ofo_empty; 213 + __be32 *p32; 214 + 215 + __entry->time = time; 216 + __entry->rtt_us = msk->rcvq_space.rtt_us >> 3; 217 + __entry->copied = msk->rcvq_space.copied; 218 + __entry->inq = mptcp_inq_hint(sk); 219 + __entry->space = msk->rcvq_space.space; 220 + ofo_empty = RB_EMPTY_ROOT(&msk->out_of_order_queue); 221 + __entry->ooo_space = ofo_empty ? 0 : 222 + MPTCP_SKB_CB(msk->ooo_last_skb)->end_seq - 223 + msk->ack_seq; 224 + 225 + __entry->rcvbuf = sk->sk_rcvbuf; 226 + __entry->rcv_wnd = atomic64_read(&msk->rcv_wnd_sent) - 227 + msk->ack_seq; 228 + __entry->scaling_ratio = msk->scaling_ratio; 229 + __entry->sport = ntohs(inet->inet_sport); 230 + __entry->dport = ntohs(inet->inet_dport); 231 + __entry->family = sk->sk_family; 232 + 233 + p32 = (__be32 *)__entry->saddr; 234 + *p32 = inet->inet_saddr; 235 + 236 + p32 = (__be32 *)__entry->daddr; 237 + *p32 = inet->inet_daddr; 238 + 239 + TP_STORE_ADDRS(__entry, inet->inet_saddr, inet->inet_daddr, 240 + sk->sk_v6_rcv_saddr, sk->sk_v6_daddr); 241 + 242 + __entry->skaddr = sk; 243 + ), 244 + 245 + TP_printk("time=%u rtt_us=%u copied=%u inq=%u space=%u ooo=%u scaling_ratio=%u " 246 + "rcvbuf=%u rcv_wnd=%u family=%d sport=%hu dport=%hu saddr=%pI4 " 247 + "daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c skaddr=%p", 248 + __entry->time, __entry->rtt_us, __entry->copied, 249 + __entry->inq, __entry->space, __entry->ooo_space, 250 + __entry->scaling_ratio, __entry->rcvbuf, __entry->rcv_wnd, 251 + __entry->family, __entry->sport, __entry->dport, 252 + __entry->saddr, __entry->daddr, __entry->saddr_v6, 253 + __entry->daddr_v6, __entry->skaddr) 254 + ); 187 255 #endif /* _TRACE_MPTCP_H */ 188 256 189 257 /* This part must be outside protection */
+27 -29
net/mptcp/protocol.c
··· 28 28 #include "protocol.h" 29 29 #include "mib.h" 30 30 31 + static unsigned int mptcp_inq_hint(const struct sock *sk); 32 + 31 33 #define CREATE_TRACE_POINTS 32 34 #include <trace/events/mptcp.h> 33 35 ··· 226 224 do_div(grow, oldval); 227 225 rcvwin += grow << 1; 228 226 229 - if (!RB_EMPTY_ROOT(&msk->out_of_order_queue)) 230 - rcvwin += MPTCP_SKB_CB(msk->ooo_last_skb)->end_seq - msk->ack_seq; 231 - 232 227 cap = READ_ONCE(net->ipv4.sysctl_tcp_rmem[2]); 233 228 234 229 rcvbuf = min_t(u32, mptcp_space_from_win(sk, rcvwin), cap); ··· 349 350 end: 350 351 skb_condense(skb); 351 352 skb_set_owner_r(skb, sk); 352 - /* do not grow rcvbuf for not-yet-accepted or orphaned sockets. */ 353 - if (sk->sk_socket) 354 - mptcp_rcvbuf_grow(sk, msk->rcvq_space.space); 355 353 } 356 354 357 355 static void mptcp_init_skb(struct sock *ssk, struct sk_buff *skb, int offset, ··· 1160 1164 bool data_lock_held; 1161 1165 }; 1162 1166 1163 - static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct sock *ssk, 1164 - u64 data_seq, int avail_size) 1167 + static size_t mptcp_check_allowed_size(const struct mptcp_sock *msk, 1168 + struct sock *ssk, u64 data_seq, 1169 + size_t avail_size) 1165 1170 { 1166 1171 u64 window_end = mptcp_wnd_end(msk); 1167 1172 u64 mptcp_snd_wnd; ··· 1171 1174 return avail_size; 1172 1175 1173 1176 mptcp_snd_wnd = window_end - data_seq; 1174 - avail_size = min_t(unsigned int, mptcp_snd_wnd, avail_size); 1177 + avail_size = min(mptcp_snd_wnd, avail_size); 1175 1178 1176 1179 if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) { 1177 1180 tcp_sk(ssk)->snd_wnd = min_t(u64, U32_MAX, mptcp_snd_wnd); ··· 1515 1518 if (!ssk || !sk_stream_memory_free(ssk)) 1516 1519 return NULL; 1517 1520 1518 - burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); 1521 + burst = min(MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); 1519 1522 wmem = READ_ONCE(ssk->sk_wmem_queued); 1520 1523 if (!burst) 1521 1524 return ssk; ··· 2068 2071 return copied; 2069 2072 } 2070 2073 2074 + static void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk) 2075 + { 2076 + const struct tcp_sock *tp = tcp_sk(ssk); 2077 + 2078 + msk->rcvspace_init = 1; 2079 + msk->rcvq_space.copied = 0; 2080 + msk->rcvq_space.rtt_us = 0; 2081 + 2082 + /* initial rcv_space offering made to peer */ 2083 + msk->rcvq_space.space = min_t(u32, tp->rcv_wnd, 2084 + TCP_INIT_CWND * tp->advmss); 2085 + if (msk->rcvq_space.space == 0) 2086 + msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT; 2087 + } 2088 + 2071 2089 /* receive buffer autotuning. See tcp_rcv_space_adjust for more information. 2072 2090 * 2073 2091 * Only difference: Use highest rtt estimate of the subflows in use. ··· 2105 2093 2106 2094 msk->rcvq_space.copied += copied; 2107 2095 2108 - mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); 2109 - time = tcp_stamp_us_delta(mstamp, msk->rcvq_space.time); 2096 + mstamp = mptcp_stamp(); 2097 + time = tcp_stamp_us_delta(mstamp, READ_ONCE(msk->rcvq_space.time)); 2110 2098 2111 2099 rtt_us = msk->rcvq_space.rtt_us; 2112 2100 if (rtt_us && time < (rtt_us >> 3)) ··· 2136 2124 if (msk->rcvq_space.copied <= msk->rcvq_space.space) 2137 2125 goto new_measure; 2138 2126 2127 + trace_mptcp_rcvbuf_grow(sk, time); 2139 2128 if (mptcp_rcvbuf_grow(sk, msk->rcvq_space.copied)) { 2140 2129 /* Make subflows follow along. If we do not do this, we 2141 2130 * get drops at subflow level if skbs can't be moved to ··· 3567 3554 __mptcp_propagate_sndbuf(nsk, ssk); 3568 3555 3569 3556 mptcp_rcv_space_init(msk, ssk); 3557 + msk->rcvq_space.time = mptcp_stamp(); 3570 3558 3571 3559 if (mp_opt->suboptions & OPTION_MPTCP_MPC_ACK) 3572 3560 __mptcp_subflow_fully_established(msk, subflow, mp_opt); ··· 3575 3561 3576 3562 /* note: the newly allocated socket refcount is 2 now */ 3577 3563 return nsk; 3578 - } 3579 - 3580 - void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk) 3581 - { 3582 - const struct tcp_sock *tp = tcp_sk(ssk); 3583 - 3584 - msk->rcvspace_init = 1; 3585 - msk->rcvq_space.copied = 0; 3586 - msk->rcvq_space.rtt_us = 0; 3587 - 3588 - msk->rcvq_space.time = tp->tcp_mstamp; 3589 - 3590 - /* initial rcv_space offering made to peer */ 3591 - msk->rcvq_space.space = min_t(u32, tp->rcv_wnd, 3592 - TCP_INIT_CWND * tp->advmss); 3593 - if (msk->rcvq_space.space == 0) 3594 - msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT; 3595 3564 } 3596 3565 3597 3566 static void mptcp_destroy(struct sock *sk) ··· 3765 3768 * accessing the field below 3766 3769 */ 3767 3770 WRITE_ONCE(msk->local_key, subflow->local_key); 3771 + WRITE_ONCE(msk->rcvq_space.time, mptcp_stamp()); 3768 3772 3769 3773 mptcp_pm_new_connection(msk, ssk, 0); 3770 3774 }
+7 -3
net/mptcp/protocol.h
··· 246 246 247 247 struct mptcp_pm_local { 248 248 struct mptcp_addr_info addr; 249 - u8 flags; 249 + u32 flags; 250 250 int ifindex; 251 251 }; 252 252 253 253 struct mptcp_pm_addr_entry { 254 254 struct list_head list; 255 255 struct mptcp_addr_info addr; 256 - u8 flags; 256 + u32 flags; 257 257 int ifindex; 258 258 struct socket *lsk; 259 259 }; ··· 915 915 READ_ONCE(mptcp_sk(sk)->fully_established); 916 916 } 917 917 918 - void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk); 918 + static inline u64 mptcp_stamp(void) 919 + { 920 + return div_u64(tcp_clock_ns(), NSEC_PER_USEC); 921 + } 922 + 919 923 void mptcp_data_ready(struct sock *sk, struct sock *ssk); 920 924 bool mptcp_finish_join(struct sock *sk); 921 925 bool mptcp_schedule_work(struct sock *sk);
-2
net/mptcp/subflow.c
··· 462 462 463 463 subflow = mptcp_subflow_ctx(ssk); 464 464 __mptcp_propagate_sndbuf(sk, ssk); 465 - if (!msk->rcvspace_init) 466 - mptcp_rcv_space_init(msk, ssk); 467 465 468 466 if (sk->sk_state == TCP_SYN_SENT) { 469 467 /* subflow->idsn is always available is TCP_SYN_SENT state,
+7 -10
tools/testing/selftests/net/mptcp/mptcp_connect.c
··· 259 259 } 260 260 } 261 261 262 - static void set_mptfo(int fd, int pf) 262 + static void set_mptfo(int fd) 263 263 { 264 264 int qlen = 25; 265 265 ··· 336 336 set_transparent(sock, pf); 337 337 338 338 if (cfg_sockopt_types.mptfo) 339 - set_mptfo(sock, pf); 339 + set_mptfo(sock); 340 340 341 341 if (bind(sock, a->ai_addr, a->ai_addrlen) == 0) 342 342 break; /* success */ ··· 407 407 *peer = a; 408 408 break; /* success */ 409 409 } 410 + perror("sendto()"); 410 411 } else { 411 412 if (connect(sock, a->ai_addr, a->ai_addrlen) == 0) { 412 413 *peer = a; 413 414 break; /* success */ 414 415 } 415 - } 416 - if (cfg_sockopt_types.mptfo) { 417 - perror("sendto()"); 418 - close(sock); 419 - sock = -1; 420 - } else { 421 416 perror("connect()"); 422 - close(sock); 423 - sock = -1; 424 417 } 418 + 419 + /* error */ 420 + close(sock); 421 + sock = -1; 425 422 } 426 423 427 424 freeaddrinfo(addr);
+16 -13
tools/testing/selftests/net/mptcp/mptcp_diag.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Copyright (c) 2025, Kylin Software */ 3 3 4 - #include <linux/sock_diag.h> 5 - #include <linux/rtnetlink.h> 6 - #include <linux/inet_diag.h> 7 - #include <linux/netlink.h> 8 - #include <linux/compiler.h> 9 - #include <sys/socket.h> 10 - #include <netinet/in.h> 11 - #include <linux/tcp.h> 12 - #include <arpa/inet.h> 13 - 14 - #include <unistd.h> 15 - #include <stdlib.h> 16 - #include <string.h> 17 4 #include <errno.h> 18 5 #include <stdio.h> 6 + #include <stdlib.h> 7 + #include <string.h> 8 + #include <unistd.h> 9 + 10 + #include <sys/socket.h> 11 + 12 + #include <arpa/inet.h> 13 + 14 + #include <netinet/in.h> 15 + 16 + #include <linux/compiler.h> 17 + #include <linux/inet_diag.h> 18 + #include <linux/netlink.h> 19 + #include <linux/rtnetlink.h> 20 + #include <linux/sock_diag.h> 21 + #include <linux/tcp.h> 19 22 20 23 #ifndef IPPROTO_MPTCP 21 24 #define IPPROTO_MPTCP 262
+51 -56
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 603 603 local old_cnt="${2}" 604 604 local cnt 605 605 606 - local i 607 - for i in $(seq 10); do 606 + for _ in $(seq 10); do 608 607 cnt=$(rm_addr_count ${ns}) 609 608 [ "$cnt" = "${old_cnt}" ] || break 610 609 sleep 0.1 ··· 622 623 local old_cnt="${2}" 623 624 local cnt 624 625 625 - local i 626 - for i in $(seq 10); do 626 + for _ in $(seq 10); do 627 627 cnt=$(rm_sf_count ${ns}) 628 628 [ "$cnt" = "${old_cnt}" ] || break 629 629 sleep 0.1 630 630 done 631 631 } 632 632 633 + # $1: expected MPJ ACK Rx counter in $ns1 633 634 wait_mpj() 634 635 { 635 - local ns="${1}" 636 - local cnt old_cnt 636 + local exp_cnt="${1}" 637 + local cnt 637 638 638 - old_cnt=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPJoinAckRx") 639 - 640 - local i 641 - for i in $(seq 10); do 642 - cnt=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPJoinAckRx") 643 - [ "$cnt" = "${old_cnt}" ] || break 639 + for _ in $(seq 10); do 640 + cnt=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx") 641 + [ "${cnt}" = "${exp_cnt}" ] && break 644 642 sleep 0.1 645 643 done 646 644 } ··· 646 650 { 647 651 local ns="${1}" 648 652 649 - local i 650 - for i in $(seq 50); do 653 + for _ in $(seq 50); do 651 654 ip -n "${ns}" -6 addr show scope link | grep "inet6 fe80" | 652 655 grep -qw "tentative" || break 653 656 sleep 0.1 ··· 1402 1407 1403 1408 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxCreatSkErr") 1404 1409 if [ -z "$count" ]; then 1405 - rc=${KSFT_SKIP} 1410 + : # ignore skip 1406 1411 elif [ "$count" != "$create" ]; then 1407 1412 rc=${KSFT_FAIL} 1408 1413 print_check "syn tx create socket error" ··· 1411 1416 1412 1417 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxBindErr") 1413 1418 if [ -z "$count" ]; then 1414 - rc=${KSFT_SKIP} 1419 + : # ignore skip 1415 1420 elif [ "$count" != "$bind" ]; then 1416 1421 rc=${KSFT_FAIL} 1417 1422 print_check "syn tx bind error" ··· 1420 1425 1421 1426 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxConnectErr") 1422 1427 if [ -z "$count" ]; then 1423 - rc=${KSFT_SKIP} 1428 + : # ignore skip 1424 1429 elif [ "$count" != "$connect" ]; then 1425 1430 rc=${KSFT_FAIL} 1426 1431 print_check "syn tx connect error" ··· 1446 1451 1447 1452 count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtInfiniteMapTx") 1448 1453 if [ -z "$count" ]; then 1449 - rc=${KSFT_SKIP} 1454 + : # ignore skip 1450 1455 elif [ "$count" != "$infinite_map_tx" ]; then 1451 1456 rc=${KSFT_FAIL} 1452 1457 print_check "$ns infinite map tx fallback" ··· 1455 1460 1456 1461 count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtDSSCorruptionFallback") 1457 1462 if [ -z "$count" ]; then 1458 - rc=${KSFT_SKIP} 1463 + : # ignore skip 1459 1464 elif [ "$count" != "$dss_corruption" ]; then 1460 1465 rc=${KSFT_FAIL} 1461 1466 print_check "$ns dss corruption fallback" ··· 1464 1469 1465 1470 count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtSimultConnectFallback") 1466 1471 if [ -z "$count" ]; then 1467 - rc=${KSFT_SKIP} 1472 + : # ignore skip 1468 1473 elif [ "$count" != "$simult_conn" ]; then 1469 1474 rc=${KSFT_FAIL} 1470 1475 print_check "$ns simult conn fallback" ··· 1473 1478 1474 1479 count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableFallbackACK") 1475 1480 if [ -z "$count" ]; then 1476 - rc=${KSFT_SKIP} 1481 + : # ignore skip 1477 1482 elif [ "$count" != "$mpc_passive" ]; then 1478 1483 rc=${KSFT_FAIL} 1479 1484 print_check "$ns mpc passive fallback" ··· 1482 1487 1483 1488 count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableFallbackSYNACK") 1484 1489 if [ -z "$count" ]; then 1485 - rc=${KSFT_SKIP} 1490 + : # ignore skip 1486 1491 elif [ "$count" != "$mpc_active" ]; then 1487 1492 rc=${KSFT_FAIL} 1488 1493 print_check "$ns mpc active fallback" ··· 1491 1496 1492 1497 count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableDataFallback") 1493 1498 if [ -z "$count" ]; then 1494 - rc=${KSFT_SKIP} 1499 + : # ignore skip 1495 1500 elif [ "$count" != "$mpc_data" ]; then 1496 1501 rc=${KSFT_FAIL} 1497 1502 print_check "$ns mpc data fallback" ··· 1500 1505 1501 1506 count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMD5SigFallback") 1502 1507 if [ -z "$count" ]; then 1503 - rc=${KSFT_SKIP} 1508 + : # ignore skip 1504 1509 elif [ "$count" != "$md5_sig" ]; then 1505 1510 rc=${KSFT_FAIL} 1506 1511 print_check "$ns MD5 Sig fallback" ··· 1509 1514 1510 1515 count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtDssFallback") 1511 1516 if [ -z "$count" ]; then 1512 - rc=${KSFT_SKIP} 1517 + : # ignore skip 1513 1518 elif [ "$count" != "$dss" ]; then 1514 1519 rc=${KSFT_FAIL} 1515 1520 print_check "$ns dss fallback" ··· 1585 1590 1586 1591 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckHMacFailure") 1587 1592 if [ -z "$count" ]; then 1588 - rc=${KSFT_SKIP} 1593 + : # ignore skip 1589 1594 elif [ "$count" != "0" ]; then 1590 1595 rc=${KSFT_FAIL} 1591 1596 print_check "synack HMAC" ··· 1594 1599 1595 1600 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx") 1596 1601 if [ -z "$count" ]; then 1597 - rc=${KSFT_SKIP} 1602 + : # ignore skip 1598 1603 elif [ "$count" != "$ack_nr" ]; then 1599 1604 rc=${KSFT_FAIL} 1600 1605 print_check "ack rx" ··· 1603 1608 1604 1609 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckHMacFailure") 1605 1610 if [ -z "$count" ]; then 1606 - rc=${KSFT_SKIP} 1611 + : # ignore skip 1607 1612 elif [ "$count" != "0" ]; then 1608 1613 rc=${KSFT_FAIL} 1609 1614 print_check "ack HMAC" ··· 1612 1617 1613 1618 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinRejected") 1614 1619 if [ -z "$count" ]; then 1615 - rc=${KSFT_SKIP} 1620 + : # ignore skip 1616 1621 elif [ "$count" != "$syn_rej" ]; then 1617 1622 rc=${KSFT_FAIL} 1618 1623 print_check "syn rejected" ··· 1645 1650 local stale_min=$2 1646 1651 local stale_max=$3 1647 1652 local stale_delta=$4 1648 - local dump_stats 1649 1653 local stale_nr 1650 1654 local recover_nr 1651 1655 ··· 1660 1666 fail_test "got $stale_nr stale[s] $recover_nr recover[s], " \ 1661 1667 " expected stale in range [$stale_min..$stale_max]," \ 1662 1668 " stale-recover delta $stale_delta" 1663 - dump_stats=1 1669 + echo $ns stats 1670 + ip -n $ns -s link show 1664 1671 else 1665 1672 print_ok 1666 - fi 1667 - 1668 - if [ "${dump_stats}" = 1 ]; then 1669 - echo $ns stats 1670 - ip netns exec $ns ip -s link show 1671 - ip netns exec $ns nstat -as | grep MPTcp 1672 1673 fi 1673 1674 } 1674 1675 ··· 3707 3718 tk=$(mptcp_lib_evts_get_info token "$evts") 3708 3719 3709 3720 ip netns exec $1 ./pm_nl_ctl ann $2 token $tk id $3 3710 - sleep 1 3711 3721 } 3712 3722 3713 3723 # $1: ns ; $2: id ··· 3737 3749 3738 3750 ip netns exec $1 ./pm_nl_ctl csf lip $2 lid $3 \ 3739 3751 rip $da rport $dp token $tk 3740 - sleep 1 3741 3752 } 3742 3753 3743 3754 # $1: ns ; $2: addr $3: event type ··· 3986 3999 { timeout_test=120 test_linkfail=128 speed=5 \ 3987 4000 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3988 4001 local tests_pid=$! 3989 - wait_mpj $ns1 4002 + wait_event ns1 MPTCP_LIB_EVENT_ESTABLISHED 1 3990 4003 userspace_pm_add_addr $ns1 10.0.2.1 10 4004 + wait_event ns2 MPTCP_LIB_EVENT_ANNOUNCED 1 3991 4005 userspace_pm_add_addr $ns1 10.0.3.1 20 4006 + wait_event ns2 MPTCP_LIB_EVENT_ANNOUNCED 2 3992 4007 chk_join_nr 2 2 2 3993 4008 chk_add_nr 2 2 3994 4009 chk_mptcp_info subflows 2 subflows 2 ··· 4021 4032 { timeout_test=120 test_linkfail=128 speed=5 \ 4022 4033 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 4023 4034 local tests_pid=$! 4024 - wait_mpj $ns2 4035 + wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 4025 4036 userspace_pm_add_sf $ns2 10.0.3.2 20 4037 + wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1 4026 4038 chk_join_nr 1 1 1 4027 4039 chk_mptcp_info subflows 1 subflows 1 4028 4040 chk_subflows_total 2 2 ··· 4050 4060 { timeout_test=120 test_linkfail=128 speed=5 \ 4051 4061 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 4052 4062 local tests_pid=$! 4053 - wait_mpj $ns2 4063 + wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 4054 4064 chk_mptcp_info subflows 0 subflows 0 4055 4065 chk_subflows_total 1 1 4056 4066 userspace_pm_add_sf $ns2 10.0.3.2 0 4067 + wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1 4057 4068 userspace_pm_chk_dump_addr "${ns2}" \ 4058 4069 "id 0 flags subflow 10.0.3.2" "id 0 subflow" 4059 4070 chk_join_nr 1 1 1 ··· 4072 4081 { timeout_test=120 test_linkfail=128 speed=5 \ 4073 4082 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 4074 4083 local tests_pid=$! 4075 - wait_mpj $ns2 4084 + wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 4076 4085 userspace_pm_add_sf $ns2 10.0.3.2 20 4086 + wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1 4077 4087 chk_join_nr 1 1 1 4078 4088 chk_mptcp_info subflows 1 subflows 1 4079 4089 chk_subflows_total 2 2 ··· 4097 4105 { timeout_test=120 test_linkfail=128 speed=5 \ 4098 4106 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 4099 4107 local tests_pid=$! 4100 - wait_mpj $ns1 4108 + wait_event ns1 MPTCP_LIB_EVENT_ESTABLISHED 1 4101 4109 userspace_pm_add_addr $ns1 10.0.2.1 10 4110 + wait_event ns2 MPTCP_LIB_EVENT_ANNOUNCED 1 4102 4111 chk_join_nr 1 1 1 4103 4112 chk_add_nr 1 1 4104 4113 chk_mptcp_info subflows 1 subflows 1 ··· 4126 4133 local tests_pid=$! 4127 4134 wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 4128 4135 userspace_pm_add_sf $ns2 10.0.3.2 20 4136 + wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1 4129 4137 chk_mptcp_info subflows 1 subflows 1 4130 4138 chk_subflows_total 2 2 4131 4139 ··· 4152 4158 { 4153 4159 # subflow_rebuild_header is needed to support the implicit flag 4154 4160 # userspace pm type prevents add_addr 4155 - if reset "implicit EP" && 4161 + if reset_with_events "implicit EP" && 4156 4162 continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then 4157 4163 pm_nl_set_limits $ns1 2 2 4158 4164 pm_nl_set_limits $ns2 2 2 ··· 4161 4167 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 4162 4168 local tests_pid=$! 4163 4169 4164 - wait_mpj $ns1 4170 + wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 4165 4171 pm_nl_check_endpoint "creation" \ 4166 4172 $ns2 10.0.2.2 id 1 flags implicit 4167 4173 chk_mptcp_info subflows 1 subflows 1 ··· 4175 4181 pm_nl_check_endpoint "modif is allowed" \ 4176 4182 $ns2 10.0.2.2 id 1 flags signal 4177 4183 mptcp_lib_kill_group_wait $tests_pid 4184 + kill_events_pids 4178 4185 fi 4179 4186 4180 4187 if reset_with_tcp_filter "delete and re-add" ns2 10.0.3.2 REJECT OUTPUT && ··· 4189 4194 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 4190 4195 local tests_pid=$! 4191 4196 4192 - wait_mpj $ns2 4197 + wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 4193 4198 pm_nl_check_endpoint "creation" \ 4194 4199 $ns2 10.0.2.2 id 2 flags subflow dev ns2eth2 4195 4200 chk_subflow_nr "before delete id 2" 2 ··· 4201 4206 chk_mptcp_info subflows 0 subflows 0 4202 4207 4203 4208 pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow 4204 - wait_mpj $ns2 4209 + wait_mpj 2 4205 4210 chk_subflow_nr "after re-add id 2" 2 4206 4211 chk_mptcp_info subflows 1 subflows 1 4207 4212 ··· 4213 4218 ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT 4214 4219 pm_nl_del_endpoint $ns2 3 10.0.3.2 4215 4220 pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow 4216 - wait_mpj $ns2 4221 + wait_mpj 3 4217 4222 chk_subflow_nr "after no reject" 3 4218 4223 chk_mptcp_info subflows 2 subflows 2 4219 4224 ··· 4225 4230 chk_mptcp_info subflows 2 subflows 2 # only decr for additional sf 4226 4231 4227 4232 pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow 4228 - wait_mpj $ns2 4233 + wait_mpj $((3 + i)) 4229 4234 chk_subflow_nr "after re-add id 0 ($i)" 3 4230 4235 chk_mptcp_info subflows 3 subflows 3 4231 4236 done ··· 4267 4272 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 4268 4273 local tests_pid=$! 4269 4274 4270 - wait_mpj $ns2 4275 + wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 4271 4276 pm_nl_check_endpoint "creation" \ 4272 4277 $ns1 10.0.2.1 id 1 flags signal 4273 4278 chk_subflow_nr "before delete" 2 ··· 4283 4288 4284 4289 pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal 4285 4290 pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal 4286 - wait_mpj $ns2 4291 + wait_mpj 3 4287 4292 chk_subflow_nr "after re-add" 3 4288 4293 chk_mptcp_info subflows 2 subflows 2 4289 4294 chk_mptcp_info add_addr_signal 2 add_addr_accepted 2 ··· 4295 4300 chk_mptcp_info add_addr_signal 2 add_addr_accepted 2 4296 4301 4297 4302 pm_nl_add_endpoint $ns1 10.0.1.1 id 99 flags signal 4298 - wait_mpj $ns2 4303 + wait_mpj 4 4299 4304 chk_subflow_nr "after re-add ID 0" 3 4300 4305 chk_mptcp_info subflows 3 subflows 3 4301 4306 chk_mptcp_info add_addr_signal 3 add_addr_accepted 2 ··· 4307 4312 chk_mptcp_info add_addr_signal 2 add_addr_accepted 2 4308 4313 4309 4314 pm_nl_add_endpoint $ns1 10.0.1.1 id 88 flags signal 4310 - wait_mpj $ns2 4315 + wait_mpj 5 4311 4316 chk_subflow_nr "after re-re-add ID 0" 3 4312 4317 chk_mptcp_info subflows 3 subflows 3 4313 4318 chk_mptcp_info add_addr_signal 3 add_addr_accepted 2 ··· 4356 4361 wait_rm_addr $ns2 0 4357 4362 ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT 4358 4363 pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow 4359 - wait_mpj $ns2 4364 + wait_mpj 1 4360 4365 pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal 4361 - wait_mpj $ns2 4366 + wait_mpj 2 4362 4367 mptcp_lib_kill_group_wait $tests_pid 4363 4368 4364 4369 join_syn_tx=3 join_connect_err=1 \