Commit 979e9017 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarMatthieu Baerts <matttbe@kernel.org>
parents b1dfc0f7 356c71c4
...@@ -191,6 +191,10 @@ Gao Xiang <xiang@kernel.org> <gaoxiang25@huawei.com> ...@@ -191,6 +191,10 @@ Gao Xiang <xiang@kernel.org> <gaoxiang25@huawei.com>
Gao Xiang <xiang@kernel.org> <hsiangkao@aol.com> Gao Xiang <xiang@kernel.org> <hsiangkao@aol.com>
Gao Xiang <xiang@kernel.org> <hsiangkao@linux.alibaba.com> Gao Xiang <xiang@kernel.org> <hsiangkao@linux.alibaba.com>
Gao Xiang <xiang@kernel.org> <hsiangkao@redhat.com> Gao Xiang <xiang@kernel.org> <hsiangkao@redhat.com>
Geliang Tang <geliang.tang@linux.dev> <geliang.tang@suse.com>
Geliang Tang <geliang.tang@linux.dev> <geliangtang@xiaomi.com>
Geliang Tang <geliang.tang@linux.dev> <geliangtang@gmail.com>
Geliang Tang <geliang.tang@linux.dev> <geliangtang@163.com>
Georgi Djakov <djakov@kernel.org> <georgi.djakov@linaro.org> Georgi Djakov <djakov@kernel.org> <georgi.djakov@linaro.org>
Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@de.ibm.com> Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@de.ibm.com>
Gerald Schaefer <gerald.schaefer@linux.ibm.com> <gerald.schaefer@de.ibm.com> Gerald Schaefer <gerald.schaefer@linux.ibm.com> <gerald.schaefer@de.ibm.com>
......
...@@ -70,3 +70,4 @@ static struct kunit_suite mptcp_crypto_suite = { ...@@ -70,3 +70,4 @@ static struct kunit_suite mptcp_crypto_suite = {
kunit_test_suite(mptcp_crypto_suite); kunit_test_suite(mptcp_crypto_suite);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("KUnit tests for MPTCP Crypto");
...@@ -3402,12 +3402,12 @@ static void mptcp_release_cb(struct sock *sk) ...@@ -3402,12 +3402,12 @@ static void mptcp_release_cb(struct sock *sk)
if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags))
__mptcp_clean_una_wakeup(sk); __mptcp_clean_una_wakeup(sk);
if (unlikely(msk->cb_flags)) { if (unlikely(msk->cb_flags)) {
/* be sure to set the current sk state before taking actions /* be sure to sync the msk state before taking actions
* depending on sk_state (MPTCP_ERROR_REPORT) * depending on sk_state (MPTCP_ERROR_REPORT)
* On sk release avoid actions depending on the first subflow * On sk release avoid actions depending on the first subflow
*/ */
if (__test_and_clear_bit(MPTCP_CONNECTED, &msk->cb_flags) && msk->first) if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first)
__mptcp_set_connected(sk); __mptcp_sync_state(sk, msk->pending_state);
if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags))
__mptcp_error_report(sk); __mptcp_error_report(sk);
if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags))
......
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
#define MPTCP_ERROR_REPORT 3 #define MPTCP_ERROR_REPORT 3
#define MPTCP_RETRANSMIT 4 #define MPTCP_RETRANSMIT 4
#define MPTCP_FLUSH_JOIN_LIST 5 #define MPTCP_FLUSH_JOIN_LIST 5
#define MPTCP_CONNECTED 6 #define MPTCP_SYNC_STATE 6
#define MPTCP_SYNC_SNDBUF 7 #define MPTCP_SYNC_SNDBUF 7
struct mptcp_skb_cb { struct mptcp_skb_cb {
...@@ -296,6 +296,9 @@ struct mptcp_sock { ...@@ -296,6 +296,9 @@ struct mptcp_sock {
bool use_64bit_ack; /* Set when we received a 64-bit DSN */ bool use_64bit_ack; /* Set when we received a 64-bit DSN */
bool csum_enabled; bool csum_enabled;
bool allow_infinite_fallback; bool allow_infinite_fallback;
u8 pending_state; /* A subflow asked to set this sk_state,
* protected by the msk data lock
*/
u8 mpc_endpoint_id; u8 mpc_endpoint_id;
u8 recvmsg_inq:1, u8 recvmsg_inq:1,
cork:1, cork:1,
...@@ -728,7 +731,7 @@ void mptcp_get_options(const struct sk_buff *skb, ...@@ -728,7 +731,7 @@ void mptcp_get_options(const struct sk_buff *skb,
struct mptcp_options_received *mp_opt); struct mptcp_options_received *mp_opt);
void mptcp_finish_connect(struct sock *sk); void mptcp_finish_connect(struct sock *sk);
void __mptcp_set_connected(struct sock *sk); void __mptcp_sync_state(struct sock *sk, int state);
void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout); void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout);
static inline void mptcp_stop_tout_timer(struct sock *sk) static inline void mptcp_stop_tout_timer(struct sock *sk)
...@@ -1115,7 +1118,7 @@ static inline bool subflow_simultaneous_connect(struct sock *sk) ...@@ -1115,7 +1118,7 @@ static inline bool subflow_simultaneous_connect(struct sock *sk)
{ {
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
return sk->sk_state == TCP_ESTABLISHED && return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_FIN_WAIT1) &&
is_active_ssk(subflow) && is_active_ssk(subflow) &&
!subflow->conn_finished; !subflow->conn_finished;
} }
......
...@@ -419,22 +419,28 @@ static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct soc ...@@ -419,22 +419,28 @@ static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct soc
return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport;
} }
void __mptcp_set_connected(struct sock *sk) void __mptcp_sync_state(struct sock *sk, int state)
{ {
__mptcp_propagate_sndbuf(sk, mptcp_sk(sk)->first); struct mptcp_sock *msk = mptcp_sk(sk);
__mptcp_propagate_sndbuf(sk, msk->first);
if (sk->sk_state == TCP_SYN_SENT) { if (sk->sk_state == TCP_SYN_SENT) {
inet_sk_state_store(sk, TCP_ESTABLISHED); inet_sk_state_store(sk, state);
sk->sk_state_change(sk); sk->sk_state_change(sk);
} }
} }
static void mptcp_set_connected(struct sock *sk) static void mptcp_propagate_state(struct sock *sk, struct sock *ssk)
{ {
struct mptcp_sock *msk = mptcp_sk(sk);
mptcp_data_lock(sk); mptcp_data_lock(sk);
if (!sock_owned_by_user(sk)) if (!sock_owned_by_user(sk)) {
__mptcp_set_connected(sk); __mptcp_sync_state(sk, ssk->sk_state);
else } else {
__set_bit(MPTCP_CONNECTED, &mptcp_sk(sk)->cb_flags); msk->pending_state = ssk->sk_state;
__set_bit(MPTCP_SYNC_STATE, &msk->cb_flags);
}
mptcp_data_unlock(sk); mptcp_data_unlock(sk);
} }
...@@ -496,7 +502,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) ...@@ -496,7 +502,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
subflow_set_remote_key(msk, subflow, &mp_opt); subflow_set_remote_key(msk, subflow, &mp_opt);
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK);
mptcp_finish_connect(sk); mptcp_finish_connect(sk);
mptcp_set_connected(parent); mptcp_propagate_state(parent, sk);
} else if (subflow->request_join) { } else if (subflow->request_join) {
u8 hmac[SHA256_DIGEST_SIZE]; u8 hmac[SHA256_DIGEST_SIZE];
...@@ -540,7 +546,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) ...@@ -540,7 +546,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
} else if (mptcp_check_fallback(sk)) { } else if (mptcp_check_fallback(sk)) {
fallback: fallback:
mptcp_rcv_space_init(msk, sk); mptcp_rcv_space_init(msk, sk);
mptcp_set_connected(parent); mptcp_propagate_state(parent, sk);
} }
return; return;
...@@ -1740,7 +1746,7 @@ static void subflow_state_change(struct sock *sk) ...@@ -1740,7 +1746,7 @@ static void subflow_state_change(struct sock *sk)
mptcp_rcv_space_init(msk, sk); mptcp_rcv_space_init(msk, sk);
pr_fallback(msk); pr_fallback(msk);
subflow->conn_finished = 1; subflow->conn_finished = 1;
mptcp_set_connected(parent); mptcp_propagate_state(parent, sk);
} }
/* as recvmsg() does not acquire the subflow socket for ssk selection /* as recvmsg() does not acquire the subflow socket for ssk selection
......
...@@ -143,3 +143,4 @@ static struct kunit_suite mptcp_token_suite = { ...@@ -143,3 +143,4 @@ static struct kunit_suite mptcp_token_suite = {
kunit_test_suite(mptcp_token_suite); kunit_test_suite(mptcp_token_suite);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("KUnit tests for MPTCP Token");
...@@ -2776,7 +2776,7 @@ backup_tests() ...@@ -2776,7 +2776,7 @@ backup_tests()
fi fi
if reset "mpc backup" && if reset "mpc backup" &&
continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
speed=slow \ speed=slow \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
...@@ -2785,7 +2785,7 @@ backup_tests() ...@@ -2785,7 +2785,7 @@ backup_tests()
fi fi
if reset "mpc backup both sides" && if reset "mpc backup both sides" &&
continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
speed=slow \ speed=slow \
...@@ -2795,7 +2795,7 @@ backup_tests() ...@@ -2795,7 +2795,7 @@ backup_tests()
fi fi
if reset "mpc switch to backup" && if reset "mpc switch to backup" &&
continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
sflags=backup speed=slow \ sflags=backup speed=slow \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
...@@ -2804,7 +2804,7 @@ backup_tests() ...@@ -2804,7 +2804,7 @@ backup_tests()
fi fi
if reset "mpc switch to backup both sides" && if reset "mpc switch to backup both sides" &&
continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
sflags=backup speed=slow \ sflags=backup speed=slow \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment