[MPTCP][PATCH v3 mptcp-next 0/9] RM_ADDR: remove a list of addrs
by Geliang Tang
v3:
- avoid looping twice in mptcp_write_options
- drop nr in mptcp_get_rm_ids_nr
- use rm_ids[0] in patch 1 and patch 3
- separate pm.rm_ids for incoming and outgoing
- tag: export/20210131T062218
v2:
- use an array of ids instead of a u64 map
- drop "mptcp: update the netlink event for rm_addr" in v1
- tag: export/20210131T062218
This patchset added the removing a list of addresses support for
RM_ADDR. It addressed issue #140.
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/140
Geliang Tang (9):
mptcp: use rm_ids array in mptcp_out_options
mptcp: use rm_ids_tx array in mptcp_pm_data
mptcp: use rm_ids array in mptcp_options_received
mptcp: use rm_ids_rx array in mptcp_pm_data
mptcp: remove multi addresses in PM
mptcp: remove multi subflows in PM
mptcp: remove multi addresses and subflows in PM
mptcp: remove a list of addrs when flushing
selftests: mptcp: add testcases for removing addrs
include/net/mptcp.h | 4 +-
net/mptcp/options.c | 56 ++++--
net/mptcp/pm.c | 29 +--
net/mptcp/pm_netlink.c | 190 ++++++++++++++----
net/mptcp/protocol.h | 27 ++-
.../testing/selftests/net/mptcp/mptcp_join.sh | 23 +++
6 files changed, 255 insertions(+), 74 deletions(-)
--
2.29.2
1 year, 3 months
[bug report] the test cases for signaling invalid addresses don't work
by Geliang Tang
I added two test cases for signaling multi addresses today:
# signal addresses
reset
ip netns exec $ns1 ./pm_nl_ctl limits 3 3
ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal
ip netns exec $ns1 ./pm_nl_ctl add 10.0.4.1 flags signal
ip netns exec $ns2 ./pm_nl_ctl limits 3 3
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr "signal addresses" 3 3 3
chk_add_nr 3 3
# signal invalid addresses
reset
ip netns exec $ns1 ./pm_nl_ctl limits 3 3
ip netns exec $ns1 ./pm_nl_ctl add 10.0.12.1 flags signal
ip netns exec $ns1 ./pm_nl_ctl add 10.0.13.1 flags signal
ip netns exec $ns1 ./pm_nl_ctl add 10.0.14.1 flags signal
ip netns exec $ns2 ./pm_nl_ctl limits 3 3
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr "signal invalid addresses" 0 0 0
chk_add_nr 1 1
The 1st one works well, the 2nd one added three invalid addresses, but
only got 1 ADD_ADDR and 1 ECHO. I thought it should be 0 ADD_ADDR or
3 ADD_ADDRs.
In the 2nd test case, mptcp_pm_create_subflow_or_signal_addr was only
triggered once when the msk is established. Since the first address is an
invalid one, the subflow for it cannot be created successfully. So
mptcp_pm_nl_subflow_established could not be invoked. The last two
addresses didn't have a chance to be announced. I think this behavior is
incorrect.
I have several questions about this:
1. Is this an known issue? Is it worth creating a new issue on github and
fixing it?
2. What do we expect for the 2nd test case, 0 ADD_ADDR or 3 ADD_ADDRs?
3. Should we skip announcing the invalid addresses?
4. Or should we change the logic of mptcp_pm_create_subflow_or_signal_addr
to announce all the invalid addresses?
Please give me some suggestions about this.
Thanks.
-Geliang
1 year, 3 months
[PATCH mptcp-net] mptcp: init mptcp request socket earlier
by Paolo Abeni
The mptcp subflow route_req() callback performs the subflow
req initialization after the route_req() check. If the latter
fails, mptcp-specific bits of the current request sockets
are left uninitialized.
The above causes bad things at req socket disposal time, when
the mptcp resources are cleared.
This change addresses the issue by splitting subflow_init_req()
into the actual initialization and the mptcp-specific checks.
The initialization is moved before any possibly failing check.
Reported-by: Christoph Paasch <cpaasch(a)apple.com>
Fixes: 7ea851d19b23 ("tcp: merge 'init_req' and 'route_req' functions")
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
Should fix issues/125 && 130. Even syzkaller would proof the
opposite, the problem described above looks real.
@Christoph: could you please... ? (additional free coffee for your
upcoming holiday in Tuscany ;)
---
net/mptcp/subflow.c | 39 ++++++++++++++++-----------------------
1 file changed, 16 insertions(+), 23 deletions(-)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 7a5518f751105..26129172f5acd 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -100,7 +100,7 @@ static struct mptcp_sock *subflow_token_join_request(struct request_sock *req)
return msk;
}
-static int __subflow_init_req(struct request_sock *req, const struct sock *sk_listener)
+static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener)
{
struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
@@ -108,16 +108,6 @@ static int __subflow_init_req(struct request_sock *req, const struct sock *sk_li
subflow_req->mp_join = 0;
subflow_req->msk = NULL;
mptcp_token_init_request(req);
-
-#ifdef CONFIG_TCP_MD5SIG
- /* no MPTCP if MD5SIG is enabled on this socket or we may run out of
- * TCP option space.
- */
- if (rcu_access_pointer(tcp_sk(sk_listener)->md5sig_info))
- return -EINVAL;
-#endif
-
- return 0;
}
static bool subflow_use_different_sport(struct mptcp_sock *msk, const struct sock *sk)
@@ -130,9 +120,9 @@ static bool subflow_use_different_sport(struct mptcp_sock *msk, const struct soc
* Returns an error code if a JOIN has failed and a TCP reset
* should be sent.
*/
-static int subflow_init_req(struct request_sock *req,
- const struct sock *sk_listener,
- struct sk_buff *skb)
+static int subflow_check_req(struct request_sock *req,
+ const struct sock *sk_listener,
+ struct sk_buff *skb)
{
struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener);
struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
@@ -141,9 +131,13 @@ static int subflow_init_req(struct request_sock *req,
pr_debug("subflow_req=%p, listener=%p", subflow_req, listener);
- ret = __subflow_init_req(req, sk_listener);
- if (ret)
- return 0;
+#ifdef CONFIG_TCP_MD5SIG
+ /* no MPTCP if MD5SIG is enabled on this socket or we may run out of
+ * TCP option space.
+ */
+ if (rcu_access_pointer(tcp_sk(sk_listener)->md5sig_info))
+ return -EINVAL;
+#endif
mptcp_get_options(skb, &mp_opt);
@@ -236,10 +230,7 @@ int mptcp_subflow_init_cookie_req(struct request_sock *req,
struct mptcp_options_received mp_opt;
int err;
- err = __subflow_init_req(req, sk_listener);
- if (err)
- return err;
-
+ subflow_init_req(req, sk_listener);
mptcp_get_options(skb, &mp_opt);
if (mp_opt.mp_capable && mp_opt.mp_join)
@@ -279,12 +270,13 @@ static struct dst_entry *subflow_v4_route_req(const struct sock *sk,
int err;
tcp_rsk(req)->is_mptcp = 1;
+ subflow_init_req(req, sk);
dst = tcp_request_sock_ipv4_ops.route_req(sk, skb, fl, req);
if (!dst)
return NULL;
- err = subflow_init_req(req, sk, skb);
+ err = subflow_check_req(req, sk, skb);
if (err == 0)
return dst;
@@ -304,12 +296,13 @@ static struct dst_entry *subflow_v6_route_req(const struct sock *sk,
int err;
tcp_rsk(req)->is_mptcp = 1;
+ subflow_init_req(req, sk);
dst = tcp_request_sock_ipv6_ops.route_req(sk, skb, fl, req);
if (!dst)
return NULL;
- err = subflow_init_req(req, sk, skb);
+ err = subflow_check_req(req, sk, skb);
if (err == 0)
return dst;
--
2.26.2
1 year, 3 months
[PATCH mptcp-net v2] mptcp: fix spurious retransmissions
by Paolo Abeni
Syzkaller was able to trigger again the following splat:
WARNING: CPU: 1 PID: 12512 at net/mptcp/protocol.c:761 mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:761
Modules linked in:
CPU: 1 PID: 12512 Comm: kworker/1:6 Not tainted 5.10.0-rc6 #52
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Workqueue: events mptcp_worker
RIP: 0010:mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:761
Code: e8 4b 0c ad ff e8 56 21 88 fe 48 b8 00 00 00 00 00 fc ff df 48 c7 04 03 00 00 00 00 48 83 c4 40 5b 5d 41 5c c3 e8 36 21 88 fe <0f> 0b 41 bc c8 00 00 00 eb 98 e8 e7 b1 af fe e9 30 ff ff ff 48 c7
RSP: 0018:ffffc900018c7c68 EFLAGS: 00010293
RAX: ffff888108cb1c80 RBX: 1ffff92000318f8d RCX: ffffffff82ad0307
RDX: 0000000000000000 RSI: ffffffff82ad036a RDI: 0000000000000007
RBP: ffff888113e2d000 R08: ffff888108cb1c80 R09: ffffed10227c5ab7
R10: ffff888113e2d5b7 R11: ffffed10227c5ab6 R12: 0000000000000000
R13: ffff88801f100000 R14: ffff888113e2d5b0 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff88811b500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd76a874ef8 CR3: 000000001689c005 CR4: 0000000000170ee0
Call Trace:
mptcp_worker+0xaa4/0x1560 net/mptcp/protocol.c:2334
process_one_work+0x8d3/0x1200 kernel/workqueue.c:2272
worker_thread+0x9c/0x1090 kernel/workqueue.c:2418
kthread+0x303/0x410 kernel/kthread.c:292
ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:296
The mptcp_worker tries to update the MPTCP retransmission timer
even if such timer is not currently scheduled.
The mptcp_rtx_head() return value is bogus: we can have enqueued
data not yet transmitted. The above may additionally cause spurious,
unneeded MPTCP-level retransmissions.
Fix the issue adding an explicit clearing the rtx queue before
trying to retransmit and checking for unacked data
Additionally drop an unneeded timer stop call and the unused
mptcp_rtx_tail() helper.
Reported-by: Christoph Paasch <cpaasch(a)apple.com>
Fixes: 6e628cd3a8f7 ("mptcp: use mptcp release_cb for delayed tasks")
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
v1 -> v2:
add sanity check in mptcp_rtx_head() - I missed the fact that
msk->rtx_queue can still be not empty even with all outstanding
data acked.
@Christoph, I'm sorry to bug you again, could you please give this
2nd variant another try?
---
net/mptcp/protocol.c | 3 +--
net/mptcp/protocol.h | 9 +--------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 305d25cbc216a..88a6fb6f7ecc8 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -363,8 +363,6 @@ static void mptcp_check_data_fin_ack(struct sock *sk)
/* Look for an acknowledged DATA_FIN */
if (mptcp_pending_data_fin_ack(sk)) {
- mptcp_stop_timer(sk);
-
WRITE_ONCE(msk->snd_data_fin_enable, 0);
switch (sk->sk_state) {
@@ -2270,6 +2268,7 @@ static void mptcp_worker(struct work_struct *work)
if (!test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags))
goto unlock;
+ __mptcp_clean_una(sk);
dfrag = mptcp_rtx_head(sk);
if (!dfrag)
goto unlock;
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 1024ea1512d2b..71ca3f039112c 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -335,20 +335,13 @@ static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk)
return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
}
-static inline struct mptcp_data_frag *mptcp_rtx_tail(const struct sock *sk)
+static inline struct mptcp_data_frag *mptcp_rtx_head(const struct sock *sk)
{
struct mptcp_sock *msk = mptcp_sk(sk);
if (!before64(msk->snd_nxt, READ_ONCE(msk->snd_una)))
return NULL;
- return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
-}
-
-static inline struct mptcp_data_frag *mptcp_rtx_head(const struct sock *sk)
-{
- struct mptcp_sock *msk = mptcp_sk(sk);
-
return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list);
}
--
2.26.2
1 year, 3 months
[PATCH mptcp-next 0/2] mptcp: handle socket errors
by Paolo Abeni
This introduces the initial support for msk-level socket error
handling.
Currently subflow socket errors are always ignored. That is almost
correct - I think - because the single subflow status does not
affect the msk-level connection.
There a couple of notable exceptions:
- fallen-back msk
- error at connect time on the MPC subflow
both should be propagated at msk level.
patch 1 implement the relevant infra
patch 2 is actuall a bug fix, for some edge cases that become
apparent testing the above.
I'll push a bunch of pktdrill test case which will cover the above.
Paolo Abeni (2):
mptcp: deliver ssk errors to msk
mptcp: fix poll after shutdown
net/mptcp/protocol.c | 11 ++++++++++-
net/mptcp/protocol.h | 4 ++++
net/mptcp/subflow.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 1 deletion(-)
--
2.26.2
1 year, 3 months
[PATCH net-next v2 00/15] mptcp: ADD_ADDR enhancements
by Mat Martineau
This patch series from the MPTCP tree contains enhancements and
associated tests for the ADD_ADDR ("add address") MPTCP option. This
option allows already-connected MPTCP peers to share additional IP
addresses with each other, which can then be used to create additional
subflows within those MPTCP connections.
Patches 1 & 2 remove duplicated data in the per-connection path manager
structure.
Patches 3-6 initiate additional subflows when an address is added using
the netlink path manager interface and improve ADD_ADDR signaling
reliability, subject to configured limits. Self tests are also updated.
Patches 7-15 add new support for optional port numbers in ADD_ADDR. This
includes creating an additional in-kernel TCP listening socket for the
requested port number, validating the port number when processing
incoming subflow connections, including the port number in netlink
interfaces, and adding some new MIBs. New self test cases are added for
subflows connecting with alternate port numbers.
v2: Address review comments for patch 1 (drop unnecessary READ_ONCE()
under lock). Drop patch 16, which will be submitted later.
Geliang Tang (15):
mptcp: use WRITE_ONCE for the pernet *_max
mptcp: drop *_max fields in mptcp_pm_data
mptcp: create subflow or signal addr for newly added address
mptcp: send ack for every add_addr
selftests: mptcp: use minus values for removing address numbers
selftests: mptcp: add testcases for newly added addresses
mptcp: create the listening socket for new port
mptcp: drop unused skb in subflow_token_join_request
mptcp: add a new helper subflow_req_create_thmac
mptcp: add port number check for MP_JOIN
mptcp: enable use_port when invoke addresses_equal
mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink
selftests: mptcp: add port argument for pm_nl_ctl
mptcp: add the mibs for ADD_ADDR with port
selftests: mptcp: add testcases for ADD_ADDR with port
net/mptcp/mib.c | 6 +
net/mptcp/mib.h | 6 +
net/mptcp/mptcp_diag.c | 6 +-
net/mptcp/options.c | 4 +
net/mptcp/pm.c | 12 +-
net/mptcp/pm_netlink.c | 291 +++++++++++++++---
net/mptcp/protocol.c | 2 +-
net/mptcp/protocol.h | 12 +-
net/mptcp/subflow.c | 79 ++++-
.../testing/selftests/net/mptcp/mptcp_join.sh | 261 +++++++++++++++-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 24 +-
11 files changed, 609 insertions(+), 94 deletions(-)
base-commit: 14e8e0f6008865d823a8184a276702a6c3cbef3d
--
2.30.0
1 year, 3 months
[MPTCP][PATCH v2 mptcp-next] mptcp: add local addr info in mptcp_info
by Geliang Tang
Add mptcpi_local_addr_used and mptcpi_local_addr_max in struct mptcp_info,
and rename mptcpi_add_addr_signal to mptcpi_add_addr_signaled.
Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
---
v2:
- append new fields in the end of struct mptcp_info.
- This patch is split from "add trace events" patch set as a single one
as Paolo suggested.
- tag: export/20210131T062218
---
include/uapi/linux/mptcp.h | 4 +++-
net/mptcp/mptcp_diag.c | 4 +++-
net/mptcp/pm_netlink.c | 3 ++-
net/mptcp/protocol.h | 1 +
4 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h
index c91578aaab32..bb6266715ec4 100644
--- a/include/uapi/linux/mptcp.h
+++ b/include/uapi/linux/mptcp.h
@@ -93,7 +93,7 @@ enum {
struct mptcp_info {
__u8 mptcpi_subflows;
- __u8 mptcpi_add_addr_signal;
+ __u8 mptcpi_add_addr_signaled;
__u8 mptcpi_add_addr_accepted;
__u8 mptcpi_subflows_max;
__u8 mptcpi_add_addr_signal_max;
@@ -103,6 +103,8 @@ struct mptcp_info {
__u64 mptcpi_write_seq;
__u64 mptcpi_snd_una;
__u64 mptcpi_rcv_nxt;
+ __u8 mptcpi_local_addr_used;
+ __u8 mptcpi_local_addr_max;
};
/*
diff --git a/net/mptcp/mptcp_diag.c b/net/mptcp/mptcp_diag.c
index 00ed742f48a4..195113e51c31 100644
--- a/net/mptcp/mptcp_diag.c
+++ b/net/mptcp/mptcp_diag.c
@@ -126,13 +126,15 @@ static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
slow = lock_sock_fast(sk);
info->mptcpi_subflows = READ_ONCE(msk->pm.subflows);
- info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled);
+ info->mptcpi_add_addr_signaled = READ_ONCE(msk->pm.add_addr_signaled);
info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm.add_addr_accepted);
+ info->mptcpi_local_addr_used = READ_ONCE(msk->pm.local_addr_used);
info->mptcpi_subflows_max = mptcp_pm_get_subflows_max(msk);
val = mptcp_pm_get_add_addr_signal_max(msk);
info->mptcpi_add_addr_signal_max = val;
val = mptcp_pm_get_add_addr_accept_max(msk);
info->mptcpi_add_addr_accepted_max = val;
+ info->mptcpi_local_addr_max = mptcp_pm_get_local_addr_max(msk);
if (test_bit(MPTCP_FALLBACK_DONE, &msk->flags))
flags |= MPTCP_INFO_FLAG_FALLBACK;
if (READ_ONCE(msk->can_ack))
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index da03f727d99e..ba8f6f257b08 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -228,13 +228,14 @@ unsigned int mptcp_pm_get_subflows_max(struct mptcp_sock *msk)
}
EXPORT_SYMBOL_GPL(mptcp_pm_get_subflows_max);
-static unsigned int mptcp_pm_get_local_addr_max(struct mptcp_sock *msk)
+unsigned int mptcp_pm_get_local_addr_max(struct mptcp_sock *msk)
{
struct pm_nl_pernet *pernet;
pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
return READ_ONCE(pernet->local_addr_max);
}
+EXPORT_SYMBOL_GPL(mptcp_pm_get_local_addr_max);
static void check_work_pending(struct mptcp_sock *msk)
{
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 3a043eadd3f2..faba7570f3bf 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -735,6 +735,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
unsigned int mptcp_pm_get_add_addr_signal_max(struct mptcp_sock *msk);
unsigned int mptcp_pm_get_add_addr_accept_max(struct mptcp_sock *msk);
unsigned int mptcp_pm_get_subflows_max(struct mptcp_sock *msk);
+unsigned int mptcp_pm_get_local_addr_max(struct mptcp_sock *msk);
static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb)
{
--
2.29.2
1 year, 3 months
[PATCH mptcp-net] mptcp: fix spurious retransmissions
by Paolo Abeni
Syzkaller was able to trigger again the following splat:
WARNING: CPU: 1 PID: 12512 at net/mptcp/protocol.c:761 mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:761
Modules linked in:
CPU: 1 PID: 12512 Comm: kworker/1:6 Not tainted 5.10.0-rc6 #52
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Workqueue: events mptcp_worker
RIP: 0010:mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:761
Code: e8 4b 0c ad ff e8 56 21 88 fe 48 b8 00 00 00 00 00 fc ff df 48 c7 04 03 00 00 00 00 48 83 c4 40 5b 5d 41 5c c3 e8 36 21 88 fe <0f> 0b 41 bc c8 00 00 00 eb 98 e8 e7 b1 af fe e9 30 ff ff ff 48 c7
RSP: 0018:ffffc900018c7c68 EFLAGS: 00010293
RAX: ffff888108cb1c80 RBX: 1ffff92000318f8d RCX: ffffffff82ad0307
RDX: 0000000000000000 RSI: ffffffff82ad036a RDI: 0000000000000007
RBP: ffff888113e2d000 R08: ffff888108cb1c80 R09: ffffed10227c5ab7
R10: ffff888113e2d5b7 R11: ffffed10227c5ab6 R12: 0000000000000000
R13: ffff88801f100000 R14: ffff888113e2d5b0 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff88811b500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd76a874ef8 CR3: 000000001689c005 CR4: 0000000000170ee0
Call Trace:
mptcp_worker+0xaa4/0x1560 net/mptcp/protocol.c:2334
process_one_work+0x8d3/0x1200 kernel/workqueue.c:2272
worker_thread+0x9c/0x1090 kernel/workqueue.c:2418
kthread+0x303/0x410 kernel/kthread.c:292
ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:296
The mptcp_worker tries to update the MPTCP retransmission timer
even if such timer is not currently scheduled.
mptcp_check_data_fin_ack() can clear the rtx timer just before
mptcp_rtx_head(), but leaving data in the rtx queue - that will
be cleared at msk sock release_cb time.
The above may additionally cause spurious, unneeded MPTCP-level
retransissions.
Fix the issue adding explicit clearing the rtx queue before
trying to retransmit and dropping the unneeded timer stop.
Additionally drop the unused mptcp_rtx_head() helper.
Reported-by: Christoph Paasch <cpaasch(a)apple.com>
Fixes: 6e628cd3a8f7 ("mptcp: use mptcp release_cb for delayed tasks")
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
Note: I hope this should fix https://github.com/multipath-tcp/mptcp_net-next/issues/126
@Christoph could you please give this one a spin?
---
net/mptcp/protocol.c | 3 +--
net/mptcp/protocol.h | 10 ----------
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 305d25cbc216a..88a6fb6f7ecc8 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -363,8 +363,6 @@ static void mptcp_check_data_fin_ack(struct sock *sk)
/* Look for an acknowledged DATA_FIN */
if (mptcp_pending_data_fin_ack(sk)) {
- mptcp_stop_timer(sk);
-
WRITE_ONCE(msk->snd_data_fin_enable, 0);
switch (sk->sk_state) {
@@ -2270,6 +2268,7 @@ static void mptcp_worker(struct work_struct *work)
if (!test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags))
goto unlock;
+ __mptcp_clean_una(sk);
dfrag = mptcp_rtx_head(sk);
if (!dfrag)
goto unlock;
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 1024ea1512d2b..1bb44a4baf4a5 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -335,16 +335,6 @@ static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk)
return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
}
-static inline struct mptcp_data_frag *mptcp_rtx_tail(const struct sock *sk)
-{
- struct mptcp_sock *msk = mptcp_sk(sk);
-
- if (!before64(msk->snd_nxt, READ_ONCE(msk->snd_una)))
- return NULL;
-
- return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
-}
-
static inline struct mptcp_data_frag *mptcp_rtx_head(const struct sock *sk)
{
struct mptcp_sock *msk = mptcp_sk(sk);
--
2.26.2
1 year, 3 months