IPv6 support
Subsystems (3)
Peter Krystad
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.
Peter Krystad (6):
mptcp: Reference af_ops routines through struct ipv4_specific
mptcp: Re-factor create socket/subflow routines to be af-agnostic
mptcp: Re-factor mptcp_stream_ops routines to be af-agnostic
mptcp: Re-factor subflow routines to be af-agnostic
mptcp: Export low-level routines for IPv6
mptcp: Add IPv6 support
include/net/mptcp.h | 3 + include/net/tcp.h | 3 + net/ipv6/tcp_ipv6.c | 16 +++- net/mptcp/ctrl.c | 11 +++ net/mptcp/protocol.c | 174 +++++++++++++++++++++++++++++++-------- net/mptcp/protocol.h | 9 +- net/mptcp/subflow.c | 191 +++++++++++++++++++++++++++++++++++++------ 7 files changed, 342 insertions(+), 65 deletions(-)
Signature · 1 line
2.17.2
Peter Krystad
PATCH 1/6 mptcp: Reference af_ops routines through struct ipv4_specific
Make this look similar to how it will have to be done for IPv6, as the IPv6 routines are declared static and thus not visible.
--- net/mptcp/subflow.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/mptcp/subflow.c +6 -5
@@ -25,6 +25,8 @@ static inline void SUBFLOW_REQ_INC_STATS(struct request_sock *req,MPTCP_INC_STATS (sock_net (req_to_sk (req)), field); } +static struct inet_connection_sock_af_ops subflow_specific; +static int subflow_rebuild_header (struct sock *sk) {struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);
@@ -45,7 +47,7 @@ static int subflow_rebuild_header(struct sock *sk)if (err)return err; -return inet_sk_rebuild_header (sk); +return ipv4_specific.rebuild_header (sk); }static void subflow_req_destructor (struct request_sock *req)
@@ -169,7 +171,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); + ipv4_specific.sk_rx_dst_set (sk, skb);if (!subflow->conn)return ;
@@ -276,7 +278,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 = ipv4_specific.syn_recv_sock (sk, skb, req, dst, req_unhash, + own_req);if (child && *own_req) {struct mptcp_subflow_context *ctx =mptcp_subflow_ctx (child);
@@ -309,8 +312,6 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,return NULL ; } -static struct inet_connection_sock_af_ops subflow_specific; -enum mapping_status {MAPPING_OK ,MAPPING_INVALID ,
Signature · 1 line
2.17.2
Paolo Abeni
[MPTCP] Re: [PATCH 1/6] mptcp: Reference af_ops routines through struct ipv4_specific
Quoted 4 lines · Peter Krystad
Make this look similar to how it will have to be done for IPv6, as the IPv6 routines are declared static and thus not visible.
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
I think:
- 'subflow_finish_connect()' and 'inet_connection_sock_af_ops subflow_specific;' changes should be squashed into "mptcp: Handle MP_CAPABLE options for outgoing connections"
- 'subflow_syn_recv_sock()' into "mptcp: Create SUBFLOW socket for incoming connections"
- 'inet_sk_rebuild_head()' into "mptcp: Add key generation and token tree"
right?
/P
Peter Krystad
[MPTCP] Re: [PATCH 1/6] mptcp: Reference af_ops routines through struct ipv4_specific
Quoted 15 lines · Paolo Abeni
Quoted 4 lines · Peter Krystad
Make this look similar to how it will have to be done for IPv6, as the IPv6 routines are declared static and thus not visible.
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>I think:
- '
subflow_finish_connect()' and 'inet_connection_sock_af_opssubflow_specific;' changes should be squashed into "mptcp: HandleMP_CAPABLEoptions for outgoing connections"- '
subflow_syn_recv_sock()' into "mptcp: Create SUBFLOW socket for incoming connections"
Quoted 7 lines
- '
inet_sk_rebuild_head()' into "mptcp: Add key generation and token tree"right?
/P
In the v2 patchset I am going to modify this change. We will save a pointer to the original af_icsk_ops structure and call the inet_xxx routines through it. This will save a lot of code duplication for IPv6.
The change will squash to the same commits you identify above.
Peter.
Peter Krystad
PATCH 2/6 mptcp: Re-factor create socket/subflow routines to be af-agnostic
In reply to Peter KrystadRe-factor mptcp_subflow_create_socket() and mptcp_socket_create_get() to work for both IPv4 and IPv6.
squashto: Associate MPTCP context with TCP socket
--- net/mptcp/protocol.c | 11 ++++++----- net/mptcp/protocol.h | 3 ++- net/mptcp/subflow.c | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-)
net/mptcp/protocol.c +6 -5
@@ -1072,7 +1072,8 @@ static struct proto mptcp_prot = { .no_autobind = 1, }; -static struct socket *mptcp_socket_create_get (struct mptcp_sock *msk) +static struct socket *mptcp_socket_create_get (struct mptcp_sock *msk, +sa_family_t family) {struct mptcp_subflow_context *subflow;struct sock *sk = (struct sock *)msk;
@@ -1084,7 +1085,7 @@ static struct socket *mptcp_socket_create_get(struct mptcp_sock *msk)if (ssock) goto release; - err =mptcp_subflow_create_socket (sk, &ssock); + err =mptcp_subflow_create_socket (sk, family, &ssock);if (err) { ssock =ERR_PTR (err); goto release;
@@ -1112,7 +1113,7 @@ static int mptcp_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)if (uaddr->sa_family !=AF_INET )// @@ allow only IPv4 for now return err; - ssock =mptcp_socket_create_get (msk); + ssock =mptcp_socket_create_get (msk,AF_INET );if (IS_ERR (ssock))return PTR_ERR (ssock);
@@ -1131,7 +1132,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,if (uaddr->sa_family !=AF_INET )// @@ allow only IPv4 for now return err; - ssock =mptcp_socket_create_get (msk); + ssock =mptcp_socket_create_get (msk,AF_INET );if (IS_ERR (ssock))return PTR_ERR (ssock);
@@ -1193,7 +1194,7 @@ static int mptcp_listen(struct socket *sock, int backlog)pr_debug ("msk=%p" , msk); - ssock =mptcp_socket_create_get (msk); + ssock =mptcp_socket_create_get (msk,AF_INET );if (IS_ERR (ssock))return PTR_ERR (ssock);
net/mptcp/protocol.h +2 -1
@@ -266,7 +266,8 @@ bool mptcp_subflow_data_available(struct sock *sk);void mptcp_subflow_init (void );int mptcp_subflow_connect (struct sock *sk,struct sockaddr *local,struct sockaddr *remote,u8 remote_id); -int mptcp_subflow_create_socket (struct sock *sk,struct socket **new_sock); +int mptcp_subflow_create_socket (struct sock *sk,sa_family_t family, +struct socket **new_sock);extern const struct inet_connection_sock_af_ops ipv4_specific;
net/mptcp/subflow.c +4 -3
@@ -632,7 +632,7 @@ int mptcp_subflow_connect(struct sock *sk, struct sockaddr *local,int err;lock_sock (sk); - err =mptcp_subflow_create_socket (sk, &sf); + err =mptcp_subflow_create_socket (sk, local->sa_family, &sf);if (err) {release_sock (sk);return err;
@@ -675,14 +675,15 @@ int mptcp_subflow_connect(struct sock *sk, struct sockaddr *local,return err; } -int mptcp_subflow_create_socket (struct sock *sk,struct socket **new_sock) +int mptcp_subflow_create_socket (struct sock *sk,sa_family_t family, +struct socket **new_sock) {struct mptcp_subflow_context *subflow;struct net *net =sock_net (sk);struct socket *sf;int err; - err =sock_create_kern (net,PF_INET ,SOCK_STREAM ,IPPROTO_TCP , &sf); + err =sock_create_kern (net, family,SOCK_STREAM ,IPPROTO_TCP , &sf);if (err)return err;
Signature · 1 line
2.17.2
Peter Krystad
PATCH 3/6 mptcp: Re-factor mptcp_stream_ops routines to be af-agnostic
In reply to Peter KrystadSplit mptcp_bind/getname/listen into two parts: af-specific part and functional part.
squashto: Associate MPTCP context with TCP socket (mptcp_bind) and Create SUBFLOW socket for incoming connections (rest)
--- net/mptcp/protocol.c | 84 +++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 28 deletions(-)
net/mptcp/protocol.c +56 -28
@@ -1104,24 +1104,32 @@ static struct socket *mptcp_socket_create_get(struct mptcp_sock *msk,return ssock; } -static int mptcp_bind (struct socket *sock,struct sockaddr *uaddr,int addr_len) +static int mptcp_bind (struct socket *sock,struct sockaddr *uaddr,int addr_len, +sa_family_t family,const struct proto_ops *ops) {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,AF_INET ); + ssock =mptcp_socket_create_get (msk, family);if (IS_ERR (ssock))return PTR_ERR (ssock); - err =inet_bind (ssock, uaddr, addr_len); + err = ops->bind (ssock, uaddr, addr_len);sock_put (ssock->sk);return err; } +static int mptcp_v4_bind (struct socket *sock,struct sockaddr *uaddr, +int addr_len) +{ +int err; + + err =mptcp_bind (sock, uaddr, addr_len,AF_INET , &inet_stream_ops); + +return err; +} +static int mptcp_stream_connect (struct socket *sock,struct sockaddr *uaddr,int addr_len,int flags) {
@@ -1142,31 +1150,19 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, }static int mptcp_getname (struct socket *sock,struct sockaddr *uaddr, -int peer) +int peer,const struct proto_ops *ops) {struct mptcp_sock *msk =mptcp_sk (sock->sk);struct socket *ssock;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 inet_getname (sock, uaddr, peer); - } -lock_sock (sock->sk); ssock =__mptcp_fallback_get_ref (msk);if (ssock) {release_sock (sock->sk);pr_debug ("subflow=%p" , ssock->sk); - ret =inet_getname (ssock, uaddr, peer); + ret = ops->getname (ssock, uaddr, peer);sock_put (ssock->sk);return ret; }
@@ -1181,12 +1177,35 @@ static int mptcp_getname(struct socket *sock, struct sockaddr *uaddr,return -ENOTCONN ; } - ret =inet_getname (ssk->sk_socket, uaddr, peer); + ret = ops->getname (ssk->sk_socket, uaddr, peer);release_sock (sock->sk);return ret; } -static int mptcp_listen (struct socket *sock,int backlog) +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 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 = &inet_stream_ops; +return sock->ops->getname (sock, uaddr, peer); + } + + ret =mptcp_getname (sock, uaddr, peer, &inet_stream_ops); + +return ret; +} + +static int mptcp_listen (struct socket *sock,int backlog,sa_family_t family, +const struct proto_ops *ops) {struct mptcp_sock *msk =mptcp_sk (sock->sk);struct socket *ssock;
@@ -1194,15 +1213,24 @@ static int mptcp_listen(struct socket *sock, int backlog)pr_debug ("msk=%p" , msk); - ssock =mptcp_socket_create_get (msk,AF_INET ); + ssock =mptcp_socket_create_get (msk, family);if (IS_ERR (ssock))return PTR_ERR (ssock); - err =inet_listen (ssock, backlog); + err = ops->listen (ssock, backlog);sock_put (ssock->sk);return err; } +static int mptcp_v4_listen (struct socket *sock,int backlog) +{ +int ret; + + ret =mptcp_listen (sock, backlog,AF_INET , &inet_stream_ops); + +return ret; +} +static int mptcp_stream_accept (struct socket *sock,struct socket *newsock,int flags,bool kern) {
@@ -1298,12 +1326,12 @@ void mptcp_proto_init(void) { mptcp_prot.h.hashinfo = tcp_prot.h.hashinfo; mptcp_stream_ops = inet_stream_ops; - mptcp_stream_ops.bind = mptcp_bind; + mptcp_stream_ops.bind = mptcp_v4_bind; 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.listen = mptcp_listen; + mptcp_stream_ops.getname = mptcp_v4_getname; + mptcp_stream_ops.listen = mptcp_v4_listen; mptcp_stream_ops.shutdown = mptcp_shutdown;if (percpu_counter_init (&mptcp_sockets_allocated,0 ,GFP_KERNEL ))
Signature · 1 line
2.17.2
Peter Krystad
PATCH 4/6 mptcp: Re-factor subflow routines to be af-agnostic
In reply to Peter KrystadRe-factor subflow_rebuild_header, init_req, conn_request, syn_recv_sock, and finish_connect to separate af-specific and functional parts.
squash unfortunately is complicated:subflow_v4_finish_connect: Handle MP_CAPABLE options for outgoing...subflow_v4_rebuild_header: Add key generation and token tree subflow_v4_conn_request,subflow_v4_syn_recv_sock,subflow_v4_init_req: Create SUBFLOW socket for incoming connections
--- net/mptcp/subflow.c | 76 +++++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 20 deletions(-)
net/mptcp/subflow.c +56 -20
@@ -25,7 +25,7 @@ static inline void SUBFLOW_REQ_INC_STATS(struct request_sock *req,MPTCP_INC_STATS (sock_net (req_to_sk (req)), field); } -static struct inet_connection_sock_af_ops subflow_specific; +static struct inet_connection_sock_af_ops subflow_v4_specific;static int subflow_rebuild_header (struct sock *sk) {
@@ -44,6 +44,14 @@ static int subflow_rebuild_header(struct sock *sk) }while (!subflow->local_nonce); } +return err; +} + +static int subflow_v4_rebuild_header (struct sock *sk) +{ +int err; + + err =subflow_rebuild_header (sk);if (err)return err;
@@ -92,19 +100,14 @@ 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);
@@ -148,6 +151,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) {
@@ -171,8 +185,6 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) {struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk); - ipv4_specific.sk_rx_dst_set (sk, skb); -if (!subflow->conn)return ;
@@ -207,10 +219,18 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) } } +static void subflow_v4_finish_connect (struct sock *sk, +const struct sk_buff *skb) +{ + ipv4_specific.sk_rx_dst_set (sk, skb); + +subflow_finish_connect (sk, 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);
@@ -259,7 +279,8 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,struct request_sock *req, struct dst_entry *dst, struct request_sock *req_unhash, - bool *own_req) + bool *own_req, + const struct inet_connection_sock_af_ops *af_ops) { struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);struct mptcp_subflow_request_sock *subflow_req;
@@ -278,7 +299,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,return NULL ; } - child = ipv4_specific.syn_recv_sock (sk, skb, req, dst, req_unhash, + child = af_ops->syn_recv_sock (sk, skb, req, dst, req_unhash, own_req);if (child && *own_req) {
@@ -312,6 +333,21 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,return NULL ; } +static struct sock *subflow_v4_syn_recv_sock (const struct sock *sk, +struct sk_buff *skb, +struct request_sock *req, +struct dst_entry *dst, +struct request_sock *req_unhash, +bool *own_req) +{ +struct sock *child; + + child =subflow_syn_recv_sock (sk, skb, req, dst, req_unhash, own_req, + &ipv4_specific); + +return child; +} +enum mapping_status {MAPPING_OK ,MAPPING_INVALID ,
@@ -770,7 +806,7 @@ static int subflow_ulp_init(struct sock *sk)pr_debug ("subflow=%p" , ctx); tp->is_mptcp =1 ; - icsk->icsk_af_ops = &subflow_specific; + icsk->icsk_af_ops = &subflow_v4_specific; ctx->tcp_sk_data_ready = sk->sk_data_ready; sk->sk_data_ready = subflow_data_ready; sk->sk_write_space = subflow_write_space;
@@ -862,11 +898,11 @@ void mptcp_subflow_init(void) subflow_request_sock_ipv4_ops = tcp_request_sock_ipv4_ops; subflow_request_sock_ipv4_ops.init_req = subflow_v4_init_req; - subflow_specific = ipv4_specific; - subflow_specific.conn_request = subflow_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; + subflow_v4_specific = ipv4_specific; + subflow_v4_specific.conn_request = subflow_v4_conn_request; + subflow_v4_specific.syn_recv_sock = subflow_v4_syn_recv_sock; + subflow_v4_specific.sk_rx_dst_set = subflow_v4_finish_connect; + subflow_v4_specific.rebuild_header = subflow_v4_rebuild_header;mptcp_diag_subflow_init (&subflow_ulp_ops);
Signature · 1 line
2.17.2
Peter Krystad
PATCH 5/6 mptcp: Export low-level routines for IPv6
In reply to Peter Krystadipv6_specific and tcp_request_sock_ipv6_ops will be referenced during TCP subflow creation.
squashto: tcp: Export TCP functions and ops
--- 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
@@ -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
@@ -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
@@ -270,6 +270,9 @@ int mptcp_subflow_create_socket(struct sock *sk, sa_family_t family, struct socket **new_sock);extern const struct inet_connection_sock_af_ops ipv4_specific; +#if IS_ENABLED (CONFIG_IPV6 ) +extern const struct inet_connection_sock_af_ops ipv6_specific; +#endif void mptcp_proto_init (void );
Signature · 1 line
2.17.2
Paolo Abeni
[MPTCP] Re: [PATCH 5/6] mptcp: Export low-level routines for IPv6
Hi,
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 ?
Cheers,
Paolo
Peter Krystad
[MPTCP] Re: [PATCH 5/6] mptcp: Export low-level routines for IPv6
Quoted 7 lines · Paolo Abeni
Hi,
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 ?
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.
Peter.
Quoted 4 lines
Cheers,
Paolo
Peter Krystad
PATCH 6/6 mptcp: Add IPv6 support
In reply to Peter KrystadMimic hooks and option handling for IPv6 as was done for IPv4 MPTCP sockets.
--- include/net/mptcp.h | 3 ++ net/ipv6/tcp_ipv6.c | 7 +++ net/mptcp/ctrl.c | 11 +++++ net/mptcp/protocol.c | 85 ++++++++++++++++++++++++++++++++-- net/mptcp/protocol.h | 3 ++ net/mptcp/subflow.c | 107 ++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 209 insertions(+), 7 deletions(-)
include/net/mptcp.h +3 -0
@@ -53,6 +53,9 @@ struct mptcp_out_options {#ifdef CONFIG_MPTCP void mptcp_init (void ); +#if IS_ENABLED (CONFIG_IPV6 ) +int mptcpv6_init (void ); +#endif static inline bool sk_is_mptcp (const struct sock *sk) {
net/ipv6/tcp_ipv6.c +7 -0
@@ -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
@@ -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_IPV6 ) +int __init mptcpv6_init (void ) +{ +int err; + + err =mptcp_proto_v6_init (); + +return err; +} +#endif
net/mptcp/protocol.c +80 -5
118 lines not on this page · raw message
net/mptcp/protocol.h +3 -0
@@ -275,6 +275,9 @@ extern const struct inet_connection_sock_af_ops ipv6_specific;#endif void mptcp_proto_init (void ); +#if IS_ENABLED (CONFIG_IPV6 ) +int mptcp_proto_v6_init (void ); +#endif struct mptcp_read_arg {struct msghdr *msg;
net/mptcp/subflow.c +105 -2
163 lines not on this page · raw message
Signature · 1 line
2.17.2
Davide Caratti
[MPTCP] Re: [PATCH 6/6] mptcp: Add IPv6 support
hello Peter!
Quoted 18 lines · Peter Krystad
Mimic hooks and option handling for IPv6 as was done for IPv4 MPTCP sockets.
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>--- include/net/mptcp.h | 3 ++ net/ipv6/tcp_ipv6.c | 7 +++ net/mptcp/ctrl.c | 11 +++++ net/mptcp/protocol.c | 85 ++++++++++++++++++++++++++++++++-- net/mptcp/protocol.h | 3 ++ net/mptcp/subflow.c | 107 ++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 209 insertions(+), 7 deletions(-)include/net/mptcp.h +0
-0
include/net/mptcp.h struct mptcp_out_options { · line 58
Quoted 6 lines
include/net/mptcp.h +3
-0@@ -53,6 +53,9 @@ struct mptcp_out_options {#ifdef CONFIG_MPTCP void mptcp_init (void ); +#if IS_ENABLED (CONFIG_IPV6 ) +int mptcpv6_init (void ); +#endif
I didn't see a stub version of mptcpv6_init(),
Quoted 7 lines
include/net/mptcp.h +0
-0static inline bool sk_is_mptcp (const struct sock *sk) {net/ipv6/tcp_ipv6.c +0
-0
net/ipv6/tcp_ipv6.c int __init tcpv6_init(void) · line 2118
Quoted 10 lines
net/ipv6/tcp_ipv6.c +5
-0@@ -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;
so probably the above hunk will cause build problems when CONFIG_MPTCP is unset. Am I missing something?
thanks!
Signature · 1 line
davide
Peter Krystad
[MPTCP] Re: [PATCH 6/6] mptcp: Add IPv6 support
Quoted 42 lines · Davide Caratti
hello Peter!
Quoted 18 lines · Peter Krystad
Mimic hooks and option handling for IPv6 as was done for IPv4 MPTCP sockets.
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>--- include/net/mptcp.h | 3 ++ net/ipv6/tcp_ipv6.c | 7 +++ net/mptcp/ctrl.c | 11 +++++ net/mptcp/protocol.c | 85 ++++++++++++++++++++++++++++++++-- net/mptcp/protocol.h | 3 ++ net/mptcp/subflow.c | 107 ++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 209 insertions(+), 7 deletions(-)include/net/mptcp.h +0
-0include/net/mptcp.h struct mptcp_out_options { · line 58
Quoted 6 lines
include/net/mptcp.h +3
-0@@ -53,6 +53,9 @@ struct mptcp_out_options {#ifdef CONFIG_MPTCP void mptcp_init (void ); +#if IS_ENABLED (CONFIG_IPV6 ) +int mptcpv6_init (void ); +#endif I didn't see a stub version of
mptcpv6_init(),Quoted 12 lines
include/net/mptcp.h +0
-0static inline bool sk_is_mptcp (const struct sock *sk) {net/ipv6/tcp_ipv6.c +2
-0@@ -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 ();
Quoted 8 lines
net/ipv6/tcp_ipv6.c int __init tcpv6_init(void) · line 2118
Quoted 5 lines
net/ipv6/tcp_ipv6.c +3
-0+if (ret) + goto out_tcpv6_pernet_subsys; + out:return ret;so probably the above hunk will cause build problems when
CONFIG_MPTCPis unset. Am I missing something?
Nope, you are right. I will fix this in v2.
Peter.
Quoted 2 lines
thanks!
Paolo Abeni
Quoted 1 line · Peter Krystad
Implemented support for IPv6. selftests pass with ipv6=true,
Nice!
Quoted 1 line
but they take twice as long to run...
Yep, that is expected, right? ;)
Quoted 3 lines
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.
We still need the Kconfig boilerplate, right? something alike:
---
net/mptcp/Kconfig +0 -0
@@ -9,3 +9,8 @@ config MPTCP uses the TCP protocol, and TCP options carry header
information for
MPTCP.
+config MPTCP_IPV6
+ bool "IPv6 support form Multipath TCP" + depends on MPTCP + select IPV6 + default y
---
and than replace IS_ENABLED(IPV6) with CONFIG_MPTCP_IPV6.
Additinal question: what happens if ipv6 is disabled at boot time (ipv6.disable=1 on the kernel command line)?
Thanks,
Paolo
Peter Krystad
Hi Paolo -
Quoted 8 lines · Paolo Abeni
Quoted 1 line · Peter Krystad
Implemented support for IPv6. selftests pass with ipv6=true,
Nice!
Quoted 1 line
but they take twice as long to run...
Yep, that is expected, right? ;)
Right.
Quoted 24 lines
Quoted 4 lines
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.
We still need the
Kconfigboilerplate, right? something alike:---
net/mptcp/Kconfig +0
-0@@ -9,3 +9,8 @@ config MPTCP uses the TCP protocol, and TCP options carry headerinformation for
MPTCP.net/mptcp/Kconfig +5
-1+config MPTCP_IPV6 + bool "IPv6 support form Multipath TCP" + depends on MPTCP + select IPV6 + default y ---
Quoted 1 line
and than replace
IS_ENABLED(IPV6)withCONFIG_MPTCP_IPV6.
Indeed we do, I will submit a patchset that does that will need to be merged before the v2 IPv6 patchset (coming tomorrow).
Quoted 2 lines
Additinal question: what happens if ipv6 is disabled at boot time (ipv6.disable=1 on the kernel command line)?
I believe the initialization in inet6_init() will not run and it will not be possible to create a socket in the AF_INET6 domain.
Peter.
Quoted 4 lines
Thanks,
Paolo