Commit 12a18341 authored by Yonglong Li's avatar Yonglong Li Committed by Jakub Kicinski

mptcp: send ADD_ADDR echo before create subflows

In some corner cases, the peer handing an incoming ADD_ADDR option, can
receive a retransmitted ADD_ADDR for the same address before the subflow
creation completes.

We can avoid the above issue by generating and sending the ADD_ADDR echo
before starting the MPJ subflow connection.

This slightly changes the behaviour of the packetdrill tests as the
ADD_ADDR echo packet is sent earlier.
Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarYonglong Li <liyonglong@chinatelecom.cn>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Link: https://lore.kernel.org/r/20220317221444.426335-1-mathew.j.martineau@linux.intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 4edf21aa
...@@ -650,7 +650,6 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) ...@@ -650,7 +650,6 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
unsigned int add_addr_accept_max; unsigned int add_addr_accept_max;
struct mptcp_addr_info remote; struct mptcp_addr_info remote;
unsigned int subflows_max; unsigned int subflows_max;
bool reset_port = false;
int i, nr; int i, nr;
add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk);
...@@ -661,14 +660,15 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) ...@@ -661,14 +660,15 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
msk->pm.remote.family); msk->pm.remote.family);
remote = msk->pm.remote; remote = msk->pm.remote;
mptcp_pm_announce_addr(msk, &remote, true);
mptcp_pm_nl_addr_send_ack(msk);
if (lookup_subflow_by_daddr(&msk->conn_list, &remote)) if (lookup_subflow_by_daddr(&msk->conn_list, &remote))
goto add_addr_echo; return;
/* pick id 0 port, if none is provided the remote address */ /* pick id 0 port, if none is provided the remote address */
if (!remote.port) { if (!remote.port)
reset_port = true;
remote.port = sk->sk_dport; remote.port = sk->sk_dport;
}
/* connect to the specified remote address, using whatever /* connect to the specified remote address, using whatever
* local address the routing configuration will pick. * local address the routing configuration will pick.
...@@ -684,14 +684,6 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) ...@@ -684,14 +684,6 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
for (i = 0; i < nr; i++) for (i = 0; i < nr; i++)
__mptcp_subflow_connect(sk, &addrs[i], &remote); __mptcp_subflow_connect(sk, &addrs[i], &remote);
spin_lock_bh(&msk->pm.lock); spin_lock_bh(&msk->pm.lock);
/* be sure to echo exactly the received address */
if (reset_port)
remote.port = 0;
add_addr_echo:
mptcp_pm_announce_addr(msk, &remote, true);
mptcp_pm_nl_addr_send_ack(msk);
} }
void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk)
......
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