Skip to content

Commit

Permalink
mptcp: remove a list of addrs when flushing
Browse files Browse the repository at this point in the history
This patch invoked mptcp_nl_remove_addrs_list to remove a list of addresses
when the netlink flushes addresses, instead of using
mptcp_nl_remove_subflow_and_signal_addr to remove them one by one.

And dropped the unused parameter net in __flush_addrs too.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
  • Loading branch information
geliangtang authored and jenkins-tessares committed Feb 18, 2021
1 parent 84f5b28 commit 5fb7c01
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/mptcp/pm_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,14 +1247,13 @@ static void mptcp_nl_remove_addrs_list(struct net *net,
}
}

static void __flush_addrs(struct net *net, struct list_head *list)
static void __flush_addrs(struct list_head *list)
{
while (!list_empty(list)) {
struct mptcp_pm_addr_entry *cur;

cur = list_entry(list->next,
struct mptcp_pm_addr_entry, list);
mptcp_nl_remove_subflow_and_signal_addr(net, &cur->addr);
list_del_rcu(&cur->list);
mptcp_pm_free_addr_entry(cur);
}
Expand All @@ -1279,7 +1278,8 @@ static int mptcp_nl_cmd_flush_addrs(struct sk_buff *skb, struct genl_info *info)
pernet->next_id = 1;
bitmap_zero(pernet->id_bitmap, MAX_ADDR_ID + 1);
spin_unlock_bh(&pernet->lock);
__flush_addrs(sock_net(skb->sk), &free_list);
mptcp_nl_remove_addrs_list(sock_net(skb->sk), &free_list);
__flush_addrs(&free_list);
return 0;
}

Expand Down Expand Up @@ -1876,7 +1876,7 @@ static void __net_exit pm_nl_exit_net(struct list_head *net_list)
/* net is removed from namespace list, can't race with
* other modifiers
*/
__flush_addrs(net, &pernet->local_addr_list);
__flush_addrs(&pernet->local_addr_list);
}
}

Expand Down

0 comments on commit 5fb7c01

Please sign in to comment.