All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH 1/5] mptcp: Update path manager interface for IPv6
@ 2019-10-15 23:06 Peter Krystad
  0 siblings, 0 replies; only message in thread
From: Peter Krystad @ 2019-10-15 23:06 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 3671 bytes --]

squashto: Add path manager interface

Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/pm.c       | 35 +++++++++++++++++++++++++++--------
 net/mptcp/protocol.h | 11 +++++++----
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index f20377c869ad..bc46a0ddd396 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -10,8 +10,7 @@
 
 /* path manager command handlers */
 
-int mptcp_pm_announce_addr(u32 token, u8 local_id, sa_family_t family,
-			   struct in_addr *addr)
+int mptcp_pm_announce_addr(u32 token, u8 local_id, struct in_addr *addr)
 {
 	struct mptcp_sock *msk = mptcp_token_get_sock(token);
 	int err = 0;
@@ -36,6 +35,13 @@ int mptcp_pm_announce_addr(u32 token, u8 local_id, sa_family_t family,
 	return err;
 }
 
+#if IS_ENABLED(CONFIG_IPV6)
+int mptcp_pm_announce_addr6(u32 token, u8 local_id, struct in6_addr *addr)
+{
+	return -ENOTSUPP;
+}
+#endif
+
 int mptcp_pm_remove_addr(u32 token, u8 local_id)
 {
 	struct mptcp_sock *msk = mptcp_token_get_sock(token);
@@ -50,8 +56,7 @@ int mptcp_pm_remove_addr(u32 token, u8 local_id)
 	return 0;
 }
 
-int mptcp_pm_create_subflow(u32 token, u8 remote_id, sa_family_t family,
-			    struct in_addr *addr)
+int mptcp_pm_create_subflow(u32 token, u8 remote_id, struct in_addr *addr)
 {
 	struct mptcp_sock *msk = mptcp_token_get_sock(token);
 	struct sockaddr_in remote;
@@ -87,6 +92,13 @@ int mptcp_pm_create_subflow(u32 token, u8 remote_id, sa_family_t family,
 	return err;
 }
 
+#if IS_ENABLED(CONFIG_IPV6)
+int mptcp_pm_create_subflow6(u32 token, u8 remote_id, struct in6_addr *addr)
+{
+	return -ENOTSUPP;
+}
+#endif
+
 int mptcp_pm_remove_subflow(u32 token, u8 remote_id)
 {
 	return -ENOTSUPP;
@@ -160,16 +172,23 @@ int mptcp_pm_addr_signal(struct mptcp_sock *msk, u8 *id,
 			 struct sockaddr_storage *saddr)
 {
 	struct sockaddr_in *addr = (struct sockaddr_in *)saddr;
+	struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)saddr;
 
 	if (!msk->pm.local_valid)
 		return -1;
 
-	if (msk->pm.local_family != AF_INET)
+	if (msk->pm.local_family == AF_INET) {
+		addr->sin_family = msk->pm.local_family;
+		addr->sin_addr = msk->pm.local_addr;
+#if IS_ENABLED(CONFIG_IPV6)
+	} else if (msk->pm.local_family == AF_INET6) {
+		addr6->sin6_family = msk->pm.local_family;
+		addr6->sin6_addr = msk->pm.local_addr6;
+#endif
+	} else {
 		return -1;
-
+	}
 	*id = msk->pm.local_id;
-	addr->sin_family = msk->pm.local_family;
-	addr->sin_addr.s_addr = msk->pm.local_addr.s_addr;
 
 	return 0;
 }
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index d81d6bf18a65..2bfcb65c7c0a 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -297,10 +297,13 @@ void mptcp_pm_add_addr(struct mptcp_sock *msk, const struct in_addr *addr,
 		       u8 id);
 void mptcp_pm_add_addr6(struct mptcp_sock *msk, const struct in6_addr *addr,
 			u8 id);
-int mptcp_pm_announce_addr(u32 token, u8 local_id, sa_family_t family,
-			   struct in_addr *addr);
-int mptcp_pm_create_subflow(u32 token, u8 remote_id, sa_family_t family,
-			    struct in_addr *addr);
+
+int mptcp_pm_announce_addr(u32 token, u8 local_id, struct in_addr *addr);
+int mptcp_pm_create_subflow(u32 token, u8 remote_id, struct in_addr *addr);
+#if IS_ENABLED(CONFIG_IPV6)
+int mptcp_pm_announce_addr6(u32 token, u8 local_id, struct in6_addr *addr);
+int mptcp_pm_create_subflow6(u32 token, u8 remote_id, struct in6_addr *addr);
+#endif
 int mptcp_pm_remove_addr(u32 token, u8 local_id);
 int mptcp_pm_remove_subflow(u32 token, u8 remote_id);
 
-- 
2.17.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-15 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 23:06 [MPTCP] [PATCH 1/5] mptcp: Update path manager interface for IPv6 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.