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 v2 2/2] mptcp: Use correct address family when creating subflows
Date: Tue, 29 Oct 2019 09:55:57 -0700	[thread overview]
Message-ID: <20191029165557.7029-3-peter.krystad@linux.intel.com> (raw)
In-Reply-To: 20191029165557.7029-1-peter.krystad@linux.intel.com

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

Ensure that the address family of the remote address
matches the local address when binding additional subflow
sockets.

Also, only send ADD_ADDR for addresses in the same family
as the initial listening MPTCP socket.

squashto: Implement basic path manager

Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/basic.c | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/net/mptcp/basic.c b/net/mptcp/basic.c
index d2fd0560c136..67a93aff500e 100644
--- a/net/mptcp/basic.c
+++ b/net/mptcp/basic.c
@@ -189,11 +189,15 @@ static void announce_addr_worker(struct work_struct *work)
 
 	pernet = net_generic(sock_net((struct sock *)msk), basic_pernet_id);
 
-	if (pernet->has_announce_v4)
+	/* Only announce addresses in the same family as listening socket.
+	 * When the listening socket can accept connections from both
+	 * families this restriction may be removed.
+	 */
+	if (pernet->has_announce_v4 && msk->family == AF_INET)
 		mptcp_pm_announce_addr(pm->token, 1,
 				       &pernet->announce_v4_addr);
 #if IS_ENABLED(CONFIG_IPV6)
-	if (pernet->has_announce_v6)
+	else if (pernet->has_announce_v6 && msk->family == AF_INET6)
 		mptcp_pm_announce_addr6(pm->token, 1,
 					&pernet->announce_v6_addr);
 #endif
@@ -209,19 +213,23 @@ static void create_subflow_worker(struct work_struct *work)
 
 	pernet = net_generic(sock_net((struct sock *)msk), basic_pernet_id);
 
-	if (pernet->has_announce_v4)
-		mptcp_pm_create_subflow(pm->token, pm->remote_id,
-					&pernet->announce_v4_addr);
-#if IS_ENABLED(CONFIG_IPV6)
-	else if (pernet->has_announce_v6)
-		mptcp_pm_create_subflow6(pm->token, pm->remote_id,
-					 &pernet->announce_v6_addr);
-#endif
-	else if (pm->local_family == AF_INET)
-		mptcp_pm_create_subflow(pm->token, pm->remote_id, NULL);
+	if (pm->remote_family == AF_INET) {
+		if (pernet->has_announce_v4)
+			mptcp_pm_create_subflow(pm->token, pm->remote_id,
+						&pernet->announce_v4_addr);
+		else
+			mptcp_pm_create_subflow(pm->token, pm->remote_id,
+						NULL);
+	}
 #if IS_ENABLED(CONFIG_IPV6)
-	else
-		mptcp_pm_create_subflow6(pm->token, pm->remote_id, NULL);
+	else if (pm->remote_family == AF_INET6) {
+		if (pernet->has_announce_v6)
+			mptcp_pm_create_subflow6(pm->token, pm->remote_id,
+						 &pernet->announce_v6_addr);
+		else
+			mptcp_pm_create_subflow6(pm->token, pm->remote_id,
+						 NULL);
+	}
 #endif
 
 	sock_put((struct sock *)msk);
-- 
2.17.2

                 reply	other threads:[~2019-10-29 16:55 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=20191029165557.7029-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.