Skip to content

Commit 70b3c88

Browse files
committed
Merge branch 'mptcp-various-fixes'
Matthieu Baerts says: ==================== mptcp: various fixes The different patches here are some unrelated fixes for MPTCP: - Patch 1 ensures 'snd_una' is initialised on connect in case of MPTCP fallback to TCP followed by retransmissions before the processing of any other incoming packets. A fix for v5.9+. - Patch 2 makes sure the RmAddr MIB counter is incremented, and only once per ID, upon the reception of a RM_ADDR. A fix for v5.10+. - Patch 3 doesn't update 'add addr' related counters if the connect() was not possible. A fix for v5.7+. - Patch 4 updates the mailmap file to add Geliang's new email address. ==================== Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 44180fe + 74acb25 commit 70b3c88

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ Geliang Tang <[email protected]> <[email protected]>
217217
218218
219219
220+
220221
221222
222223

net/mptcp/pm_netlink.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
677677
unsigned int add_addr_accept_max;
678678
struct mptcp_addr_info remote;
679679
unsigned int subflows_max;
680+
bool sf_created = false;
680681
int i, nr;
681682

682683
add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk);
@@ -704,15 +705,18 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
704705
if (nr == 0)
705706
return;
706707

707-
msk->pm.add_addr_accepted++;
708-
if (msk->pm.add_addr_accepted >= add_addr_accept_max ||
709-
msk->pm.subflows >= subflows_max)
710-
WRITE_ONCE(msk->pm.accept_addr, false);
711-
712708
spin_unlock_bh(&msk->pm.lock);
713709
for (i = 0; i < nr; i++)
714-
__mptcp_subflow_connect(sk, &addrs[i], &remote);
710+
if (__mptcp_subflow_connect(sk, &addrs[i], &remote) == 0)
711+
sf_created = true;
715712
spin_lock_bh(&msk->pm.lock);
713+
714+
if (sf_created) {
715+
msk->pm.add_addr_accepted++;
716+
if (msk->pm.add_addr_accepted >= add_addr_accept_max ||
717+
msk->pm.subflows >= subflows_max)
718+
WRITE_ONCE(msk->pm.accept_addr, false);
719+
}
716720
}
717721

718722
void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk)
@@ -814,10 +818,13 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,
814818
spin_lock_bh(&msk->pm.lock);
815819

816820
removed = true;
817-
__MPTCP_INC_STATS(sock_net(sk), rm_type);
821+
if (rm_type == MPTCP_MIB_RMSUBFLOW)
822+
__MPTCP_INC_STATS(sock_net(sk), rm_type);
818823
}
819824
if (rm_type == MPTCP_MIB_RMSUBFLOW)
820825
__set_bit(rm_id ? rm_id : msk->mpc_endpoint_id, msk->pm.id_avail_bitmap);
826+
else if (rm_type == MPTCP_MIB_RMADDR)
827+
__MPTCP_INC_STATS(sock_net(sk), rm_type);
821828
if (!removed)
822829
continue;
823830

net/mptcp/protocol.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3740,6 +3740,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
37403740

37413741
WRITE_ONCE(msk->write_seq, subflow->idsn);
37423742
WRITE_ONCE(msk->snd_nxt, subflow->idsn);
3743+
WRITE_ONCE(msk->snd_una, subflow->idsn);
37433744
if (likely(!__mptcp_check_fallback(msk)))
37443745
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVE);
37453746

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,9 +2249,10 @@ remove_tests()
22492249
if reset "remove invalid addresses"; then
22502250
pm_nl_set_limits $ns1 3 3
22512251
pm_nl_add_endpoint $ns1 10.0.12.1 flags signal
2252+
# broadcast IP: no packet for this address will be received on ns1
2253+
pm_nl_add_endpoint $ns1 224.0.0.1 flags signal
22522254
pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
2253-
pm_nl_add_endpoint $ns1 10.0.14.1 flags signal
2254-
pm_nl_set_limits $ns2 3 3
2255+
pm_nl_set_limits $ns2 2 2
22552256
addr_nr_ns1=-3 speed=10 \
22562257
run_tests $ns1 $ns2 10.0.1.1
22572258
chk_join_nr 1 1 1

0 commit comments

Comments
 (0)