Add IPv6 Support
Subsystems (3)
Peter Krystad
cover Add IPv6 Support
This patchset is a replacement for the single "Add IPv6 Support" commit, with the chunks broken into seperate squash-able commits.
Peter Krystad (8):
mptcp: Add IPv6 support for MPTCP socket stubs
mptcp: Add IPv6 support for Associate MPTCP context
mptcp: Add IPV6 support for outgoing connections
mptcp: Add IPv6 support for mptcp_poll
mptcp: Add IPV6 support for incoming connections
mptcp: Add IPv6 support for key generation
mptcp: Add IPv6 support for shutdown()
mptcp: Add IPv6 support for new sysctl initialization
include/net/mptcp.h | 10 +++++++ net/ipv6/tcp_ipv6.c | 7 +++++ net/mptcp/ctrl.c | 11 ++++++++ net/mptcp/protocol.c | 62 +++++++++++++++++++++++++++++++++++++++++--- net/mptcp/protocol.h | 6 +++++ net/mptcp/subflow.c | 61 +++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 151 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.2
Peter Krystad
PATCH 1/8 mptcp: Add IPv6 support for MPTCP socket stubs
squashto: Add MPTCP socket stubs
--- include/net/mptcp.h | 10 ++++++++++ net/ipv6/tcp_ipv6.c | 7 +++++++ net/mptcp/protocol.c | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+)
include/net/mptcp.h +10 -0
@@ -146,4 +146,14 @@ static inline bool mptcp_sk_is_subflow(const struct sock *sk) }#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
@@ -2108,9 +2108,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/protocol.c +19 -0
@@ -963,3 +963,22 @@ void mptcp_proto_init(void)inet_register_protosw (&mptcp_protosw); } + +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +static struct inet_protosw mptcp_v6_protosw = { + .type =SOCK_STREAM , + .protocol =IPPROTO_MPTCP , + .prot = &mptcp_prot, + .ops = &inet6_stream_ops, + .flags =INET_PROTOSW_ICSK , +}; + +int mptcpv6_init (void ) +{ +int err; + + err =inet6_register_protosw (&mptcp_v6_protosw); + +return err; +} +#endif
Signature · 1 line
2.17.2
Peter Krystad
PATCH 2/8 mptcp: Add IPv6 support for Associate MPTCP context
In reply to Peter Krystadsquashto: Associate MPTCP context with TCP socket
--- net/mptcp/protocol.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +7 -1
@@ -965,11 +965,13 @@ void mptcp_proto_init(void) }#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +static struct proto_ops mptcp_v6_stream_ops; +static struct inet_protosw mptcp_v6_protosw = { .type =SOCK_STREAM , .protocol =IPPROTO_MPTCP , .prot = &mptcp_prot, - .ops = &inet6_stream_ops, + .ops = &mptcp_v6_stream_ops, .flags =INET_PROTOSW_ICSK , };
@@ -977,6 +979,10 @@ int mptcpv6_init(void) {int err; + mptcp_v6_stream_ops = inet6_stream_ops; + mptcp_v6_stream_ops.bind = mptcp_bind; + mptcp_v6_stream_ops.connect = mptcp_stream_connect; + err =inet6_register_protosw (&mptcp_v6_protosw);return err;
Signature · 1 line
2.17.2
Peter Krystad
PATCH 3/8 mptcp: Add IPV6 support for outgoing connections
In reply to Peter Krystadsquashto: Handle MP_CAPABLE options for outgoing connections
--- net/mptcp/protocol.h | 3 +++ net/mptcp/subflow.c | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-)
net/mptcp/protocol.h +3 -0
@@ -227,6 +227,9 @@ void mptcp_subflow_init(void);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 );
net/mptcp/subflow.c +16 -2
@@ -175,6 +175,10 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb)return 0 ; } +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +static struct inet_connection_sock_af_ops subflow_v6_specific; +#endif +/* validate hmac received in third ACK */ static bool subflow_hmac_valid (const struct request_sock *req,const struct tcp_options_received *rx_opt)
@@ -575,7 +579,8 @@ int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock)struct socket *sf;int err; - err =sock_create_kern (net,PF_INET ,SOCK_STREAM ,IPPROTO_TCP , &sf); + err =sock_create_kern (net, sk->sk_family,SOCK_STREAM ,IPPROTO_TCP , + &sf);if (err)return err;
@@ -637,11 +642,15 @@ static int subflow_ulp_init(struct sock *sk) goto out; } -pr_debug ("subflow=%p" , ctx); +pr_debug ("subflow=%p, family=%d" , ctx, sk->sk_family); tp->is_mptcp =1 ; ctx->icsk_af_ops = icsk->icsk_af_ops; icsk->icsk_af_ops = &subflow_specific; +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +if (sk->sk_family ==AF_INET6 ) + icsk->icsk_af_ops = &subflow_v6_specific; +#endif ctx->tcp_sk_data_ready = sk->sk_data_ready; sk->sk_data_ready = subflow_data_ready; sk->sk_write_space = subflow_write_space;
@@ -739,6 +748,11 @@ void mptcp_subflow_init(void) subflow_specific.sk_rx_dst_set = subflow_finish_connect; subflow_specific.rebuild_header = subflow_rebuild_header; +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) + subflow_v6_specific = ipv6_specific; + subflow_v6_specific.sk_rx_dst_set = subflow_finish_connect; +#endif +if (tcp_register_ulp (&subflow_ulp_ops) !=0 )panic ("MPTCP: failed to register subflows to ULP\n" ); }
Signature · 1 line
2.17.2
Peter Krystad
PATCH 4/8 mptcp: Add IPv6 support for mptcp_poll
In reply to Peter Krystadsquashto: add mptcp_poll
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -982,6 +982,7 @@ int mptcpv6_init(void) mptcp_v6_stream_ops = inet6_stream_ops; mptcp_v6_stream_ops.bind = mptcp_bind; mptcp_v6_stream_ops.connect = mptcp_stream_connect; + mptcp_v6_stream_ops.poll = mptcp_poll; err =inet6_register_protosw (&mptcp_v6_protosw);
Signature · 1 line
2.17.2
Peter Krystad
PATCH 5/8 mptcp: Add IPV6 support for incoming connections
In reply to Peter Krystadadd mtpcp_accept and listent
squashto: Create SUBFLOW socket for incoming connections
mtpcp: Add IPv6 support for for incoming connections [getname()]
squashto: Create SUBFLOW socket for incoming connections
mtpcp: Add IPv6 support for incoming connections
squashto: Create SUBFLOW socket for incoming connections
--- net/mptcp/protocol.c | 35 +++++++++++++++++++++++++++++++---- net/mptcp/subflow.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 4 deletions(-)
net/mptcp/protocol.c +31 -4
@@ -16,6 +16,9 @@#include <net/inet_hashtables.h> #include <net/protocol.h> #include <net/tcp.h> +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +#include <net/transp_v6.h> +#endif #include <net/mptcp.h> #include "protocol.h"
@@ -764,10 +767,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, {struct mptcp_sock *msk =mptcp_sk (sock->sk);struct socket *ssock; -int err = -ENOTSUPP ; - -if (uaddr->sa_family !=AF_INET )// @@ allow only IPv4 for now -return err; +int err; ssock =mptcp_socket_create_get (msk);if (IS_ERR (ssock))
@@ -833,6 +833,30 @@ static int mptcp_v4_getname(struct socket *sock, struct sockaddr *uaddr,return ret; } +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +static int mptcp_v6_getname (struct socket *sock,struct sockaddr *uaddr, +int peer) +{ +int ret; + +if (sock->sk->sk_prot == &tcpv6_prot) { +/* we are being invoked from __sys_accept4 after +* mptcp_accept() has accepted a non-mp-capable +* subflow: sk is a tcp_sk, not mptcp. +* +* Hand the socket over to tcp so all further +* socket ops bypass mptcp. +*/ + sock->ops = &inet6_stream_ops; +return sock->ops->getname (sock, uaddr, peer); + } + + ret =mptcp_getname (sock, uaddr, peer); + +return ret; +} +#endif +static int mptcp_listen (struct socket *sock,int backlog) {struct mptcp_sock *msk =mptcp_sk (sock->sk);
@@ -983,6 +1007,9 @@ int mptcpv6_init(void) mptcp_v6_stream_ops.bind = mptcp_bind; mptcp_v6_stream_ops.connect = mptcp_stream_connect; mptcp_v6_stream_ops.poll = mptcp_poll; + mptcp_v6_stream_ops.accept = mptcp_stream_accept; + mptcp_v6_stream_ops.getname = mptcp_v6_getname; + mptcp_v6_stream_ops.listen = mptcp_listen; err =inet6_register_protosw (&mptcp_v6_protosw);
net/mptcp/subflow.c +42 -0
68 lines not on this page · raw message
Signature · 1 line
2.17.2
Peter Krystad
PATCH 6/8 mptcp: Add IPv6 support for key generation
In reply to Peter Krystadsquashto: Add key generation and token tree
--- net/mptcp/subflow.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/subflow.c +1 -0
@@ -793,6 +793,7 @@ void mptcp_subflow_init(void) subflow_v6_specific.conn_request = subflow_v6_conn_request; subflow_v6_specific.syn_recv_sock = subflow_syn_recv_sock; subflow_v6_specific.sk_rx_dst_set = subflow_finish_connect; + subflow_v6_specific.rebuild_header = subflow_rebuild_header;#endif if (tcp_register_ulp (&subflow_ulp_ops) !=0 )
Signature · 1 line
2.17.2
Peter Krystad
PATCH 7/8 mptcp: Add IPv6 support for shutdown()
In reply to Peter Krystadsquashto: Add shutdown() socket operation
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -1010,6 +1010,7 @@ int mptcpv6_init(void) mptcp_v6_stream_ops.accept = mptcp_stream_accept; mptcp_v6_stream_ops.getname = mptcp_v6_getname; mptcp_v6_stream_ops.listen = mptcp_listen; + mptcp_v6_stream_ops.shutdown = mptcp_shutdown; err =inet6_register_protosw (&mptcp_v6_protosw);
Signature · 1 line
2.17.2
Peter Krystad
PATCH 8/8 mptcp: Add IPv6 support for new sysctl initialization
In reply to Peter Krystadsquashto: new sysctl to control the activation per NS
--- net/mptcp/ctrl.c | 11 +++++++++++ net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-)
net/mptcp/ctrl.c +11 -0
@@ -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 +1 -1
@@ -999,7 +999,7 @@ static struct inet_protosw mptcp_v6_protosw = { .flags = INET_PROTOSW_ICSK, }; -int mptcpv6_init (void ) +int mptcp_proto_v6_init (void ) {int err;
net/mptcp/protocol.h +3 -0
@@ -232,6 +232,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;
Signature · 1 line
2.17.2
Paolo Abeni
Quoted 13 lines · Peter Krystad
This patchset is a replacement for the single "Add IPv6 Support" commit, with the chunks broken into seperate squash-able commits.
Peter Krystad (8):
mptcp: Add IPv6 support for MPTCP socket stubs
mptcp: Add IPv6 support for Associate MPTCP context
mptcp: Add IPV6 support for outgoing connections
mptcp: Add IPv6 support formptcp_poll
mptcp: Add IPV6 support for incoming connections
mptcp: Add IPv6 support for key generation
mptcp: Add IPv6 support forshutdown()
mptcp: Add IPv6 support for new sysctl initialization
Quoted 7 lines
include/net/mptcp.h | 10 +++++++ net/ipv6/tcp_ipv6.c | 7 +++++ net/mptcp/ctrl.c | 11 ++++++++ net/mptcp/protocol.c | 62 +++++++++++++++++++++++++++++++++++++++++--- net/mptcp/protocol.h | 6 +++++ net/mptcp/subflow.c | 61 +++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 151 insertions(+), 6 deletions(-)
it's hard to verify it without doing the full squash exercise, but the split LGTM.
Thanks!
Paolo
Matthieu Baerts
Hi Peter, Paolo,
Quoted 22 lines · Paolo Abeni
Quoted 13 lines · Peter Krystad
This patchset is a replacement for the single "Add IPv6 Support" commit, with the chunks broken into seperate squash-able commits.
Peter Krystad (8):
mptcp: Add IPv6 support for MPTCP socket stubs
mptcp: Add IPv6 support for Associate MPTCP context
mptcp: Add IPV6 support for outgoing connections
mptcp: Add IPv6 support formptcp_poll
mptcp: Add IPV6 support for incoming connections
mptcp: Add IPv6 support for key generation
mptcp: Add IPv6 support forshutdown()
mptcp: Add IPv6 support for new sysctl initializationQuoted 7 lines
include/net/mptcp.h | 10 +++++++ net/ipv6/tcp_ipv6.c | 7 +++++ net/mptcp/ctrl.c | 11 ++++++++ net/mptcp/protocol.c | 62 +++++++++++++++++++++++++++++++++++++++++--- net/mptcp/protocol.h | 6 +++++ net/mptcp/subflow.c | 61 +++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 151 insertions(+), 6 deletions(-)
Quoted 2 lines
it's hard to verify it without doing the full squash exercise, but the split LGTM.
Thank you for the split and the review!
Also thank you for having put them in the right order for the rebase :)
- 920d3c461f9a: "squashed" patch 1/8 in "mptcp: Add MPTCP socket stubs"
- 6ec9145015c0: "squashed" patch 2/8 in "mptcp: Associate MPTCP context with TCP socket"
- 1c9a07550d4c: "squashed" patch 3/8 in "mptcp: Handle MP_CAPABLE options for outgoing connections"
- 65bea9aec6ac: "squashed" patch 4/8 in "mptcp: add mptcp_poll"
- e353abeb746a: "squashed" patch 5/8 in "mptcp: Create SUBFLOW socket for incoming connections"
- d1f01b804dbd: "squashed" patch 6/8 in "mptcp: Add key generation and token tree"
- 87425a0c3c06: "squashed" patch 7/8 in "mptcp: Add shutdown() socket operation"
- 16fafed481ee: conflict in t/mptcp-Implement-MPTCP-receive-path
- b6522b9ca7cf: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- df91c7f6f3bf: "squashed" patch 8/8 in "mptcp: new sysctl to control the activation per NS"
- e963d103665b: "Signed-off-by" + "Co-developed-by"
- 023d3b14d1b5..ca1c4ffe6b8d: result
After this, "mptcp: Add IPv6 support" is almost empty:
===
net/mptcp/protocol.c +0 -0
@@ -751,10 +751,7 @@ static int mptcp_bind(struct socket *sock, struct
sockaddr *uaddr, int addr_len)
{
struct mptcp_sock *msk = mptcp_sk(sock->sk);
struct socket *ssock;- int err = -ENOTSUPP;
-
- if (uaddr->sa_family != AF_INET) // @@ allow only IPv4 for now
- return err;
+ int err;
ssock = mptcp_socket_create_get(msk);
if (IS_ERR(ssock))===
Can I move this to "mptcp: Create SUBFLOW socket for incoming connections"?
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
Peter Krystad
Quoted 75 lines · Matthieu Baerts
Hi Peter, Paolo,
Quoted 22 lines · Paolo Abeni
Quoted 13 lines · Peter Krystad
This patchset is a replacement for the single "Add IPv6 Support" commit, with the chunks broken into seperate squash-able commits.
Peter Krystad (8):
mptcp: Add IPv6 support for MPTCP socket stubs
mptcp: Add IPv6 support for Associate MPTCP context
mptcp: Add IPV6 support for outgoing connections
mptcp: Add IPv6 support formptcp_poll
mptcp: Add IPV6 support for incoming connections
mptcp: Add IPv6 support for key generation
mptcp: Add IPv6 support forshutdown()
mptcp: Add IPv6 support for new sysctl initializationQuoted 7 lines
include/net/mptcp.h | 10 +++++++ net/ipv6/tcp_ipv6.c | 7 +++++ net/mptcp/ctrl.c | 11 ++++++++ net/mptcp/protocol.c | 62 +++++++++++++++++++++++++++++++++++++++++--- net/mptcp/protocol.h | 6 +++++ net/mptcp/subflow.c | 61 +++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 151 insertions(+), 6 deletions(-)Quoted 2 lines
it's hard to verify it without doing the full squash exercise, but the split LGTM.
Thank you for the split and the review!
Also thank you for having put them in the right order for the rebase :)-
920d3c461f9a: "squashed" patch 1/8 in "mptcp: Add MPTCP socket stubs"
-6ec9145015c0: "squashed" patch 2/8 in "mptcp: Associate MPTCP context with TCP socket"
-1c9a07550d4c: "squashed" patch 3/8 in "mptcp: HandleMP_CAPABLEoptions for outgoing connections"
-65bea9aec6ac: "squashed" patch 4/8 in "mptcp: addmptcp_poll"
-e353abeb746a: "squashed" patch 5/8 in "mptcp: Create SUBFLOW socket for incoming connections"
-d1f01b804dbd: "squashed" patch 6/8 in "mptcp: Add key generation and token tree"
-87425a0c3c06: "squashed" patch 7/8 in "mptcp: Addshutdown()socket operation"
-16fafed481ee: conflict in t/mptcp-Implement-MPTCP-receive-path
-b6522b9ca7cf: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
-df91c7f6f3bf: "squashed" patch 8/8 in "mptcp: new sysctl to control the activation per NS"
-e963d103665b: "Signed-off-by" + "Co-developed-by"
-023d3b14d1b5..ca1c4ffe6b8d: resultAfter this, "mptcp: Add IPv6 support" is almost empty:
===
net/mptcp/protocol.c +1
-4@@ -751,10 +751,7 @@ static int mptcp_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) {struct mptcp_sock *msk =mptcp_sk (sock->sk);struct socket *ssock; -int err = -ENOTSUPP ; - -if (uaddr->sa_family !=AF_INET )// @@ allow only IPv4 for now -return err; +int err; ssock =mptcp_socket_create_get (msk);if (IS_ERR(ssock))
Quoted 3 lines
===
Can I move this to "mptcp: Create SUBFLOW socket for incoming connections"?
That's the "missing chunk", yes merge this change.
Peter.
Quoted 4 lines
Tests are in progress.
Cheers,
Matt
Matthieu Baerts
Hi Peter,
Quoted 1 line · Peter Krystad
On Wed, 2019-11-13 at 21:44 +0100, Matthieu Baerts wrote:
[...]
Quoted 19 lines
Quoted 19 lines
After this, "mptcp: Add IPv6 support" is almost empty:
===
net/mptcp/protocol.c +1
-4@@ -751,10 +751,7 @@ static int mptcp_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) {struct mptcp_sock *msk =mptcp_sk (sock->sk);struct socket *ssock; -int err = -ENOTSUPP ; - -if (uaddr->sa_family !=AF_INET )// @@ allow only IPv4 for now -return err; +int err;
Quoted 8 lines
Quoted 6 lines
net/mptcp/protocol.c +0
-0ssock =mptcp_socket_create_get (msk);if (IS_ERR(ssock))===
Can I move this to "mptcp: Create SUBFLOW socket for incoming connections"?
That's the "missing chunk", yes merge this change.
Thank you, just did:
- 8c31a5e1339b: "squashed" in "mptcp: Create SUBFLOW socket for incoming connections"
- add0d83fe78e..253efd541209: result (empty as expected)
- t/mptcp-Add-IPv6-support is now empty (no longer exported)
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