Commit 6961326e authored by Mat Martineau's avatar Mat Martineau Committed by Jakub Kicinski

mptcp: Make kernel path manager check for userspace-managed sockets

Userspace-managed sockets should not have their subflows or
advertisements changed by the kernel path manager.

v3: Use helper function for PM mode (Paolo Abeni)
Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 14b06811
...@@ -1220,7 +1220,8 @@ static int mptcp_nl_add_subflow_or_signal_addr(struct net *net) ...@@ -1220,7 +1220,8 @@ static int mptcp_nl_add_subflow_or_signal_addr(struct net *net)
while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) { while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) {
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
if (!READ_ONCE(msk->fully_established)) if (!READ_ONCE(msk->fully_established) ||
mptcp_pm_is_userspace(msk))
goto next; goto next;
lock_sock(sk); lock_sock(sk);
...@@ -1363,6 +1364,9 @@ static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net, ...@@ -1363,6 +1364,9 @@ static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net,
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
bool remove_subflow; bool remove_subflow;
if (mptcp_pm_is_userspace(msk))
goto next;
if (list_empty(&msk->conn_list)) { if (list_empty(&msk->conn_list)) {
mptcp_pm_remove_anno_addr(msk, addr, false); mptcp_pm_remove_anno_addr(msk, addr, false);
goto next; goto next;
...@@ -1397,7 +1401,7 @@ static int mptcp_nl_remove_id_zero_address(struct net *net, ...@@ -1397,7 +1401,7 @@ static int mptcp_nl_remove_id_zero_address(struct net *net,
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
struct mptcp_addr_info msk_local; struct mptcp_addr_info msk_local;
if (list_empty(&msk->conn_list)) if (list_empty(&msk->conn_list) || mptcp_pm_is_userspace(msk))
goto next; goto next;
local_address((struct sock_common *)msk, &msk_local); local_address((struct sock_common *)msk, &msk_local);
...@@ -1504,9 +1508,11 @@ static void mptcp_nl_remove_addrs_list(struct net *net, ...@@ -1504,9 +1508,11 @@ static void mptcp_nl_remove_addrs_list(struct net *net,
while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) { while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) {
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
if (!mptcp_pm_is_userspace(msk)) {
lock_sock(sk); lock_sock(sk);
mptcp_pm_remove_addrs_and_subflows(msk, rm_list); mptcp_pm_remove_addrs_and_subflows(msk, rm_list);
release_sock(sk); release_sock(sk);
}
sock_put(sk); sock_put(sk);
cond_resched(); cond_resched();
...@@ -1779,7 +1785,7 @@ static int mptcp_nl_set_flags(struct net *net, ...@@ -1779,7 +1785,7 @@ static int mptcp_nl_set_flags(struct net *net,
while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) { while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) {
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
if (list_empty(&msk->conn_list)) if (list_empty(&msk->conn_list) || mptcp_pm_is_userspace(msk))
goto next; goto next;
lock_sock(sk); lock_sock(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment