Skip to contentSkip to conversation

Fix issues in prerequisite patches

PATCH In review Peter Krystad 3 participants 6 messages Oct 29, 2019 – Oct 31, 2019

Subsystems (2)
lore
Share & tools
lore

Peter Krystad

author
#0 lore raw

v2 cover Fix issues in prerequisite patches

Fix issues found by Mat in the "IPv6 prerequisite" patch series when running against the multipath.org implementation.

v2: Only announce address if same family as listener
Only bind local address if same family as remote Patch 1 of v1 set already merged.

Peter Krystad (2):
mptcp: Save address family when creating socket
mptcp: Use correct address family when creating subflows

 net/mptcp/basic.c    | 36 ++++++++++++++++++++++--------------
 net/mptcp/protocol.c |  1 +
 net/mptcp/protocol.h |  1 +
 3 files changed, 24 insertions(+), 14 deletions(-)
Signature · 1 line
2.17.2
author
#1 lore raw

PATCH v2 1/2 mptcp: Save address family when creating socket

For IPv6 the family will be needed when creating additional subflow sockets.

squashto: mptcp: Associate MPTCP context with TCP socket

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/protocol.c | 1 +
 net/mptcp/protocol.h | 1 +
 2 files changed, 2 insertions(+)
net/mptcp/protocol.c +1 -0
index c2b29f8d0377..3af5f121af9e 100644
@@ -1091,6 +1091,7 @@ static struct socket *mptcp_socket_create_get(struct mptcp_sock *msk)
 	}
 
 	msk->subflow = ssock;
+	msk->family = ssock->sk->sk_family;
 	subflow = mptcp_subflow_ctx(msk->subflow->sk);
 	subflow->request_mptcp = 1; /* @@ if MPTCP enabled */
 	subflow->request_version = 0; /* currently only v0 supported */
net/mptcp/protocol.h +1 -0
index 791f2c19cfb8..8fe5f9383d38 100644
@@ -133,6 +133,7 @@ struct mptcp_sock {
 	u32		token;
 	unsigned long	flags;
 	u16		dport;
+	sa_family_t	family;
 	struct work_struct rtx_work;
 	struct list_head conn_list;
 	struct list_head rtx_queue;
Signature · 1 line
2.17.2
author
#2 lore raw

PATCH v2 2/2 mptcp: Use correct address family when creating subflows

In reply to Peter Krystad

Ensure that the address family of the remote address matches the local address when binding additional subflow sockets.

Also, only send ADD_ADDR for addresses in the same family as the initial listening MPTCP socket.

squashto: Implement basic path manager

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/basic.c | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)
net/mptcp/basic.c +22 -14
index d2fd0560c136..67a93aff500e 100644
@@ -189,11 +189,15 @@ static void announce_addr_worker(struct work_struct *work)
 
 	pernet = net_generic(sock_net((struct sock *)msk), basic_pernet_id);
 
-	if (pernet->has_announce_v4)
+	/* Only announce addresses in the same family as listening socket.
+	 * When the listening socket can accept connections from both
+	 * families this restriction may be removed.
+	 */
+	if (pernet->has_announce_v4 && msk->family == AF_INET)
 		mptcp_pm_announce_addr(pm->token, 1,
 				       &pernet->announce_v4_addr);
 #if IS_ENABLED(CONFIG_IPV6)
-	if (pernet->has_announce_v6)
+	else if (pernet->has_announce_v6 && msk->family == AF_INET6)
 		mptcp_pm_announce_addr6(pm->token, 1,
 					&pernet->announce_v6_addr);
 #endif
@@ -209,19 +213,23 @@ static void create_subflow_worker(struct work_struct *work)
 
 	pernet = net_generic(sock_net((struct sock *)msk), basic_pernet_id);
 
-	if (pernet->has_announce_v4)
-		mptcp_pm_create_subflow(pm->token, pm->remote_id,
-					&pernet->announce_v4_addr);
-#if IS_ENABLED(CONFIG_IPV6)
-	else if (pernet->has_announce_v6)
-		mptcp_pm_create_subflow6(pm->token, pm->remote_id,
-					 &pernet->announce_v6_addr);
-#endif
-	else if (pm->local_family == AF_INET)
-		mptcp_pm_create_subflow(pm->token, pm->remote_id, NULL);
+	if (pm->remote_family == AF_INET) {
+		if (pernet->has_announce_v4)
+			mptcp_pm_create_subflow(pm->token, pm->remote_id,
+						&pernet->announce_v4_addr);
+		else
+			mptcp_pm_create_subflow(pm->token, pm->remote_id,
+						NULL);
+	}
 #if IS_ENABLED(CONFIG_IPV6)
-	else
-		mptcp_pm_create_subflow6(pm->token, pm->remote_id, NULL);
+	else if (pm->remote_family == AF_INET6) {
+		if (pernet->has_announce_v6)
+			mptcp_pm_create_subflow6(pm->token, pm->remote_id,
+						 &pernet->announce_v6_addr);
+		else
+			mptcp_pm_create_subflow6(pm->token, pm->remote_id,
+						 NULL);
+	}
 #endif
 
 	sock_put((struct sock *)msk);
Signature · 1 line
2.17.2
#3 lore raw
In reply to Peter Krystad
Quoted 7 lines · Peter Krystad

Fix issues found by Mat in the "IPv6 prerequisite" patch series when running against the multipath.org implementation.

v2: Only announce address if same family as listener
Only bind local address if same family as remote Patch 1 of v1 set already merged.

Quoted 9 lines

Peter Krystad (2):
mptcp: Save address family when creating socket
mptcp: Use correct address family when creating subflows

 net/mptcp/basic.c    | 36 ++++++++++++++++++++++--------------
 net/mptcp/protocol.c |  1 +
 net/mptcp/protocol.h |  1 +
 3 files changed, 24 insertions(+), 14 deletions(-)

The patches LGTM, thanks!

Note: patch 2/2 will allow mptcp clients to either ipv4 and ipv6 subflows, if the server allows/supports that - e.g. mptcp.org server

Paolo

#4 lore raw

Hi Peter, Paolo,

Quoted 12 lines · Paolo Abeni
Quoted 11 lines · Peter Krystad

Fix issues found by Mat in the "IPv6 prerequisite" patch series when running against the multipath.org implementation.

v2: Only announce address if same family as listener
Only bind local address if same family as remote Patch 1 of v1 set already merged.

Peter Krystad (2):
mptcp: Save address family when creating socket
mptcp: Use correct address family when creating subflows

Quoted 7 lines
Quoted 5 lines
  net/mptcp/basic.c    | 36 ++++++++++++++++++++++--------------
  net/mptcp/protocol.c |  1 +
  net/mptcp/protocol.h |  1 +
  3 files changed, 24 insertions(+), 14 deletions(-)

The patches LGTM, thanks!

Thank you for the patches and reviews!
I am going to apply this ASAP!

Quoted 2 lines

Note: patch 2/2 will allow mptcp clients to either ipv4 and ipv6 subflows, if the server allows/supports that - e.g. mptcp.org server

Peter: will you send a new patch later? Or should we add this in the TODO list?

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
#5 lore raw
Quoted 21 lines · Matthieu Baerts

Hi Peter, Paolo,

Quoted 18 lines · Paolo Abeni
Quoted 16 lines · Peter Krystad

Fix issues found by Mat in the "IPv6 prerequisite" patch series when running against the multipath.org implementation.

v2: Only announce address if same family as listener Only bind local address if same family as remote Patch 1 of v1 set already merged.

Peter Krystad (2):
   mptcp: Save address family when creating socket
   mptcp: Use correct address family when creating subflows

  net/mptcp/basic.c    | 36 ++++++++++++++++++++++-------------- net/mptcp/protocol.c |  1 +
  net/mptcp/protocol.h |  1 +

  3 files changed, 24 insertions(+), 14 deletions(-)
Quoted 4 lines
Quoted 1 line

The patches LGTM, thanks!

Thank you for the patches and reviews!
I am going to apply this ASAP!

- 09a7aae56509: "squashed" patch 1/2 in "mptcp: Associate MPTCP context with TCP socket"
- 8cdc9c136c25: conflict in t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
- 9a353e51c68e: conflict in t/mptcp-Add-key-generation-and-token-tree
- ee2921b42ea4: conflict in t/mptcp-Implement-MPTCP-receive-path
- c6ab7a9bfe74: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- f117c4d20b54: conflict in t/mptcp-implement-and-use-MPTCP-level-retransmission
- 46bbb9476623..c23d324d27ee: result
- b077793b215f: "squashed" patch 2/2 in "mptcp: Implement basic path manager"
- c23d324d27ee..3a4c8696fb26: result

Tests are in progress.

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