* [MPTCP] [PATCH 1/8] mptcp: Add IPv6 support for MPTCP socket stubs
@ 2019-11-13 6:45 Peter Krystad
0 siblings, 0 replies; only message in thread
From: Peter Krystad @ 2019-11-13 6:45 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]
squashto: Add MPTCP socket stubs
Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
include/net/mptcp.h | 10 ++++++++++
net/ipv6/tcp_ipv6.c | 7 +++++++
net/mptcp/protocol.c | 19 +++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 535b27f6ba03..cc173e5f7900 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -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 */
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index bae175b57e0f..bcc3bb89938d 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -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:
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 42b33ed6b870..aa8444c2dd71 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -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
--
2.17.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-13 6:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-13 6:45 [MPTCP] [PATCH 1/8] mptcp: Add IPv6 support for MPTCP socket stubs Peter Krystad
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.