Skip to contentSkip to conversation

Interim Path Manager

PATCH In review Peter Krystad 3 participants 7 messages Sep 17, 2019 – Oct 15, 2019

Subsystems (2)
lore
Share & tools
lore

Peter Krystad

author
#0 lore raw

v2 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.

v2:
rename to 'basic' path manager
remove pm_init definition

Peter Krystad (2):
mptcp: Minor changes to path manager interface
mptcp: Implement basic path manager

 net/mptcp/Makefile   |   2 +-
 net/mptcp/basic.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/basic.c
Signature · 1 line
2.17.2
author
#1 lore raw

PATCH v2 1/2 mptcp: Minor changes to path manager interface

Needed preparations so basic path manager can be in it's own file

squashto: Add path manager interface

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 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
index 57e13837ee22..d0ce36cc912c 100644
@@ -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_token_get_sock(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_token_get_sock(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
index 9c019e696fc7..2fcdf11a653a 100644
@@ -1130,7 +1130,6 @@ void mptcp_proto_init(void)
 	mptcp_stream_ops.shutdown = mptcp_shutdown;
 
 	subflow_init();
-	pm_init();
 
 	if (proto_register(&mptcp_prot, 1) != 0)
 		panic("Failed to register MPTCP proto.\n");
net/mptcp/protocol.h +8 -1
index 40f0efaef55e..fcf78fc0df84 100644
@@ -252,7 +252,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);
@@ -261,6 +260,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
author
#2 lore raw

PATCH v2 2/2 mptcp: Implement basic path manager

In reply to 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_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).

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/Makefile   |   2 +-
 net/mptcp/basic.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/basic.c
net/mptcp/Makefile +1 -1
index 289fdf4339c1..7dc8853ea498 100644
@@ -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 basic.o
net/mptcp/basic.c new file +247 -0

247 lines not on this page · raw message

net/mptcp/pm.c +7 -0
index d0ce36cc912c..88b5cf6046fe 100644
@@ -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_basic_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_basic_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_basic_add_addr(pm);
+
 	pm->remote_valid = 1;
 }
 
net/mptcp/protocol.c +1 -0
index 2fcdf11a653a..80cd984d1e01 100644
@@ -1130,6 +1130,7 @@ void mptcp_proto_init(void)
 	mptcp_stream_ops.shutdown = mptcp_shutdown;
 
 	subflow_init();
+	mptcp_basic_init();
 
 	if (proto_register(&mptcp_prot, 1) != 0)
 		panic("Failed to register MPTCP proto.\n");
net/mptcp/protocol.h +5 -0
index fcf78fc0df84..ac5f87495348 100644
@@ -273,6 +273,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_basic_init(void);
+void mptcp_basic_new_connection(struct mptcp_pm_data *pm);
+void mptcp_basic_fully_established(struct mptcp_pm_data *pm);
+void mptcp_basic_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
#3 lore raw

[MPTCP] Re: [PATCH 2/2] mptcp: Implement basic path manager

Hi Peter,

Quoted 10 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_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).

Just to sure: is the goal still not to upstream this patch? Just for our tests?

(If we want to upstream it, I would propose a few modifications, e.g. call the file pm_basic.c, add "pm_" in the name of the exported functions, etc.)

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
#4 lore raw
In reply to Peter Krystad

Hi,

Quoted 12 lines · Peter Krystad

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.

v2:
rename to 'basic' path manager
remove pm_init definition

Peter Krystad (2):
mptcp: Minor changes to path manager interface
mptcp: Implement basic path manager

Quoted 7 lines
 net/mptcp/Makefile   |   2 +-
 net/mptcp/basic.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/basic.c

I'm sorry for lagging behind so much.

I'm ok with the patches in the current status - even if I fear some rebasing will be now need, perhaps good Matt can take that bourden, too
- since he called me 'lawyer' I feel less guilty asking that ;)

I think we pm looking schema may need some follow-up/cleanup, but that could eventually follow later.

Cheers,

Paolo

#5 lore raw

Hi Peter, Paolo,

Quoted 23 lines · Paolo Abeni

Hi,

Quoted 12 lines · Peter Krystad

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.

v2:
rename to 'basic' path manager
remove pm_init definition

Peter Krystad (2):
mptcp: Minor changes to path manager interface
mptcp: Implement basic path manager

Quoted 7 lines
  net/mptcp/Makefile   |   2 +-
  net/mptcp/basic.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/basic.c

Quoted 5 lines

I'm sorry for lagging behind so much.

I'm ok with the patches in the current status - even if I fear some rebasing will be now need, perhaps good Matt can take that bourden, too
- since he called me 'lawyer' I feel less guilty asking that ;)

Yes my Lord!

Thank you for the patch and the plea (review?)!

- e3c637f02e45: "squashed" (including a rebase) the first part of the first patch in "mptcp: Add path manager interface"
- 232953cffb3b: "squashed" (including a rebase) the second part of the first patch in "mptcp: Implement path manager interface commands". Note I had a conflict: addr->s_addr is stored in network bytes order.
- 250376a152f7: added (including a rebase) the second patch at the end (should I move it somewhere else?)
- 5cfa9c11a52f: fix compilation errors (due to changes made since the patch has been sent here)

Tests are still OK!

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
author
#6 lore raw
Quoted 46 lines · Matthieu Baerts

Hi Peter, Paolo,

Quoted 23 lines · Paolo Abeni

Hi,

Quoted 12 lines · Peter Krystad

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.

v2:
rename to 'basic' path manager
remove pm_init definition

Peter Krystad (2):
mptcp: Minor changes to path manager interface
mptcp: Implement basic path manager

Quoted 7 lines
  net/mptcp/Makefile   |   2 +-
  net/mptcp/basic.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/basic.c

Quoted 5 lines

I'm sorry for lagging behind so much.

I'm ok with the patches in the current status - even if I fear some rebasing will be now need, perhaps good Matt can take that bourden, too
- since he called me 'lawyer' I feel less guilty asking that ;)

Yes my Lord!

Thank you for the patch and the plea (review?)!

- e3c637f02e45: "squashed" (including a rebase) the first part of the first patch in "mptcp: Add path manager interface"
- 232953cffb3b: "squashed" (including a rebase) the second part of the first patch in "mptcp: Implement path manager interface commands". Note I had a conflict: addr->s_addr is stored in network bytes order.
- 250376a152f7: added (including a rebase) the second patch at the end (should I move it somewhere else?)
- 5cfa9c11a52f: fix compilation errors (due to changes made since the patch has been sent here)

Quoted 1 line

Tests are still OK!

Thanks Matthieu for this rebase and merge. I had some changes locally to adapt these patches for IPv6, I will rebase and post them tomorrow to prepare for sharing IPv6 RFC this week.

Peter.

Quoted 2 lines

Cheers,
Matt