Skip to content

Commit

Permalink
mptcp: update add_addr_accepted and accept_add after subflow added
Browse files Browse the repository at this point in the history
receive RM_ADDR will update pm.add_addr_accepted and pm.add_addr_accepted
only if remove id match remote id of subflow. so receive ADD_ADDR should
update pm.add_addr_accepted and pm.add_addr_accepted after subflow added
to conn_list.

Fixes: f7d6a23 ("mptcp: fix per socket endpoint accounting")

Signed-off-by: YonglongLi <[email protected]>
  • Loading branch information
YonglongLi authored and intel-lab-lkp committed May 24, 2024
1 parent cbb6761 commit 4e6834c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions net/mptcp/pm_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
struct sock *sk = (struct sock *)msk;
unsigned int add_addr_accept_max;
struct mptcp_addr_info remote;
bool subflow_added = false;
unsigned int subflows_max;
int i, nr;

Expand Down Expand Up @@ -704,15 +705,18 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
if (nr == 0)
return;

msk->pm.add_addr_accepted++;
if (msk->pm.add_addr_accepted >= add_addr_accept_max ||
msk->pm.subflows >= subflows_max)
WRITE_ONCE(msk->pm.accept_addr, false);

spin_unlock_bh(&msk->pm.lock);
for (i = 0; i < nr; i++)
__mptcp_subflow_connect(sk, &addrs[i], &remote);
if (!__mptcp_subflow_connect(sk, &addrs[i], &remote))
subflow_added = true;
spin_lock_bh(&msk->pm.lock);

if (subflow_added) {
msk->pm.add_addr_accepted++;
if (msk->pm.add_addr_accepted >= add_addr_accept_max ||
msk->pm.subflows >= subflows_max)
WRITE_ONCE(msk->pm.accept_addr, false);
}
}

void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk)
Expand Down

0 comments on commit 4e6834c

Please sign in to comment.