Skip to content

Commit 8b1c94d

Browse files
geliangtangdavem330
authored andcommitted
mptcp: only send RM_ADDR in nl_cmd_remove
The specifications from [1] about the "REMOVE" command say: Announce that an address has been lost to the peer It was then only supposed to send a RM_ADDR and not trying to delete associated subflows. A new helper mptcp_pm_remove_addrs() is then introduced to do just that, compared to mptcp_pm_remove_addrs_and_subflows() also removing subflows. To delete a subflow, the userspace daemon can use the "SUB_DESTROY" command, see mptcp_nl_cmd_sf_destroy(). Fixes: d9a4594 ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Link: https://github.com/multipath-tcp/mptcp/blob/mptcp_v0.96/include/uapi/linux/mptcp.h [1] Cc: [email protected] Reviewed-by: Matthieu Baerts <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9bc0097 commit 8b1c94d

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

net/mptcp/pm_netlink.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,24 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info)
15581558
return ret;
15591559
}
15601560

1561+
void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
1562+
{
1563+
struct mptcp_rm_list alist = { .nr = 0 };
1564+
struct mptcp_pm_addr_entry *entry;
1565+
1566+
list_for_each_entry(entry, rm_list, list) {
1567+
remove_anno_list_by_saddr(msk, &entry->addr);
1568+
if (alist.nr < MPTCP_RM_IDS_MAX)
1569+
alist.ids[alist.nr++] = entry->addr.id;
1570+
}
1571+
1572+
if (alist.nr) {
1573+
spin_lock_bh(&msk->pm.lock);
1574+
mptcp_pm_remove_addr(msk, &alist);
1575+
spin_unlock_bh(&msk->pm.lock);
1576+
}
1577+
}
1578+
15611579
void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
15621580
struct list_head *rm_list)
15631581
{

net/mptcp/pm_userspace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info)
232232

233233
list_move(&match->list, &free_list);
234234

235-
mptcp_pm_remove_addrs_and_subflows(msk, &free_list);
235+
mptcp_pm_remove_addrs(msk, &free_list);
236236

237237
release_sock((struct sock *)msk);
238238

net/mptcp/protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,
832832
bool echo);
833833
int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
834834
int mptcp_pm_remove_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
835+
void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list);
835836
void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
836837
struct list_head *rm_list);
837838

0 commit comments

Comments
 (0)