mptcp: send out dedicated packet for ADD_ADDR using port

The process is similar to that of the ADD_ADDR IPv6, this patch also sent
out a pure ack for the ADD_ADDR using port.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Geliang Tang 2020-12-09 15:51:23 -08:00 committed by David S. Miller
parent 4a2777a834
commit fbe0f87ac7
3 changed files with 15 additions and 5 deletions

View File

@ -590,7 +590,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
bool port;
int len;
if (mptcp_pm_should_add_signal_ipv6(msk) &&
if ((mptcp_pm_should_add_signal_ipv6(msk) ||
mptcp_pm_should_add_signal_port(msk)) &&
skb && skb_is_tcp_pure_ack(skb)) {
pr_debug("drop other suboptions");
opts->suboptions = 0;

View File

@ -167,7 +167,8 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk)
{
if (!mptcp_pm_should_add_signal_ipv6(msk))
if (!mptcp_pm_should_add_signal_ipv6(msk) &&
!mptcp_pm_should_add_signal_port(msk))
return;
mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_SEND_ACK);

View File

@ -407,7 +407,8 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
{
struct mptcp_subflow_context *subflow;
if (!mptcp_pm_should_add_signal_ipv6(msk))
if (!mptcp_pm_should_add_signal_ipv6(msk) &&
!mptcp_pm_should_add_signal_port(msk))
return;
__mptcp_flush_join_list(msk);
@ -417,14 +418,21 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
u8 add_addr;
spin_unlock_bh(&msk->pm.lock);
pr_debug("send ack for add_addr6");
if (mptcp_pm_should_add_signal_ipv6(msk))
pr_debug("send ack for add_addr6");
if (mptcp_pm_should_add_signal_port(msk))
pr_debug("send ack for add_addr_port");
lock_sock(ssk);
tcp_send_ack(ssk);
release_sock(ssk);
spin_lock_bh(&msk->pm.lock);
add_addr = READ_ONCE(msk->pm.add_addr_signal);
add_addr &= ~BIT(MPTCP_ADD_ADDR_IPV6);
if (mptcp_pm_should_add_signal_ipv6(msk))
add_addr &= ~BIT(MPTCP_ADD_ADDR_IPV6);
if (mptcp_pm_should_add_signal_port(msk))
add_addr &= ~BIT(MPTCP_ADD_ADDR_PORT);
WRITE_ONCE(msk->pm.add_addr_signal, add_addr);
}
}