Interim Path Manager
Subsystems (2)
Peter Krystad
cover Interim Path Manager
Patchset includes the interim path manager plus sysctl setting of the announce address and binding local address when creating subflows. I also split the path manager into a seperate file.
Peter Krystad (2):
mptcp: Minor changes to path manager interface
mptcp: Implement interim path manager
net/mptcp/Makefile | 2 +- net/mptcp/interim.c | 247 +++++++++++++++++++++++++++++++++++++++++++ net/mptcp/pm.c | 38 +++++-- net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 14 ++- 5 files changed, 290 insertions(+), 13 deletions(-) create mode 100644 net/mptcp/interim.c
Signature · 1 line
2.17.2
Peter Krystad
PATCH 1/2 mptcp: Minor changes to path manager interface
Needed preparations so interim path manager can be in it's own file
squashto: Add path manager interface
--- net/mptcp/pm.c | 31 +++++++++++++++++++++---------- net/mptcp/protocol.c | 1 - net/mptcp/protocol.h | 9 ++++++++- 3 files changed, 29 insertions(+), 12 deletions(-)
net/mptcp/pm.c +21 -10
@@ -10,7 +10,7 @@/* path manager command handlers */ -int pm_announce_addr (u32 token,sa_family_t family,u8 local_id, +int pm_announce_addr (u32 token,u8 local_id,sa_family_t family,struct in_addr *addr) {struct mptcp_sock *msk =mptcp_sk (token_lookup_get (token));
@@ -50,7 +50,8 @@ int pm_remove_addr(u32 token, u8 local_id)return 0 ; } -int pm_create_subflow (u32 token,u8 remote_id) +int pm_create_subflow (u32 token,u8 remote_id,sa_family_t family, +struct in_addr *addr) {struct mptcp_sock *msk =mptcp_sk (token_lookup_get (token));struct sockaddr_in remote;
@@ -69,7 +70,10 @@ int pm_create_subflow(u32 token, u8 remote_id) local.sin_family =AF_INET ; local.sin_port =0 ; - local.sin_addr.s_addr =INADDR_ANY ; +if (family ==AF_INET ) + local.sin_addr.s_addr = addr->s_addr; +else + local.sin_addr.s_addr =INADDR_ANY ; remote.sin_family = msk->pm.remote_family; remote.sin_port =htons (msk->dport);
@@ -91,16 +95,21 @@ int pm_remove_subflow(u32 token, u8 remote_id)void pm_new_connection (struct mptcp_sock *msk,int server_side) { -pr_debug ("msk=%p" , msk); +struct mptcp_pm_data *pm = &msk->pm; + +pr_debug ("msk=%p, token=%u" , msk, msk->token); - msk->pm.server_side = server_side; + pm->server_side = server_side; + pm->token = msk->token; }void pm_fully_established (struct mptcp_sock *msk) { +struct mptcp_pm_data *pm = &msk->pm; +pr_debug ("msk=%p" , msk); - msk->pm.fully_established =1 ; + pm->fully_established =1 ; }void pm_connection_closed (struct mptcp_sock *msk)
@@ -120,12 +129,14 @@ void pm_subflow_closed(struct mptcp_sock *msk, u8 id)void pm_add_addr (struct mptcp_sock *msk,const struct in_addr *addr,u8 id) { +struct mptcp_pm_data *pm = &msk->pm; +pr_debug ("msk=%p, addr=%x, remote_id=%d" , msk, addr->s_addr, id); - msk->pm.remote_addr.s_addr = addr->s_addr; - msk->pm.remote_id = id; - msk->pm.remote_family =AF_INET ; - msk->pm.remote_valid =1 ; + pm->remote_addr.s_addr = addr->s_addr; + pm->remote_id = id; + pm->remote_family =AF_INET ; + pm->remote_valid =1 ; }void pm_add_addr6 (struct mptcp_sock *msk,const struct in6_addr *addr,u8 id)
net/mptcp/protocol.c +0 -1
@@ -1135,7 +1135,6 @@ void mptcp_proto_init(void)token_init ();subflow_init (); -pm_init ();if (proto_register (&mptcp_prot,1 ) !=0 )panic ("Failed to register MPTCP proto.\n" );
net/mptcp/protocol.h +8 -1
@@ -260,7 +260,6 @@ static inline void crypto_key_gen_sha1(u64 *key, u32 *token, u64 *idsn)void crypto_hmac_sha1 (u64 key1,u64 key2,u32 nonce1,u32 nonce2,u32 *hash_out); -void pm_init (void );void pm_new_connection (struct mptcp_sock *msk,int server_side);void pm_fully_established (struct mptcp_sock *msk);void pm_connection_closed (struct mptcp_sock *msk);
@@ -269,6 +268,14 @@ void pm_subflow_closed(struct mptcp_sock *msk, u8 id);void pm_add_addr (struct mptcp_sock *msk,const struct in_addr *addr,u8 id);void pm_add_addr6 (struct mptcp_sock *msk,const struct in6_addr *addr,u8 id);void pm_rm_addr (struct mptcp_sock *msk,u8 id); + +int pm_announce_addr (u32 token,u8 local_id,sa_family_t family, +struct in_addr *addr); +int pm_create_subflow (u32 token,u8 remote_id,sa_family_t family, +struct in_addr *addr); +int pm_remove_addr (u32 token,u8 local_id); +int pm_remove_subflow (u32 token,u8 remote_id); +int pm_addr_signal (struct mptcp_sock *msk,u8 *id,struct sockaddr_storage *saddr); int pm_get_local_id(struct request_sock *req, struct sock *sk,
Signature · 1 line
2.17.2
Paolo Abeni
Re: [MPTCP] [PATCH 1/2] mptcp: Minor changes to path manager interface
net/mptcp/protocol.c void mptcp_proto_init(void) · line 1138
Quoted 9 lines · Peter Krystad
net/mptcp/protocol.c +0
-1@@ -1135,7 +1135,6 @@ void mptcp_proto_init(void)token_init ();subflow_init (); -pm_init ();
I guess we should also remove pm_init() definition, but that can go with a later clean-up patch. I think this patch can be merged as-is.
Paolo
Peter Krystad
PATCH 2/2 mptcp: Implement interim path manager
In reply to Peter KrystadTwo features: 1) After an incoming connection is fully established announce a second local address and 2) When an outgoing connection is fully established, and an ADD_ADDR option has been received, initiate a secondary subflow to that address.
The second local address may be configured through the net.mptcp.pm.announce_addr sysctl variable. If configured then for listeners this address will be announced with the ADD_ADDR option, and for clients the local socket will be bound to this address (or INADDR_ANY if not specified).
--- net/mptcp/Makefile | 2 +- net/mptcp/interim.c | 247 +++++++++++++++++++++++++++++++++++++++++++ net/mptcp/pm.c | 7 ++ net/mptcp/protocol.c | 1 + net/mptcp/protocol.h | 5 + 5 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 net/mptcp/interim.c
net/mptcp/Makefile +1 -1
@@ -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 pm.o ctrl.o +mptcp-y := protocol.o subflow.o options.o token.o crypto.o pm.o ctrl.o interim.o
net/mptcp/interim.c new file +247 -0
247 lines not on this page · raw message
net/mptcp/pm.c +7 -0
@@ -101,6 +101,8 @@ void pm_new_connection(struct mptcp_sock *msk, int server_side) pm->server_side = server_side; pm->token = msk->token; + +mptcp_interim_new_connection (pm); }void pm_fully_established (struct mptcp_sock *msk)
@@ -109,6 +111,8 @@ void pm_fully_established(struct mptcp_sock *msk)pr_debug ("msk=%p" , msk); +mptcp_interim_fully_established (pm); + pm->fully_established =1 ; }
@@ -136,6 +140,9 @@ void pm_add_addr(struct mptcp_sock *msk, const struct in_addr *addr, u8 id) pm->remote_addr.s_addr = addr->s_addr; pm->remote_id = id; pm->remote_family =AF_INET ; + +mptcp_interim_add_addr (pm); + pm->remote_valid =1 ; }
net/mptcp/protocol.c +1 -0
@@ -1135,6 +1135,7 @@ void mptcp_proto_init(void)token_init ();subflow_init (); +mptcp_interim_init ();if (proto_register (&mptcp_prot,1 ) !=0 )panic ("Failed to register MPTCP proto.\n" );
net/mptcp/protocol.h +5 -0
@@ -281,6 +281,11 @@ int pm_addr_signal(struct mptcp_sock *msk, u8 *id,int pm_get_local_id (struct request_sock *req,struct sock *sk,const struct sk_buff *skb); +void mptcp_interim_init (void ); +void mptcp_interim_new_connection (struct mptcp_pm_data *pm); +void mptcp_interim_fully_established (struct mptcp_pm_data *pm); +void mptcp_interim_add_addr (struct mptcp_pm_data *pm); +static inline struct mptcp_ext *mptcp_get_ext (struct sk_buff *skb) {return (struct mptcp_ext *)skb_ext_find (skb,SKB_EXT_MPTCP );
Signature · 1 line
2.17.2
Paolo Abeni
Re: [MPTCP] [PATCH 2/2] mptcp: Implement interim path manager
Hi,
Quoted 5 lines · Peter Krystad
Two features: 1) After an incoming connection is fully established announce a second local address and 2) When an outgoing connection is fully established, and an
ADD_ADDRoption has been received, initiate a secondary subflow to that address.
Quoted 7 lines
The second local address may be configured through the net.mptcp.pm.announce_addr sysctl variable. If configured then for listeners this address will be announced with the
ADD_ADDRoption, and for clients the local socket will be bound to this address (orINADDR_ANYif not specified).Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
Thanks for completing this!
I fear there are possibly some other races pending there - if I read the code correctly, the pm data structures are protected by the ssk socket lock but have per msk scope.
As a very minor thing, I personally would prefer more a name like 'small', 'simple' or 'basic' instead of 'interim'.
Anyhow I think this would work well to exercise the MP_JOIN code path and we can improve on top if needed.
So overall I'm ok with merging this as-is.
Cheers,
Paolo
Peter Krystad
Re: [MPTCP] [PATCH 2/2] mptcp: Implement interim path manager
Quoted 14 lines · Paolo Abeni
Hi,
Quoted 11 lines · Peter Krystad
Two features: 1) After an incoming connection is fully established announce a second local address and 2) When an outgoing connection is fully established, and an
ADD_ADDRoption has been received, initiate a secondary subflow to that address.The second local address may be configured through the net.mptcp.pm.announce_addr sysctl variable. If configured then for listeners this address will be announced with the
ADD_ADDRoption, and for clients the local socket will be bound to this address (orINADDR_ANYif not specified).
Quoted 8 lines
Quoted 1 line
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>Thanks for completing this!
I fear there are possibly some other races pending there - if I read the code correctly, the pm data structures are protected by the ssk socket lock but have per msk scope.
Yes, I think you're right, but the purpose here is to just get something we can test multiple subflows with, thus the name 'interim'.
Quoted 2 lines
As a very minor thing, I personally would prefer more a name like 'small', 'simple' or 'basic' instead of 'interim'.
Well, now is the time to change it so I will re-submit with new name and address your comment on patch 1.
Peter.
Quoted 10 lines
Anyhow I think this would work well to exercise the
MP_JOINcode path and we can improve on top if needed.So overall I'm ok with merging this as-is.
Cheers,
Paolo