Skip to content

Commit 979e901

Browse files
committed
Merge branch 'mptcp-misc-fixes'
Matthieu Baerts says: ==================== mptcp: misc. fixes for v6.7 Here are a few fixes related to MPTCP: Patch 1 avoids skipping some subtests of the MPTCP Join selftest by mistake when using older versions of GCC. This fixes a patch introduced in v6.4, backported up to v6.1. Patch 2 fixes an inconsistent state when using MPTCP + FastOpen. A fix for v6.2. Patch 3 adds a description for MPTCP Kunit test modules to avoid a warning. Patch 4 adds an entry to the mailmap file for Geliang's email addresses. ==================== Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Matthieu Baerts <[email protected]>
2 parents b1dfc0f + 356c71c commit 979e901

File tree

7 files changed

+36
-21
lines changed

7 files changed

+36
-21
lines changed

.mailmap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ Gao Xiang <[email protected]> <[email protected]>
191191
192192
193193
194+
195+
196+
197+
194198
195199
196200

net/mptcp/crypto_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ static struct kunit_suite mptcp_crypto_suite = {
7070
kunit_test_suite(mptcp_crypto_suite);
7171

7272
MODULE_LICENSE("GPL");
73+
MODULE_DESCRIPTION("KUnit tests for MPTCP Crypto");

net/mptcp/protocol.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,12 +3402,12 @@ static void mptcp_release_cb(struct sock *sk)
34023402
if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags))
34033403
__mptcp_clean_una_wakeup(sk);
34043404
if (unlikely(msk->cb_flags)) {
3405-
/* be sure to set the current sk state before taking actions
3405+
/* be sure to sync the msk state before taking actions
34063406
* depending on sk_state (MPTCP_ERROR_REPORT)
34073407
* On sk release avoid actions depending on the first subflow
34083408
*/
3409-
if (__test_and_clear_bit(MPTCP_CONNECTED, &msk->cb_flags) && msk->first)
3410-
__mptcp_set_connected(sk);
3409+
if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first)
3410+
__mptcp_sync_state(sk, msk->pending_state);
34113411
if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags))
34123412
__mptcp_error_report(sk);
34133413
if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags))

net/mptcp/protocol.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
#define MPTCP_ERROR_REPORT 3
125125
#define MPTCP_RETRANSMIT 4
126126
#define MPTCP_FLUSH_JOIN_LIST 5
127-
#define MPTCP_CONNECTED 6
127+
#define MPTCP_SYNC_STATE 6
128128
#define MPTCP_SYNC_SNDBUF 7
129129

130130
struct mptcp_skb_cb {
@@ -296,6 +296,9 @@ struct mptcp_sock {
296296
bool use_64bit_ack; /* Set when we received a 64-bit DSN */
297297
bool csum_enabled;
298298
bool allow_infinite_fallback;
299+
u8 pending_state; /* A subflow asked to set this sk_state,
300+
* protected by the msk data lock
301+
*/
299302
u8 mpc_endpoint_id;
300303
u8 recvmsg_inq:1,
301304
cork:1,
@@ -728,7 +731,7 @@ void mptcp_get_options(const struct sk_buff *skb,
728731
struct mptcp_options_received *mp_opt);
729732

730733
void mptcp_finish_connect(struct sock *sk);
731-
void __mptcp_set_connected(struct sock *sk);
734+
void __mptcp_sync_state(struct sock *sk, int state);
732735
void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout);
733736

734737
static inline void mptcp_stop_tout_timer(struct sock *sk)
@@ -1115,7 +1118,7 @@ static inline bool subflow_simultaneous_connect(struct sock *sk)
11151118
{
11161119
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
11171120

1118-
return sk->sk_state == TCP_ESTABLISHED &&
1121+
return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_FIN_WAIT1) &&
11191122
is_active_ssk(subflow) &&
11201123
!subflow->conn_finished;
11211124
}

net/mptcp/subflow.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -419,22 +419,28 @@ static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct soc
419419
return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport;
420420
}
421421

422-
void __mptcp_set_connected(struct sock *sk)
422+
void __mptcp_sync_state(struct sock *sk, int state)
423423
{
424-
__mptcp_propagate_sndbuf(sk, mptcp_sk(sk)->first);
424+
struct mptcp_sock *msk = mptcp_sk(sk);
425+
426+
__mptcp_propagate_sndbuf(sk, msk->first);
425427
if (sk->sk_state == TCP_SYN_SENT) {
426-
inet_sk_state_store(sk, TCP_ESTABLISHED);
428+
inet_sk_state_store(sk, state);
427429
sk->sk_state_change(sk);
428430
}
429431
}
430432

431-
static void mptcp_set_connected(struct sock *sk)
433+
static void mptcp_propagate_state(struct sock *sk, struct sock *ssk)
432434
{
435+
struct mptcp_sock *msk = mptcp_sk(sk);
436+
433437
mptcp_data_lock(sk);
434-
if (!sock_owned_by_user(sk))
435-
__mptcp_set_connected(sk);
436-
else
437-
__set_bit(MPTCP_CONNECTED, &mptcp_sk(sk)->cb_flags);
438+
if (!sock_owned_by_user(sk)) {
439+
__mptcp_sync_state(sk, ssk->sk_state);
440+
} else {
441+
msk->pending_state = ssk->sk_state;
442+
__set_bit(MPTCP_SYNC_STATE, &msk->cb_flags);
443+
}
438444
mptcp_data_unlock(sk);
439445
}
440446

@@ -496,7 +502,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
496502
subflow_set_remote_key(msk, subflow, &mp_opt);
497503
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK);
498504
mptcp_finish_connect(sk);
499-
mptcp_set_connected(parent);
505+
mptcp_propagate_state(parent, sk);
500506
} else if (subflow->request_join) {
501507
u8 hmac[SHA256_DIGEST_SIZE];
502508

@@ -540,7 +546,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
540546
} else if (mptcp_check_fallback(sk)) {
541547
fallback:
542548
mptcp_rcv_space_init(msk, sk);
543-
mptcp_set_connected(parent);
549+
mptcp_propagate_state(parent, sk);
544550
}
545551
return;
546552

@@ -1740,7 +1746,7 @@ static void subflow_state_change(struct sock *sk)
17401746
mptcp_rcv_space_init(msk, sk);
17411747
pr_fallback(msk);
17421748
subflow->conn_finished = 1;
1743-
mptcp_set_connected(parent);
1749+
mptcp_propagate_state(parent, sk);
17441750
}
17451751

17461752
/* as recvmsg() does not acquire the subflow socket for ssk selection

net/mptcp/token_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,4 @@ static struct kunit_suite mptcp_token_suite = {
143143
kunit_test_suite(mptcp_token_suite);
144144

145145
MODULE_LICENSE("GPL");
146+
MODULE_DESCRIPTION("KUnit tests for MPTCP Token");

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ backup_tests()
27762776
fi
27772777

27782778
if reset "mpc backup" &&
2779-
continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
2779+
continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
27802780
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
27812781
speed=slow \
27822782
run_tests $ns1 $ns2 10.0.1.1
@@ -2785,7 +2785,7 @@ backup_tests()
27852785
fi
27862786

27872787
if reset "mpc backup both sides" &&
2788-
continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
2788+
continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
27892789
pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup
27902790
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
27912791
speed=slow \
@@ -2795,7 +2795,7 @@ backup_tests()
27952795
fi
27962796

27972797
if reset "mpc switch to backup" &&
2798-
continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
2798+
continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
27992799
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
28002800
sflags=backup speed=slow \
28012801
run_tests $ns1 $ns2 10.0.1.1
@@ -2804,7 +2804,7 @@ backup_tests()
28042804
fi
28052805

28062806
if reset "mpc switch to backup both sides" &&
2807-
continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
2807+
continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
28082808
pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow
28092809
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
28102810
sflags=backup speed=slow \

0 commit comments

Comments
 (0)