All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH 2/5] mptcp: Add missing ADD_ADDR handling
@ 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: 1452 bytes --]

Add missing piece that copies IPv6 address into TCP option

squashto: Add ADD_ADDR handling

Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/options.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 4bb3766fce5e..a63137b73557 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -463,14 +463,22 @@ static bool mptcp_established_options_addr(struct sock *sk,
 	if (mptcp_pm_addr_signal(msk, &id, &saddr))
 		return false;
 
-	if (saddr.ss_family == AF_INET && remaining < TCPOLEN_MPTCP_ADD_ADDR)
-		return false;
-
-	opts->suboptions |= OPTION_MPTCP_ADD_ADDR;
-	opts->addr_id = id;
-	opts->addr.s_addr = ((struct sockaddr_in *)&saddr)->sin_addr.s_addr;
-	*size = TCPOLEN_MPTCP_ADD_ADDR;
-
+	if (saddr.ss_family == AF_INET) {
+		if (remaining < TCPOLEN_MPTCP_ADD_ADDR)
+			return false;
+		opts->suboptions |= OPTION_MPTCP_ADD_ADDR;
+		opts->addr_id = id;
+		opts->addr = ((struct sockaddr_in *)&saddr)->sin_addr;
+		*size = TCPOLEN_MPTCP_ADD_ADDR;
+	}
+	if (saddr.ss_family == AF_INET6) {
+		if (remaining < TCPOLEN_MPTCP_ADD_ADDR6)
+			return false;
+		opts->suboptions |= OPTION_MPTCP_ADD_ADDR6;
+		opts->addr_id = id;
+		opts->addr6 = ((struct sockaddr_in6 *)&saddr)->sin6_addr;
+		*size = TCPOLEN_MPTCP_ADD_ADDR6;
+	}
 	msk->addr_signal = 0;
 
 	return true;
-- 
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 2/5] mptcp: Add missing ADD_ADDR handling 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.