All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Krystad <peter.krystad at linux.intel.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH 2/5] mptcp: Add missing ADD_ADDR handling
Date: Tue, 15 Oct 2019 16:06:10 -0700	[thread overview]
Message-ID: <20191015230613.16981-3-peter.krystad@linux.intel.com> (raw)
In-Reply-To: 20191015230613.16981-1-peter.krystad@linux.intel.com

[-- 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

                 reply	other threads:[~2019-10-15 23:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191015230613.16981-3-peter.krystad@linux.intel.com \
    --to=unknown@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.