All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [MPTCP] [PATCH v3 01/10] Extend path manager interface
@ 2019-08-23 18:05 Matthieu Baerts
  0 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2019-08-23 18:05 UTC (permalink / raw)
  To: mptcp

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

Hi Peter,

On 23/08/2019 00:31, Peter Krystad wrote:
> 
> Hi Matthieu -
> 
> It seems a hunk went missing when this was split and squashed. The following
> piece of code from this patch does not appear in mptcp_incoming_options() in
> the current export branch as I would expect to.
> 
> +       if (msk && mp_opt->add_addr) {
> +               if (mp_opt->family == MPTCP_ADDR_IPVERSION_4)
> +                       pm_add_addr(msk, &mp_opt->addr, mp_opt->addr_id);
> +#if IS_ENABLED(CONFIG_IPV6)
> +               else if (mp_opt->family == MPTCP_ADDR_IPVERSION_6)
> +                       pm_add_addr6(msk, &mp_opt->addr6, mp_opt->addr_id);
> +#endif
> +               mp_opt->add_addr = 0;
> +       }
> +
> 
> This causes the received ADD_ADDR option to not be passed up to the path
> manager. I'll send a patch.

Oh sorry, I thought I carefully checked that everything was there. I
will apply this missing part ASAP!

Cheers,
Matt
-- 
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [MPTCP] [PATCH v3 01/10] Extend path manager interface
@ 2019-08-22 22:31 Peter Krystad
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Krystad @ 2019-08-22 22:31 UTC (permalink / raw)
  To: mptcp

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


Hi Matthieu -

It seems a hunk went missing when this was split and squashed. The following
piece of code from this patch does not appear in mptcp_incoming_options() in
the current export branch as I would expect to.

+       if (msk && mp_opt->add_addr) {
+               if (mp_opt->family == MPTCP_ADDR_IPVERSION_4)
+                       pm_add_addr(msk, &mp_opt->addr, mp_opt->addr_id);
+#if IS_ENABLED(CONFIG_IPV6)
+               else if (mp_opt->family == MPTCP_ADDR_IPVERSION_6)
+                       pm_add_addr6(msk, &mp_opt->addr6, mp_opt->addr_id);
+#endif
+               mp_opt->add_addr = 0;
+       }
+

This causes the received ADD_ADDR option to not be passed up to the path
manager. I'll send a patch.

Peter.




On Mon, 2019-08-12 at 21:35 +0200, Matthieu Baerts wrote:
> Hi Peter, Paolo, Mat,
> 
> On 08/08/2019 00:44, Peter Krystad wrote:
> > A little more functionality and some comments clarifying
> > which routines are for a path manager to call and which are
> > callbacks.
> > 
> > squashto: Add path manager interface
> 
> Thank you for the patch and the reviews!
> 
> I had to split this patch in 2 parts:
> - c8625a37c692: part 1: "squashed" in "mptcp: Add path manager interface"
> - 4412b8e8e6c9: conflict in t/mptcp-Add-ADD_ADDR-handling
> - 0757aec1b6f2: part 2: "squashed" in "mptcp: Add ADD_ADDR handling"
> - b1477322bbb7..711ae3fdd44f: results
> 
> Cheers,
> Matt
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [MPTCP] [PATCH v3 01/10] Extend path manager interface
@ 2019-08-12 19:35 Matthieu Baerts
  0 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2019-08-12 19:35 UTC (permalink / raw)
  To: mptcp

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

Hi Peter, Paolo, Mat,

On 08/08/2019 00:44, Peter Krystad wrote:
> A little more functionality and some comments clarifying
> which routines are for a path manager to call and which are
> callbacks.
> 
> squashto: Add path manager interface

Thank you for the patch and the reviews!

I had to split this patch in 2 parts:
- c8625a37c692: part 1: "squashed" in "mptcp: Add path manager interface"
- 4412b8e8e6c9: conflict in t/mptcp-Add-ADD_ADDR-handling
- 0757aec1b6f2: part 2: "squashed" in "mptcp: Add ADD_ADDR handling"
- b1477322bbb7..711ae3fdd44f: results

Cheers,
Matt

-- 
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [MPTCP] [PATCH v3 01/10] Extend path manager interface
@ 2019-08-07 22:44 Peter Krystad
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Krystad @ 2019-08-07 22:44 UTC (permalink / raw)
  To: mptcp

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

A little more functionality and some comments clarifying
which routines are for a path manager to call and which are
callbacks.

squashto: Add path manager interface

Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/options.c  | 40 +++++++++++++++++++--
 net/mptcp/pm.c       | 84 +++++++++++++++++++++++++++++++++++++-------
 net/mptcp/protocol.c |  5 +--
 net/mptcp/protocol.h | 38 +++++++++++++++-----
 4 files changed, 140 insertions(+), 27 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 58215f19829a..ab3fce071c17 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -411,11 +411,29 @@ static bool mptcp_established_options_addr(struct sock *sk,
 {
 	struct subflow_context *subflow = subflow_ctx(sk);
 	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
+	struct sockaddr_storage saddr;
+	u8 id;
 
-	if (subflow->fourth_ack)
-		return pm_addr_signal(msk, size, remaining, opts);
+	if (!msk)
+		return false;
 
-	return false;
+	if (!msk->pm.fully_established || !msk->addr_signal)
+		return false;
+
+	if (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;
+
+	msk->addr_signal = 0;
+
+	return true;
 }
 
 bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
@@ -479,11 +497,23 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
 void mptcp_attach_dss(struct sock *sk, struct sk_buff *skb,
 		      struct tcp_options_received *opt_rx)
 {
+	struct subflow_context *subflow = subflow_ctx(sk);
+	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
 	struct mptcp_options_received *mp_opt;
 	struct mptcp_ext *mpext;
 
 	mp_opt = &opt_rx->mptcp;
 
+	if (msk && mp_opt->add_addr) {
+		if (mp_opt->family == MPTCP_ADDR_IPVERSION_4)
+			pm_add_addr(msk, &mp_opt->addr, mp_opt->addr_id);
+#if IS_ENABLED(CONFIG_IPV6)
+		else if (mp_opt->family == MPTCP_ADDR_IPVERSION_6)
+			pm_add_addr6(msk, &mp_opt->addr6, mp_opt->addr_id);
+#endif
+		mp_opt->add_addr = 0;
+	}
+
 	if (!mp_opt->dss)
 		return;
 
@@ -510,6 +540,10 @@ void mptcp_attach_dss(struct sock *sk, struct sk_buff *skb,
 	}
 
 	mpext->data_fin = mp_opt->data_fin;
+
+	if (msk)
+		pm_fully_established(msk);
+
 }
 
 void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index 9e9c681a4544..e81475a337b7 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -8,14 +8,43 @@
 #include <net/mptcp.h>
 #include "protocol.h"
 
-void pm_new_connection(struct mptcp_sock *msk)
+/* path manager command handlers */
+
+int pm_announce_addr(u32 token, sa_family_t family, u8 local_id,
+		     struct in_addr *addr)
+{
+	return -ENOTSUPP;
+}
+
+int pm_remove_addr(u32 token, u8 local_id)
+{
+	return -ENOTSUPP;
+}
+
+int pm_create_subflow(u32 token, u8 remote_id)
+{
+	return -ENOTSUPP;
+}
+
+int pm_remove_subflow(u32 token, u8 remote_id)
+{
+	return -ENOTSUPP;
+}
+
+/* path manager event handlers */
+
+void pm_new_connection(struct mptcp_sock *msk, int server_side)
 {
 	pr_debug("msk=%p", msk);
+
+	msk->pm.server_side = server_side;
 }
 
 void pm_fully_established(struct mptcp_sock *msk)
 {
 	pr_debug("msk=%p", msk);
+
+	msk->pm.fully_established = 1;
 }
 
 void pm_connection_closed(struct mptcp_sock *msk)
@@ -35,7 +64,12 @@ void pm_subflow_closed(struct mptcp_sock *msk, u8 id)
 
 void pm_add_addr(struct mptcp_sock *msk, const struct in_addr *addr, u8 id)
 {
-	pr_debug("msk=%p", msk);
+	pr_debug("msk=%p, addr=%x, remote_id=%d", msk, addr->s_addr, id);
+
+	msk->pm.remote_addr.s_addr = addr->s_addr;
+	msk->pm.remote_id = id;
+	msk->pm.remote_family = AF_INET;
+	msk->pm.remote_valid = 1;
 }
 
 void pm_add_addr6(struct mptcp_sock *msk, const struct in6_addr *addr, u8 id)
@@ -48,19 +82,43 @@ void pm_rm_addr(struct mptcp_sock *msk, u8 id)
 	pr_debug("msk=%p", msk);
 }
 
-bool pm_addr_signal(struct mptcp_sock *msk, unsigned int *size,
-		    unsigned int remaining, struct mptcp_out_options *opts)
+/* path manager helpers */
+
+int pm_addr_signal(struct mptcp_sock *msk, u8 *id,
+		   struct sockaddr_storage *saddr)
 {
-	if (!msk || !msk->addr_signal)
-		return false;
+	struct sockaddr_in *addr = (struct sockaddr_in *)saddr;
 
-	if (msk->pm.family == AF_INET && remaining < TCPOLEN_MPTCP_ADD_ADDR)
-		return false;
+	if (!msk->pm.local_valid)
+		return -1;
 
-	pr_debug("msk=%p", msk);
-	opts->suboptions |= OPTION_MPTCP_ADD_ADDR;
-	opts->addr_id = msk->pm.addr_id;
-	opts->addr.s_addr = msk->pm.addr.s_addr;
+	if (msk->pm.local_family != AF_INET)
+		return -1;
 
-	return true;
+	*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;
+}
+
+int pm_get_local_id(struct request_sock *req, struct sock *sk,
+		    const struct sk_buff *skb)
+{
+	struct subflow_request_sock *subflow_req = subflow_rsk(req);
+	struct mptcp_sock *msk = mptcp_sk(sk);
+
+	if (!msk->pm.local_valid)
+		return -1;
+
+	/* @@ check if address actually matches... */
+
+	pr_debug("msk=%p, addr_id=%d", msk, msk->pm.local_id);
+	subflow_req->local_id = msk->pm.local_id;
+
+	return 0;
+}
+
+void pm_init(void)
+{
 }
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 4d2844bff36f..5501c405c6e0 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -663,7 +663,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,
 		token_update_accept(new_sock->sk, new_mptcp_sock);
 		msk->subflow = NULL;
 
-		pm_new_connection(msk);
+		pm_new_connection(msk, 1);
 
 		crypto_key_sha1(msk->remote_key, NULL, &ack_seq);
 		msk->write_seq = subflow->idsn + 1;
@@ -798,7 +798,7 @@ void mptcp_finish_connect(struct sock *sk, int mp_capable)
 		msk->token = subflow->token;
 		pr_debug("msk=%p, token=%u", msk, msk->token);
 
-		pm_new_connection(msk);
+		pm_new_connection(msk, 0);
 
 		crypto_key_sha1(msk->remote_key, NULL, &ack_seq);
 		msk->write_seq = subflow->idsn + 1;
@@ -1090,6 +1090,7 @@ void __init mptcp_init(void)
 
 	token_init();
 	subflow_init();
+	pm_init();
 
 	if (proto_register(&mptcp_prot, 1) != 0)
 		panic("Failed to register MPTCP proto.\n");
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 4c098acf4170..71c86e31e19c 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -78,15 +78,32 @@ static inline u32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
 		     ((nib & 0xF) << 8) | field);
 }
 
-struct pm_data {
-	u8 addr_id;
-	sa_family_t family;
+struct mptcp_pm_data {
+	u8	local_valid;
+	u8	local_id;
+	sa_family_t local_family;
+	union {
+		struct in_addr local_addr;
+#if IS_ENABLED(CONFIG_IPV6)
+		struct in6_addr local_addr6;
+#endif
+	};
+	u8	remote_valid;
+	u8	remote_id;
+	sa_family_t remote_family;
 	union {
-		struct in_addr addr;
+		struct in_addr remote_addr;
 #if IS_ENABLED(CONFIG_IPV6)
-		struct in6_addr addr6;
+		struct in6_addr remote_addr6;
 #endif
 	};
+	u8	server_side : 1,
+		fully_established : 1;
+
+	/* for interim path manager */
+	struct	work_struct addr_work;
+	struct	work_struct subflow_work;
+	u32	token;
 };
 
 /* MPTCP connection sock */
@@ -100,7 +117,7 @@ struct mptcp_sock {
 	u32		token;
 	struct list_head conn_list;
 	struct socket	*subflow; /* outgoing connect/listener/!mp_capable */
-	struct pm_data	pm;
+	struct mptcp_pm_data	pm;
 	u8		addr_signal;
 };
 
@@ -223,7 +240,8 @@ static inline void crypto_key_gen_sha1(u64 *key, u32 *token, u64 *idsn)
 	crypto_key_sha1(*key, token, idsn);
 }
 
-void pm_new_connection(struct mptcp_sock *msk);
+void pm_init(void);
+void pm_new_connection(struct mptcp_sock *msk, int server_side);
 void pm_fully_established(struct mptcp_sock *msk);
 void pm_connection_closed(struct mptcp_sock *msk);
 void pm_subflow_established(struct mptcp_sock *msk, u8 id);
@@ -231,8 +249,10 @@ void pm_subflow_closed(struct mptcp_sock *msk, u8 id);
 void pm_add_addr(struct mptcp_sock *msk, const struct in_addr *addr, u8 id);
 void pm_add_addr6(struct mptcp_sock *msk, const struct in6_addr *addr, u8 id);
 void pm_rm_addr(struct mptcp_sock *msk, u8 id);
-bool pm_addr_signal(struct mptcp_sock *msk, unsigned int *size,
-		    unsigned int remaining, struct mptcp_out_options *opts);
+int pm_addr_signal(struct mptcp_sock *msk, u8 *id,
+		   struct sockaddr_storage *saddr);
+int pm_get_local_id(struct request_sock *req, struct sock *sk,
+		    const struct sk_buff *skb);
 
 static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb)
 {
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-23 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-23 18:05 [MPTCP] [PATCH v3 01/10] Extend path manager interface Matthieu Baerts
  -- strict thread matches above, loose matches on Subject: below --
2019-08-22 22:31 Peter Krystad
2019-08-12 19:35 Matthieu Baerts
2019-08-07 22:44 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.