forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add enough of a path manager interface to allow sending of ADD_ADDR when an incoming MPTCP connection is created. Capable of sending only a single IPv4 ADD_ADDR option. The 'pm_data' element of the connection sock will need to be expanded to handle multiple interfaces and IPv6. Partial processing of the incoming ADD_ADDR is included so the path manager notification of that event happens at the proper time, which involves validating the incoming address information. This is a skeleton interface definition for events generated by MPTCP. Co-developed-by: Matthieu Baerts <[email protected]> Signed-off-by: Matthieu Baerts <[email protected]> Co-developed-by: Florian Westphal <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Co-developed-by: Paolo Abeni <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Co-developed-by: Mat Martineau <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: Peter Krystad <[email protected]> Signed-off-by: David S. Miller <[email protected]>
- Loading branch information
Showing
6 changed files
with
264 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
obj-$(CONFIG_MPTCP) += mptcp.o | ||
|
||
mptcp-y := protocol.o subflow.o options.o token.o crypto.o ctrl.o | ||
mptcp-y := protocol.o subflow.o options.o token.o crypto.o ctrl.o pm.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Multipath TCP | ||
* | ||
* Copyright (c) 2019, Intel Corporation. | ||
*/ | ||
#include <linux/kernel.h> | ||
#include <net/tcp.h> | ||
#include <net/mptcp.h> | ||
#include "protocol.h" | ||
|
||
static struct workqueue_struct *pm_wq; | ||
|
||
/* path manager command handlers */ | ||
|
||
int mptcp_pm_announce_addr(struct mptcp_sock *msk, | ||
const struct mptcp_addr_info *addr) | ||
{ | ||
return -ENOTSUPP; | ||
} | ||
|
||
int mptcp_pm_remove_addr(struct mptcp_sock *msk, u8 local_id) | ||
{ | ||
return -ENOTSUPP; | ||
} | ||
|
||
int mptcp_pm_remove_subflow(struct mptcp_sock *msk, u8 remote_id) | ||
{ | ||
return -ENOTSUPP; | ||
} | ||
|
||
/* path manager event handlers */ | ||
|
||
void mptcp_pm_new_connection(struct mptcp_sock *msk, int server_side) | ||
{ | ||
struct mptcp_pm_data *pm = &msk->pm; | ||
|
||
pr_debug("msk=%p, token=%u side=%d", msk, msk->token, server_side); | ||
|
||
WRITE_ONCE(pm->server_side, server_side); | ||
} | ||
|
||
bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) | ||
{ | ||
pr_debug("msk=%p", msk); | ||
return false; | ||
} | ||
|
||
void mptcp_pm_fully_established(struct mptcp_sock *msk) | ||
{ | ||
pr_debug("msk=%p", msk); | ||
} | ||
|
||
void mptcp_pm_connection_closed(struct mptcp_sock *msk) | ||
{ | ||
pr_debug("msk=%p", msk); | ||
} | ||
|
||
void mptcp_pm_subflow_established(struct mptcp_sock *msk, | ||
struct mptcp_subflow_context *subflow) | ||
{ | ||
pr_debug("msk=%p", msk); | ||
} | ||
|
||
void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id) | ||
{ | ||
pr_debug("msk=%p", msk); | ||
} | ||
|
||
void mptcp_pm_add_addr_received(struct mptcp_sock *msk, | ||
const struct mptcp_addr_info *addr) | ||
{ | ||
pr_debug("msk=%p, remote_id=%d", msk, addr->id); | ||
} | ||
|
||
/* path manager helpers */ | ||
|
||
bool mptcp_pm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, | ||
struct mptcp_addr_info *saddr) | ||
{ | ||
return false; | ||
} | ||
|
||
int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) | ||
{ | ||
return 0; | ||
} | ||
|
||
static void pm_worker(struct work_struct *work) | ||
{ | ||
} | ||
|
||
void mptcp_pm_data_init(struct mptcp_sock *msk) | ||
{ | ||
msk->pm.add_addr_signaled = 0; | ||
msk->pm.add_addr_accepted = 0; | ||
msk->pm.local_addr_used = 0; | ||
msk->pm.subflows = 0; | ||
WRITE_ONCE(msk->pm.work_pending, false); | ||
WRITE_ONCE(msk->pm.addr_signal, false); | ||
WRITE_ONCE(msk->pm.accept_addr, false); | ||
WRITE_ONCE(msk->pm.accept_subflow, false); | ||
msk->pm.status = 0; | ||
|
||
spin_lock_init(&msk->pm.lock); | ||
INIT_WORK(&msk->pm.work, pm_worker); | ||
} | ||
|
||
void mptcp_pm_init(void) | ||
{ | ||
pm_wq = alloc_workqueue("pm_wq", WQ_UNBOUND | WQ_MEM_RECLAIM, 8); | ||
if (!pm_wq) | ||
panic("Failed to allocate workqueue"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters