Skip to contentSkip to conversation

IPv6 support

PATCH In review Peter Krystad 3 participants 14 messages Nov 6, 2019 – Nov 8, 2019

Subsystems (3)
lore
Share & tools
lore

Peter Krystad

author
#0 lore raw

v2 cover IPv6 support

Implemented support for IPv6. selftests pass with ipv6=true, but they take twice as long to run...

With re-factoring the addition of IPv6 is very clean but I did not split files yet as it will be hard to squash any changes after the such a split.

Still to do: multiple subflows, handling IPv4-mapped connections.

v2: Added further re-factoring that makes IPv6 change even smaller
Add mptcpv6_init() stub and verified build with IPv6=n and m

Kconfig changes submitted in earlier patch set, this set depends on those changes being merged.

Squashing the final patch (6/6) so that IPv6 support occurs before the kselftests commit will be complicated.

Peter Krystad (6):
mptcp: Reference icsk_af_ops routines through saved pointer
mptcp: Reference inet_stream_ops routines through socket->ops
mptcp: Re-factor mptcp_getname routine to be af-agnostic
mptcp: Re-factor subflow_v4_conn_request to be af-agnostic
mptcp: Export low-level routines for IPv6
mptcp: Add IPv6 support

 include/net/mptcp.h  |  10 ++++
 include/net/tcp.h    |   3 ++
 net/ipv6/tcp_ipv6.c  |  16 ++++--
 net/mptcp/ctrl.c     |  11 ++++
 net/mptcp/protocol.c | 117 ++++++++++++++++++++++++++++++++-----------
 net/mptcp/protocol.h |   7 +++
 net/mptcp/subflow.c  |  94 +++++++++++++++++++++++++++++-----
 7 files changed, 213 insertions(+), 45 deletions(-)
Signature · 1 line
2.17.2
author
#1 lore raw

PATCH v2 1/6 mptcp: Reference icsk_af_ops routines through saved pointer

Save a pointer to the original TCP address-family-specific routines in the subflow context, which can then be called by the MPTCP versions of the same routines.

This eliminates the need to directly reference inet_xxx routines, or indirectly through the ipv4_specific struct. This approach will also save a lot of cut-n-paste code for IPv6 support.

squashto: Handle MP_CAPABLE options for outgoing connections
(new ctx field and sk_rx_dst_set changes) Create SUBFLOW socket for incoming connections (conn_request and syn_recv_sock changes) Add key generation and token tree (subflow_rebuild_header changes)

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/protocol.h |  1 +
 net/mptcp/subflow.c  | 13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)
net/mptcp/protocol.h +1 -0
index 56e1b8d097b3..7f783ca65f43 100644
@@ -227,6 +227,7 @@ struct mptcp_subflow_context {
 
 	struct	socket *tcp_sock;   /* underlying tcp_sock */
 	struct	sock *conn;	    /* parent mptcp_sock */
+	const	struct inet_connection_sock_af_ops *icsk_af_ops;
 	void	(*tcp_sk_data_ready)(struct sock *sk);
 	struct	rcu_head rcu;
 };
net/mptcp/subflow.c +8 -5
index 704dfc49f0d5..6aa02001a06d 100644
@@ -45,7 +45,7 @@ static int subflow_rebuild_header(struct sock *sk)
 	if (err)
 		return err;
 
-	return inet_sk_rebuild_header(sk);
+	return subflow->icsk_af_ops->rebuild_header(sk);
 }
 
 static void subflow_req_destructor(struct request_sock *req)
@@ -169,7 +169,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
 
-	inet_sk_rx_dst_set(sk, skb);
+	subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
 
 	if (!subflow->conn)
 		return;
@@ -208,7 +208,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 static struct request_sock_ops subflow_request_sock_ops;
 static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops;
 
-static int subflow_conn_request(struct sock *sk, struct sk_buff *skb)
+static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
 
@@ -276,7 +276,8 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 			return NULL;
 	}
 
-	child = tcp_v4_syn_recv_sock(sk, skb, req, dst, req_unhash, own_req);
+	child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
+						     req_unhash, own_req);
 
 	if (child && *own_req) {
 		struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child);
@@ -768,6 +769,7 @@ static int subflow_ulp_init(struct sock *sk)
 	pr_debug("subflow=%p", ctx);
 
 	tp->is_mptcp = 1;
+	ctx->icsk_af_ops = icsk->icsk_af_ops;
 	icsk->icsk_af_ops = &subflow_specific;
 	ctx->tcp_sk_data_ready = sk->sk_data_ready;
 	sk->sk_data_ready = subflow_data_ready;
@@ -805,6 +807,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
 
 	new_ctx->conn = NULL;
 	new_ctx->conn_finished = 1;
+	new_ctx->icsk_af_ops = old_ctx->icsk_af_ops;
 	new_ctx->tcp_sk_data_ready = old_ctx->tcp_sk_data_ready;
 
 	if (subflow_req->mp_capable) {
@@ -861,7 +864,7 @@ void mptcp_subflow_init(void)
 	subflow_request_sock_ipv4_ops.init_req = subflow_v4_init_req;
 
 	subflow_specific = ipv4_specific;
-	subflow_specific.conn_request = subflow_conn_request;
+	subflow_specific.conn_request = subflow_v4_conn_request;
 	subflow_specific.syn_recv_sock = subflow_syn_recv_sock;
 	subflow_specific.sk_rx_dst_set = subflow_finish_connect;
 	subflow_specific.rebuild_header = subflow_rebuild_header;
Signature · 1 line
2.17.2
author
#2 lore raw

PATCH v2 2/6 mptcp: Reference inet_stream_ops routines through socket->ops

In reply to Peter Krystad

Call protocol routines on the subflow through the existing proto_ops pointer in socket structure instead of calling them directly. This will make all of the mptcp proto_ops routines work for both IPv4 and IPv6.

squashto: Associate MPTCP context with TCP socket
(bind and stream_connect changes) Create SUBFLOW socket for incoming connections (getname, listen, and stream_accept changes) Add tcp_poll (poll changes)

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/protocol.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
net/mptcp/protocol.c +8 -8
index c2b29f8d0377..b3263a7f6458 100644
@@ -1115,7 +1115,7 @@ static int mptcp_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 	if (IS_ERR(ssock))
 		return PTR_ERR(ssock);
 
-	err = inet_bind(ssock, uaddr, addr_len);
+	err = ssock->ops->bind(ssock, uaddr, addr_len);
 	sock_put(ssock->sk);
 	return err;
 }
@@ -1134,7 +1134,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
 	if (IS_ERR(ssock))
 		return PTR_ERR(ssock);
 
-	err = inet_stream_connect(ssock, uaddr, addr_len, flags);
+	err = ssock->ops->connect(ssock, uaddr, addr_len, flags);
 	sock_put(ssock->sk);
 	return err;
 }
@@ -1156,7 +1156,7 @@ static int mptcp_getname(struct socket *sock, struct sockaddr *uaddr,
 		 * bypass mptcp.
 		 */
 		sock->ops = &inet_stream_ops;
-		return inet_getname(sock, uaddr, peer);
+		return sock->ops->getname(sock, uaddr, peer);
 	}
 
 	lock_sock(sock->sk);
@@ -1164,7 +1164,7 @@ static int mptcp_getname(struct socket *sock, struct sockaddr *uaddr,
 	if (ssock) {
 		release_sock(sock->sk);
 		pr_debug("subflow=%p", ssock->sk);
-		ret = inet_getname(ssock, uaddr, peer);
+		ret = ssock->ops->getname(ssock, uaddr, peer);
 		sock_put(ssock->sk);
 		return ret;
 	}
@@ -1179,7 +1179,7 @@ static int mptcp_getname(struct socket *sock, struct sockaddr *uaddr,
 		return -ENOTCONN;
 	}
 
-	ret = inet_getname(ssk->sk_socket, uaddr, peer);
+	ret = ssk->sk_socket->ops->getname(ssk->sk_socket, uaddr, peer);
 	release_sock(sock->sk);
 	return ret;
 }
@@ -1196,7 +1196,7 @@ static int mptcp_listen(struct socket *sock, int backlog)
 	if (IS_ERR(ssock))
 		return PTR_ERR(ssock);
 
-	err = inet_listen(ssock, backlog);
+	err = ssock->ops->listen(ssock, backlog);
 	sock_put(ssock->sk);
 	return err;
 }
@@ -1214,7 +1214,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
 	if (!ssock)
 		return -EINVAL;
 
-	err = inet_accept(sock, newsock, flags, kern);
+	err = ssock->ops->accept(sock, newsock, flags, kern);
 	sock_put(ssock->sk);
 	return err;
 }
@@ -1233,7 +1233,7 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
 	ssock = __mptcp_fallback_get_ref(msk);
 	if (ssock) {
 		release_sock(sk);
-		ret = tcp_poll(file, ssock, wait);
+		ret = ssock->ops->poll(file, ssock, wait);
 		sock_put(ssock->sk);
 		return ret;
 	}
Signature · 1 line
2.17.2
author
#3 lore raw

PATCH v2 3/6 mptcp: Re-factor mptcp_getname routine to be af-agnostic

In reply to Peter Krystad

Split mptcp_getname into two parts: af-specific
part and functional part.

squashto: Create SUBFLOW socket for incoming connections

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/protocol.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)
net/mptcp/protocol.c +23 -13
index b3263a7f6458..323b3e65dba2 100644
@@ -1147,18 +1147,6 @@ static int mptcp_getname(struct socket *sock, struct sockaddr *uaddr,
 	struct sock *ssk;
 	int ret;
 
-	if (sock->sk->sk_prot == &tcp_prot) {
-		/* we are being invoked from __sys_accept4, after
-		 * mptcp_accept() has just accepted a non-mp-capable
-		 * flow: sk is a tcp_sk, not an mptcp one.
-		 *
-		 * Hand the socket over to tcp so all further socket ops
-		 * bypass mptcp.
-		 */
-		sock->ops = &inet_stream_ops;
-		return sock->ops->getname(sock, uaddr, peer);
-	}
-
 	lock_sock(sock->sk);
 	ssock = __mptcp_fallback_get_ref(msk);
 	if (ssock) {
@@ -1184,6 +1172,28 @@ static int mptcp_getname(struct socket *sock, struct sockaddr *uaddr,
 	return ret;
 }
 
+static int mptcp_v4_getname(struct socket *sock, struct sockaddr *uaddr,
+			    int peer)
+{
+	int ret;
+
+	if (sock->sk->sk_prot == &tcp_prot) {
+		/* we are being invoked from __sys_accept4, after
+		 * mptcp_accept() has just accepted a non-mp-capable
+		 * flow: sk is a tcp_sk, not an mptcp one.
+		 *
+		 * Hand the socket over to tcp so all further socket ops
+		 * bypass mptcp.
+		 */
+		sock->ops = &inet_stream_ops;
+		return sock->ops->getname(sock, uaddr, peer);
+	}
+
+	ret = mptcp_getname(sock, uaddr, peer);
+
+	return ret;
+}
+
 static int mptcp_listen(struct socket *sock, int backlog)
 {
 	struct mptcp_sock *msk = mptcp_sk(sock->sk);
@@ -1300,7 +1310,7 @@ void mptcp_proto_init(void)
 	mptcp_stream_ops.connect = mptcp_stream_connect;
 	mptcp_stream_ops.poll = mptcp_poll;
 	mptcp_stream_ops.accept = mptcp_stream_accept;
-	mptcp_stream_ops.getname = mptcp_getname;
+	mptcp_stream_ops.getname = mptcp_v4_getname;
 	mptcp_stream_ops.listen = mptcp_listen;
 	mptcp_stream_ops.shutdown = mptcp_shutdown;
 
Signature · 1 line
2.17.2
author
#4 lore raw

PATCH v2 4/6 mptcp: Re-factor subflow_v4_conn_request to be af-agnostic

In reply to Peter Krystad

Split subflow_v4_init_req into separate af-specific and functional parts.

squashto: Create SUBFLOW socket for incoming connections

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/subflow.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
net/mptcp/subflow.c +14 -6
index 6aa02001a06d..586713537124 100644
@@ -90,19 +90,16 @@ static bool subflow_token_join_request(struct request_sock *req,
 	return true;
 }
 
-static void subflow_v4_init_req(struct request_sock *req,
-				const struct sock *sk_listener,
-				struct sk_buff *skb)
+static void subflow_init_req(struct request_sock *req,
+			     const struct sock *sk_listener,
+			     struct sk_buff *skb)
 {
 	struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener);
 	struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
 	struct tcp_options_received rx_opt;
 
-	tcp_rsk(req)->is_mptcp = 1;
 	pr_debug("subflow_req=%p, listener=%p", subflow_req, listener);
 
-	tcp_request_sock_ipv4_ops.init_req(req, sk_listener, skb);
-
 	memset(&rx_opt.mptcp, 0, sizeof(rx_opt.mptcp));
 	mptcp_get_options(skb, &rx_opt);
 
@@ -146,6 +143,17 @@ static void subflow_v4_init_req(struct request_sock *req,
 	}
 }
 
+static void subflow_v4_init_req(struct request_sock *req,
+				const struct sock *sk_listener,
+				struct sk_buff *skb)
+{
+	tcp_rsk(req)->is_mptcp = 1;
+
+	tcp_request_sock_ipv4_ops.init_req(req, sk_listener, skb);
+
+	subflow_init_req(req, sk_listener, skb);
+}
+
 /* validate received truncated hmac and create hmac for third ACK */
 static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow)
 {
Signature · 1 line
2.17.2
author
#5 lore raw

PATCH v2 5/6 mptcp: Export low-level routines for IPv6

In reply to Peter Krystad

ipv6_specific and tcp_request_sock_ipv6_ops will be referenced during TCP subflow creation.

squashto: tcp: Export TCP functions and ops

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 include/net/tcp.h    | 3 +++
 net/ipv6/tcp_ipv6.c  | 9 +++++----
 net/mptcp/protocol.h | 3 +++
 3 files changed, 11 insertions(+), 4 deletions(-)
include/net/tcp.h +3 -0
index f1a0bdb7d1b1..74840bb2a4f3 100644
@@ -1990,6 +1990,9 @@ struct tcp_request_sock_ops {
 };
 
 extern const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops;
+#if IS_ENABLED(CONFIG_IPV6)
+extern const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops;
+#endif
 
 #ifdef CONFIG_SYN_COOKIES
 static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
net/ipv6/tcp_ipv6.c +5 -4
index 4804b6dc5e65..50f6f21bbdb1 100644
@@ -75,7 +75,7 @@ static void	tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
 static int	tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb);
 
 static const struct inet_connection_sock_af_ops ipv6_mapped;
-static const struct inet_connection_sock_af_ops ipv6_specific;
+const struct inet_connection_sock_af_ops ipv6_specific;
 #ifdef CONFIG_TCP_MD5SIG
 static const struct tcp_sock_af_ops tcp_sock_ipv6_specific;
 static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific;
@@ -785,7 +785,7 @@ struct request_sock_ops tcp6_request_sock_ops __read_mostly = {
 	.syn_ack_timeout =	tcp_syn_ack_timeout,
 };
 
-static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
+const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
 	.mss_clamp	=	IPV6_MIN_MTU - sizeof(struct tcphdr) -
 				sizeof(struct ipv6hdr),
 #ifdef CONFIG_TCP_MD5SIG
@@ -1111,7 +1111,8 @@ static void tcp_v6_restore_cb(struct sk_buff *skb)
 		sizeof(struct inet6_skb_parm));
 }
 
-static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
+static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk,
+					 struct sk_buff *skb,
 					 struct request_sock *req,
 					 struct dst_entry *dst,
 					 struct request_sock *req_unhash,
@@ -1739,7 +1740,7 @@ static struct timewait_sock_ops tcp6_timewait_sock_ops = {
 	.twsk_destructor = tcp_twsk_destructor,
 };
 
-static const struct inet_connection_sock_af_ops ipv6_specific = {
+const struct inet_connection_sock_af_ops ipv6_specific = {
 	.queue_xmit	   = inet6_csk_xmit,
 	.send_check	   = tcp_v6_send_check,
 	.rebuild_header	   = inet6_sk_rebuild_header,
net/mptcp/protocol.h +3 -0
index 7f783ca65f43..c6102ca3c79e 100644
@@ -269,6 +269,9 @@ int mptcp_subflow_connect(struct sock *sk, struct sockaddr *local,
 int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock);
 
 extern const struct inet_connection_sock_af_ops ipv4_specific;
+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
+extern const struct inet_connection_sock_af_ops ipv6_specific;
+#endif
 
 void mptcp_proto_init(void);
 
Signature · 1 line
2.17.2
#6 lore raw

[MPTCP] Re: [PATCH v2 5/6] mptcp: Export low-level routines for IPv6

net/ipv6/tcp_ipv6.c static void tcp_v6_restore_cb(struct sk_buff *skb) · line 1118

Quoted 10 lines · Peter Krystad
net/ipv6/tcp_ipv6.c +2 -1
@@ -1111,7 +1111,8 @@ static void tcp_v6_restore_cb(struct sk_buff *skb)
 		sizeof(struct inet6_skb_parm));
 }
 
-static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
+static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk,
+					 struct sk_buff *skb,
 					 struct request_sock *req,
 					 struct dst_entry *dst,
 					 struct request_sock *req_unhash,

Minor nit: it looks like this chunk is not needed[1].

Cheers,

Paolo

[1] https://youtu.be/XfEuxRDYiyc ;)

#7 lore raw

[MPTCP] Re: [PATCH v2 5/6] mptcp: Export low-level routines for IPv6

Hi Paolo,

Quoted 5 lines · Paolo Abeni
Quoted 4 lines · Peter Krystad
net/ipv6/tcp_ipv6.c +0 -0
@@ -1111,7 +1111,8 @@ static void tcp_v6_restore_cb(struct sk_buff *skb)
  		sizeof(struct inet6_skb_parm));
  }
 
Quoted 8 lines

net/ipv6/tcp_ipv6.c static void tcp_v6_restore_cb(struct sk_buff *skb) · line 1118

Quoted 6 lines
net/ipv6/tcp_ipv6.c +2 -1
-static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
+static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk,
+					 struct sk_buff *skb,
  					 struct request_sock *req,
  					 struct dst_entry *dst,
  					 struct request_sock *req_unhash,

Minor nit: it looks like this chunk is not needed[1].

Peter replied this in the previous version of the patch:

Quoted 2 lines

It seemed like since I was in the neighborhood I would fix this over-80 char line. If that's not appropriate we can drop this chunk.

I guess we should not modify the style of non MPTCP code. Then better to drop this change, right?

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
#8 lore raw

[MPTCP] Re: [PATCH v2 5/6] mptcp: Export low-level routines for IPv6

Quoted 17 lines · Matthieu Baerts

Hi Paolo,

Quoted 5 lines · Paolo Abeni
Quoted 4 lines · Peter Krystad
net/ipv6/tcp_ipv6.c +0 -0
@@ -1111,7 +1111,8 @@ static void tcp_v6_restore_cb(struct sk_buff *skb)
  		sizeof(struct inet6_skb_parm));
  }
 
Quoted 8 lines

net/ipv6/tcp_ipv6.c static void tcp_v6_restore_cb(struct sk_buff *skb) · line 1118

Quoted 6 lines
net/ipv6/tcp_ipv6.c +2 -1
-static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
+static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk,
+					 struct sk_buff *skb,
  					 struct request_sock *req,
  					 struct dst_entry *dst,
  					 struct request_sock *req_unhash,

Minor nit: it looks like this chunk is not needed[1].

Quoted 4 lines

Peter replied this in the previous version of the patch:

Quoted 2 lines

It seemed like since I was in the neighborhood I would fix this over-80 char line. If that's not appropriate we can drop this chunk.

whoops, I missed that, sorry! And thank you for the head-up!

Quoted 2 lines

I guess we should not modify the style of non MPTCP code. Then better to drop this change, right?

Yes, exactly. The above change should be in a separate, non mptcp- related patch.

Cheers,

Paolo

author
#9 lore raw

PATCH v2 6/6 mptcp: Add IPv6 support

In reply to Peter Krystad

Add hooks for IPv6 as needed and initialize MPTCP
IPv6 support.

Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
---
 include/net/mptcp.h  | 10 +++++++
 net/ipv6/tcp_ipv6.c  |  7 +++++
 net/mptcp/ctrl.c     | 11 ++++++++
 net/mptcp/protocol.c | 67 ++++++++++++++++++++++++++++++++++++++------
 net/mptcp/protocol.h |  3 ++
 net/mptcp/subflow.c  | 61 ++++++++++++++++++++++++++++++++++++++--
 6 files changed, 149 insertions(+), 10 deletions(-)
include/net/mptcp.h +10 -0
index 1196a5588ce1..d19bc31a6250 100644
@@ -152,4 +152,14 @@ static inline bool mptcp_sk_is_subflow(const struct sock *sk)
 
 static inline void mptcp_seq_show(struct seq_file *seq) { }
 #endif /* CONFIG_MPTCP */
+
+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
+int mptcpv6_init(void);
+#elif IS_ENABLED(CONFIG_IPV6)
+static inline int mptcpv6_init(void)
+{
+	return 0;
+}
+#endif
+
 #endif /* __NET_MPTCP_H */
net/ipv6/tcp_ipv6.c +7 -0
index 50f6f21bbdb1..10d1c033d458 100644
@@ -2109,9 +2109,16 @@ int __init tcpv6_init(void)
 	ret = register_pernet_subsys(&tcpv6_net_ops);
 	if (ret)
 		goto out_tcpv6_protosw;
+
+	ret = mptcpv6_init();
+	if (ret)
+		goto out_tcpv6_pernet_subsys;
+
 out:
 	return ret;
 
+out_tcpv6_pernet_subsys:
+	unregister_pernet_subsys(&tcpv6_net_ops);
 out_tcpv6_protosw:
 	inet6_unregister_protosw(&tcpv6_protosw);
 out_tcpv6_protocol:
net/mptcp/ctrl.c +11 -0
index 6023c9f722ea..8e39585d37f3 100644
@@ -117,3 +117,14 @@ void __init mptcp_init(void)
 	if (register_pernet_subsys(&mptcp_pernet_ops) < 0)
 		panic("Failed to register MPTCP pernet subsystem.\n");
 }
+
+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
+int __init mptcpv6_init(void)
+{
+	int err;
+
+	err = mptcp_proto_v6_init();
+
+	return err;
+}
+#endif
net/mptcp/protocol.c +59 -8

94 lines not on this page · raw message

net/mptcp/protocol.h +3 -0
index c6102ca3c79e..90942e0c3112 100644
@@ -274,6 +274,9 @@ extern const struct inet_connection_sock_af_ops ipv6_specific;
 #endif
 
 void mptcp_proto_init(void);
+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
+int mptcp_proto_v6_init(void);
+#endif
 
 struct mptcp_read_arg {
 	struct msghdr *msg;
net/mptcp/subflow.c +59 -2

101 lines not on this page · raw message

Signature · 1 line
2.17.2
#10 lore raw

[MPTCP] Re: [PATCH v2 6/6] mptcp: Add IPv6 support

Hi Peter,

Quoted 2 lines · Peter Krystad

Add hooks for IPv6 as needed and initialize MPTCP
IPv6 support.

Where should I squash the different chunks? :)

Please note that for the moment, some commits don't compile (variable not available in the commit, etc.). I will have a look as soon as possible.

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
#11 lore raw

[MPTCP] Re: [PATCH v2 6/6] mptcp: Add IPv6 support

Quoted 7 lines · Matthieu Baerts

Hi Peter,

Quoted 2 lines · Peter Krystad

Add hooks for IPv6 as needed and initialize MPTCP
IPv6 support.

Where should I squash the different chunks? :)

I'll try to sort this out today.

I did send one chunk that got dropped.

Peter.

Quoted 5 lines

Please note that for the moment, some commits don't compile (variable not available in the commit, etc.). I will have a look as soon as possible.

Cheers,
Matt

#12 lore raw
In reply to Peter Krystad
Quoted 4 lines · Peter Krystad

Implemented support for IPv6. selftests pass with ipv6=true, but they take twice as long to run...

With re-factoring the addition of IPv6 is very clean

Indeed.

Quoted 3 lines

but I did not
split files yet as it will be hard to squash any changes after the such a split.

I think this is ok.

The series looks great, with a minor comment on patch 5.

Cheers,

Paolo

#13 lore raw

Hi Peter, Paolo,

Quoted 7 lines · Paolo Abeni
Quoted 4 lines · Peter Krystad

Implemented support for IPv6. selftests pass with ipv6=true, but they take twice as long to run...

With re-factoring the addition of IPv6 is very clean

Indeed.

Thanks for the good work and the reviews!

Quoted 7 lines
Quoted 3 lines

but I did not
split files yet as it will be hard to squash any changes after the such a split.

I think this is ok.

The series looks great, with a minor comment on patch 5.

Now in the repo!

patch 1/6:

- 43a479b6ae30: "squashed" part 1 in "mptcp: Handle MP_CAPABLE options for outgoing connections"
- 930dabfdf09d: "squashed" part 2 in "mptcp: Create SUBFLOW socket for incoming connections"
- 4f561ba867fb: "squashed" part 3 in "mptcp: Add key generation and token tree"
- 9d8b388097f8: conflict in t/mptcp-Implement-MPTCP-receive-path
- 580421d52995..eac1e244ac31: result

patch 2/6:

- 0da98dd8d6bb: "squashed" part 1 in "mptcp: Associate MPTCP context with TCP socket"
- cff7f9dac059: "squashed" part 2 in "mptcp: Create SUBFLOW socket for incoming connections"
- b545a42175be: "squashed" part 3 in "mptcp: add mptcp_poll"
- b74f268dd118: "Signed-off-by" + "Co-developed-by"
- eac1e244ac31..3373244a8bf8: result

patch 3/6:

- 85c57d519a60: "squashed" in "mptcp: Create SUBFLOW socket for incoming connections"
- 3373244a8bf8..9861cce0e086: result

patch 4/6:

- b12b955e0bfb: "squashed" in "mptcp: Create SUBFLOW socket for incoming connections"
- dc4f6f7ae3f4: conflict in t/mptcp-Add-key-generation-and-token-tree
- cdc85f221f44: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- 11899f111b38: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- 9861cce0e086..262129eadf29: result

patch 5/6:
- 8b158237c6dc: "squashed" part 1 in "tcp: Export TCP functions and ops struct"
→ without the chunk discussed on the ML
→ AND without "extern const struct inet_connection_sock_af_ops ipv6_specific;"
- 262129eadf29..619461df7b41: result

patch 6/6:
- new topic/commit added just before KSleftests
- AND with "extern const struct inet_connection_sock_af_ops ipv6_specific;"
- 3bf456c9250a: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- 46e50b50b072: conflict in t/mptcp-allow-dumping-subflow-context-to-userspace

Tests not launched yet.

I am rebooting my machine, coming in 2 minutes :)

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