Message ID | tencent_0FE3ED0442E69C9D86C0AEEE338A49F90305@qq.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [mptcp-next] mptcp: fix invalid addr occupy 'add_addr_accepted' | expand |
Hi Gang Yan, Thank you for this patch! I have a few suggestions below. Do you mind sending the next version(s) to the MPTCP list only, no need to include the netdev ML and the net maintainers for the moment I think. On 11/12/2024 10:03, Gang Yan wrote: > From: Gang Yan <yangang@kylinos.cn> > > This patch fixes an issue where an invalid address is announce as a > signal, the 'add_addr_accepted' is incorrectly added several times > when 'retransmit ADD_ADDR'. So we need to update this variable > when the connection is removed from conn_list by mptcp_worker. So that > the available address can be added in time. > > In fact, the 'add_addr_accepted' is only declined when 'RM_ADDR' > by now, so when subflows are getting closed from the other peer, Does it mean that in this case, the counter will be decreased twice: when the RM_ADDR is received, and when the subflow is closed, no? I guess no because you hooked this in a different path, right? > the new signal is not accepted as well. > > We noticed there have exist some problems related to this.I think > this patch effectively resolves them. Please add new test cases for these problems in the MPTCP selftests: to better understand what is being fixed, and to avoid regressions later. > Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/498 > Signed-off-by: Gang Yan <yangang@kylinos.cn> > --- > net/mptcp/protocol.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c > index 21bc3586c33e..f99dddca859d 100644 > --- a/net/mptcp/protocol.c > +++ b/net/mptcp/protocol.c > @@ -2569,6 +2569,10 @@ static void __mptcp_close_subflow(struct sock *sk) > continue; > > mptcp_close_ssk(sk, ssk, subflow); > + > + if (READ_ONCE(subflow->remote_id) && > + --msk->pm.add_addr_accepted < mptcp_pm_get_add_addr_accept_max(msk)) > + WRITE_ONCE(msk->pm.accept_addr, true); Mmh, I don't think it can be that simple: potentially, an accepted ADD_ADDR can trigger multiple subflows (i.e. when the fullmesh flag is used). In this case, the counter has been incremented once, not once for each created subflow. So before decrementing the counter, it should then be needed to check if no other subflows connected to the same remote ID are still alive. I think it is better not to decrement this counter in "unusual situations" -- the situation before this patch -- than wrongly decrementing it, and ended up with an underflow. Another thing is that subflows might have not been created upon the reception of an ADD_ADDR: typically if you take the view of a server, the subflows have been initiated by the client, and not because the server got an ADD_ADDR. If I'm not mistaken, the counter would be decremented here as well. We could restrict this by checking "subflow->request_join" I suppose. Still, I'm wondering if that's covering all cases, and if we should not track ADD_ADDR that are received: https://github.com/multipath-tcp/mptcp_net-next/issues/496 (which is more complex) Also, because this counter is specific to the in-kernel PM, I think it would be cleaner f its manipulation is done in pm_netlink.c. pw-bot: cr Cheers, Matt
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 21bc3586c33e..f99dddca859d 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2569,6 +2569,10 @@ static void __mptcp_close_subflow(struct sock *sk) continue; mptcp_close_ssk(sk, ssk, subflow); + + if (READ_ONCE(subflow->remote_id) && + --msk->pm.add_addr_accepted < mptcp_pm_get_add_addr_accept_max(msk)) + WRITE_ONCE(msk->pm.accept_addr, true); } }