Skip to content

Commit 4b317e0

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: fix NL PM announced address accounting
Currently the per connection announced address counter is never decreased. As a consequence, after connection establishment, if the NL PM deletes an endpoint and adds a new/different one, no additional subflow is created for the new endpoint even if the current limits allow that. Address the issue properly updating the signaled address counter every time the NL PM removes such addresses. Fixes: 01cacb0 ("mptcp: add netlink-based PM") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 167b932 commit 4b317e0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

net/mptcp/pm_netlink.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk,
14011401
ret = remove_anno_list_by_saddr(msk, addr);
14021402
if (ret || force) {
14031403
spin_lock_bh(&msk->pm.lock);
1404+
msk->pm.add_addr_signaled -= ret;
14041405
mptcp_pm_remove_addr(msk, &list);
14051406
spin_unlock_bh(&msk->pm.lock);
14061407
}
@@ -1565,17 +1566,18 @@ static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
15651566
struct mptcp_pm_addr_entry *entry;
15661567

15671568
list_for_each_entry(entry, rm_list, list) {
1568-
if (lookup_subflow_by_saddr(&msk->conn_list, &entry->addr) &&
1569-
slist.nr < MPTCP_RM_IDS_MAX)
1569+
if (slist.nr < MPTCP_RM_IDS_MAX &&
1570+
lookup_subflow_by_saddr(&msk->conn_list, &entry->addr))
15701571
slist.ids[slist.nr++] = entry->addr.id;
15711572

1572-
if (remove_anno_list_by_saddr(msk, &entry->addr) &&
1573-
alist.nr < MPTCP_RM_IDS_MAX)
1573+
if (alist.nr < MPTCP_RM_IDS_MAX &&
1574+
remove_anno_list_by_saddr(msk, &entry->addr))
15741575
alist.ids[alist.nr++] = entry->addr.id;
15751576
}
15761577

15771578
if (alist.nr) {
15781579
spin_lock_bh(&msk->pm.lock);
1580+
msk->pm.add_addr_signaled -= alist.nr;
15791581
mptcp_pm_remove_addr(msk, &alist);
15801582
spin_unlock_bh(&msk->pm.lock);
15811583
}

0 commit comments

Comments
 (0)