All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP][PATCH v2 mptcp-next] Squash to "Squash-to: mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal"
@ 2021-07-25 14:18 Geliang Tang
  2021-07-26  8:11 ` Paolo Abeni
  2021-07-28  7:18 ` Matthieu Baerts
  0 siblings, 2 replies; 3+ messages in thread
From: Geliang Tang @ 2021-07-25 14:18 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Paolo's patch (Squash-to: "mptcp: build ADD_ADDR/echo-ADD_ADDR option
according pm.add_signal") reverts back to a single 'addr' field in
struct mptcp_addr_info.

Then no need to change the argument of mptcp_pm_add_addr_signal to
mptcp_out_options and no need to modify the code in mptcp_write_options
now, the original code is fine.

So this patch reverts back more code.

And the commit log needs to be updated:

'''
According to the MPTCP_ADD_ADDR_SIGNAL or MPTCP_ADD_ADDR_ECHO flag, build
the ADD_ADDR/ADD_ADDR_ECHO option.

In mptcp_pm_add_addr_signal(), use opts->addr to save the announced
ADD_ADDR or ADD_ADDR_ECHO address.
'''

v2:
- rename the 'saddr' argument of mptcp_pm_add_addr_signal to 'addr'.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 net/mptcp/options.c  | 25 ++++++++++++-------------
 net/mptcp/pm.c       |  6 +++---
 net/mptcp/protocol.h |  2 +-
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index eafdb9408f3a..cb29a5605776 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -668,7 +668,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
 	int len;
 
 	if (!mptcp_pm_should_add_signal(msk) ||
-	    !mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, opts,
+	    !mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, &opts->addr,
 		    &echo, &port, &drop_other_suboptions))
 		return false;
 
@@ -692,8 +692,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
 						     msk->remote_key,
 						     &opts->addr);
 	}
-	pr_debug("addr_id=%d, addr_port=%d, ahmac=%llu, echo=%d",
-		 opts->addr.id, ntohs(opts->addr.port), opts->ahmac, echo);
+	pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d",
+		 opts->addr.id, opts->ahmac, echo, ntohs(opts->addr.port));
 
 	return true;
 }
@@ -1250,16 +1250,15 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
 
 mp_capable_done:
 	if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) {
-		struct mptcp_addr_info *addr = &opts->addr;
 		u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE;
 		u8 echo = MPTCP_ADDR_ECHO;
 
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
-		if (addr->family == AF_INET6)
+		if (opts->addr.family == AF_INET6)
 			len = TCPOLEN_MPTCP_ADD_ADDR6_BASE;
 #endif
 
-		if (addr->port)
+		if (opts->addr.port)
 			len += TCPOLEN_MPTCP_PORT_LEN;
 
 		if (opts->ahmac) {
@@ -1268,25 +1267,25 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
 		}
 
 		*ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR,
-				      len, echo, addr->id);
-		if (addr->family == AF_INET) {
-			memcpy((u8 *)ptr, (u8 *)&addr->addr.s_addr, 4);
+				      len, echo, opts->addr.id);
+		if (opts->addr.family == AF_INET) {
+			memcpy((u8 *)ptr, (u8 *)&opts->addr.addr.s_addr, 4);
 			ptr += 1;
 		}
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
-		else if (addr->family == AF_INET6) {
-			memcpy((u8 *)ptr, addr->addr6.s6_addr, 16);
+		else if (opts->addr.family == AF_INET6) {
+			memcpy((u8 *)ptr, opts->addr.addr6.s6_addr, 16);
 			ptr += 4;
 		}
 #endif
 
-		if (!addr->port) {
+		if (!opts->addr.port) {
 			if (opts->ahmac) {
 				put_unaligned_be64(opts->ahmac, ptr);
 				ptr += 2;
 			}
 		} else {
-			u16 port = ntohs(addr->port);
+			u16 port = ntohs(opts->addr.port);
 
 			if (opts->ahmac) {
 				u8 *bptr = (u8 *)ptr;
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index 5fe3805af02a..8727ef75da79 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -257,7 +257,7 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup)
 
 bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb,
 			      unsigned int opt_size, unsigned int remaining,
-			      struct mptcp_out_options *opts, bool *echo,
+			      struct mptcp_addr_info *addr, bool *echo,
 			      bool *port, bool *drop_other_suboptions)
 {
 	int ret = false;
@@ -286,10 +286,10 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb,
 		goto out_unlock;
 
 	if (*echo) {
-		opts->addr = msk->pm.remote;
+		*addr = msk->pm.remote;
 		add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO);
 	} else {
-		opts->addr = msk->pm.local;
+		*addr = msk->pm.local;
 		add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_SIGNAL);
 	}
 	WRITE_ONCE(msk->pm.addr_signal, add_addr);
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index b54335857b6e..9fce5b66fd4c 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -801,7 +801,7 @@ static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list)
 
 bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb,
 			      unsigned int opt_size, unsigned int remaining,
-			      struct mptcp_out_options *opts, bool *echo,
+			      struct mptcp_addr_info *addr, bool *echo,
 			      bool *port, bool *drop_other_suboptions);
 bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
 			     struct mptcp_rm_list *rm_list);
-- 
2.31.1


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

* Re: [MPTCP][PATCH v2 mptcp-next] Squash to "Squash-to: mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal"
  2021-07-25 14:18 [MPTCP][PATCH v2 mptcp-next] Squash to "Squash-to: mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal" Geliang Tang
@ 2021-07-26  8:11 ` Paolo Abeni
  2021-07-28  7:18 ` Matthieu Baerts
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2021-07-26  8:11 UTC (permalink / raw)
  To: Geliang Tang, mptcp

On Sun, 2021-07-25 at 22:18 +0800, Geliang Tang wrote:
> Paolo's patch (Squash-to: "mptcp: build ADD_ADDR/echo-ADD_ADDR option
> according pm.add_signal") reverts back to a single 'addr' field in
> struct mptcp_addr_info.
> 
> Then no need to change the argument of mptcp_pm_add_addr_signal to
> mptcp_out_options and no need to modify the code in mptcp_write_options
> now, the original code is fine.
> 
> So this patch reverts back more code.
> 
> And the commit log needs to be updated:
> 
> '''
> According to the MPTCP_ADD_ADDR_SIGNAL or MPTCP_ADD_ADDR_ECHO flag, build
> the ADD_ADDR/ADD_ADDR_ECHO option.
> 
> In mptcp_pm_add_addr_signal(), use opts->addr to save the announced
> ADD_ADDR or ADD_ADDR_ECHO address.
> '''
> 
> v2:
> - rename the 'saddr' argument of mptcp_pm_add_addr_signal to 'addr'.

Oops, I did not notice that datail! Good catch!

LGTM (again :)

/P


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

* Re: [MPTCP][PATCH v2 mptcp-next] Squash to "Squash-to: mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal"
  2021-07-25 14:18 [MPTCP][PATCH v2 mptcp-next] Squash to "Squash-to: mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal" Geliang Tang
  2021-07-26  8:11 ` Paolo Abeni
@ 2021-07-28  7:18 ` Matthieu Baerts
  1 sibling, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2021-07-28  7:18 UTC (permalink / raw)
  To: Geliang Tang, Paolo Abeni, Mat Martineau; +Cc: mptcp

Hi Geliang, Paolo, Mat,

On 25/07/2021 16:18, Geliang Tang wrote:
> Paolo's patch (Squash-to: "mptcp: build ADD_ADDR/echo-ADD_ADDR option
> according pm.add_signal") reverts back to a single 'addr' field in
> struct mptcp_addr_info.
> 
> Then no need to change the argument of mptcp_pm_add_addr_signal to
> mptcp_out_options and no need to modify the code in mptcp_write_options
> now, the original code is fine.
> 
> So this patch reverts back more code.
> 
> And the commit log needs to be updated:
> 
> '''
> According to the MPTCP_ADD_ADDR_SIGNAL or MPTCP_ADD_ADDR_ECHO flag, build
> the ADD_ADDR/ADD_ADDR_ECHO option.
> 
> In mptcp_pm_add_addr_signal(), use opts->addr to save the announced
> ADD_ADDR or ADD_ADDR_ECHO address.
> '''
> 
> v2:
> - rename the 'saddr' argument of mptcp_pm_add_addr_signal to 'addr'.

Thank you for the patch, reviews and tests!

- 210b1030d1b1: "squashed" in "mptcp: build ADD_ADDR/echo-ADD_ADDR
option according pm.add_signal"
- b2e3a05bbcd4: tg: update msg after having applied 2 squash-to patches
- Results: fcc436834cac..49320b30c955

Builds and tests are now in progress:



https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20210728T071836

https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export/20210728T071836

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

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

end of thread, other threads:[~2021-07-28  7:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-25 14:18 [MPTCP][PATCH v2 mptcp-next] Squash to "Squash-to: mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal" Geliang Tang
2021-07-26  8:11 ` Paolo Abeni
2021-07-28  7:18 ` Matthieu Baerts

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.