@@ -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);
@@ -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");
}
squashto: Handle MP_CAPABLE options for outgoing connections Signed-off-by: Peter Krystad <peter.krystad@linux.intel.com> --- net/mptcp/protocol.h | 3 +++ net/mptcp/subflow.c | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-)