diff options
author | Geliang Tang <geliangtang@gmail.com> | 2020-09-24 08:29:54 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-24 19:58:33 -0700 |
commit | b6c08380860b926752d57c8fa9911fa388c4b876 (patch) | |
tree | 084ec15379edba9bbf21515863f3bf2faeef84f1 /net/mptcp/pm.c | |
parent | f58f065aa10683a4e2d975c71e0238cfe2c41024 (diff) | |
download | linux-b6c08380860b926752d57c8fa9911fa388c4b876.tar.gz linux-b6c08380860b926752d57c8fa9911fa388c4b876.tar.bz2 linux-b6c08380860b926752d57c8fa9911fa388c4b876.zip |
mptcp: remove addr and subflow in PM netlink
This patch implements the remove announced addr and subflow logic in PM
netlink.
When the PM netlink removes an address, we traverse all the existing msk
sockets to find the relevant sockets.
We add a new list named anno_list in mptcp_pm_data, to record all the
announced addrs. In the traversing, we check if it has been recorded.
If it has been, we trigger the RM_ADDR signal.
We also check if this address is in conn_list. If it is, we remove the
subflow which using this local address.
Since we call mptcp_pm_free_anno_list in mptcp_destroy, we need to move
__mptcp_init_sock before the mptcp_is_enabled check in mptcp_init_sock.
Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp/pm.c')
-rw-r--r-- | net/mptcp/pm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index be4157279e15..f450bf0d49aa 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -26,7 +26,11 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, int mptcp_pm_remove_addr(struct mptcp_sock *msk, u8 local_id) { - return -ENOTSUPP; + pr_debug("msk=%p, local_id=%d", msk, local_id); + + msk->pm.rm_id = local_id; + WRITE_ONCE(msk->pm.rm_addr_signal, true); + return 0; } int mptcp_pm_remove_subflow(struct mptcp_sock *msk, u8 remote_id) @@ -231,6 +235,7 @@ void mptcp_pm_data_init(struct mptcp_sock *msk) msk->pm.status = 0; spin_lock_init(&msk->pm.lock); + INIT_LIST_HEAD(&msk->pm.anno_list); mptcp_pm_nl_data_init(msk); } |