mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options"
@ 2021-03-22 16:21 Matthieu Baerts
  2021-03-22 16:21 ` [PATCH mptcp-next 2/3] Squash to "mptcp: use mptcp_addr_info in mptcp_options_received" Matthieu Baerts
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Matthieu Baerts @ 2021-03-22 16:21 UTC (permalink / raw)
  To: mptcp, mptcp; +Cc: Geliang Tang, Matthieu Baerts

Fix issues reported by sparse because we were doing non explicit casting
from __be16 to u16.

  net/mptcp/options.c:662:72: warning: incorrect type in argument 5 (different base types)
  net/mptcp/options.c:662:72:    expected unsigned short [usertype] port
  net/mptcp/options.c:662:72:    got restricted __be16 [usertype] port
  net/mptcp/options.c:673:73: warning: incorrect type in argument 5 (different base types)
  net/mptcp/options.c:673:73:    expected unsigned short [usertype] port
  net/mptcp/options.c:673:73:    got restricted __be16 [usertype] port
  net/mptcp/options.c:1244:62: warning: incorrect type in argument 1 (different base types)
  net/mptcp/options.c:1244:62:    expected unsigned short [usertype] val
  net/mptcp/options.c:1244:62:    got restricted __be16 [usertype] port
  net/mptcp/options.c:1253:62: warning: restricted __be16 degrades to integer

Before the mentioned commit, we were using port in u16 in
mptcp_out_options, everything was OK.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 net/mptcp/options.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 7e01f44ed885..03019a6d5059 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -659,7 +659,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
 							     msk->remote_key,
 							     opts->addr.id,
 							     &opts->addr.addr,
-							     opts->addr.port);
+							     be16_to_cpu(opts->addr.port));
 		}
 	}
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
@@ -670,7 +670,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
 							      msk->remote_key,
 							      opts->addr.id,
 							      &opts->addr.addr6,
-							      opts->addr.port);
+							      be16_to_cpu(opts->addr.port));
 		}
 	}
 #endif
@@ -1238,10 +1238,12 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
 				ptr += 2;
 			}
 		} else {
+			u16 port = be16_to_cpu(opts->addr.port);
+
 			if (opts->ahmac) {
 				u8 *bptr = (u8 *)ptr;
 
-				put_unaligned_be16(opts->addr.port, bptr);
+				put_unaligned_be16(port, bptr);
 				bptr += 2;
 				put_unaligned_be64(opts->ahmac, bptr);
 				bptr += 8;
@@ -1250,7 +1252,7 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
 
 				ptr += 3;
 			} else {
-				put_unaligned_be32(opts->addr.port << 16 |
+				put_unaligned_be32(port << 16 |
 						   TCPOPT_NOP << 8 |
 						   TCPOPT_NOP, ptr);
 				ptr += 1;
-- 
2.30.2


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

* [PATCH mptcp-next 2/3] Squash to "mptcp: use mptcp_addr_info in mptcp_options_received"
  2021-03-22 16:21 [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options" Matthieu Baerts
@ 2021-03-22 16:21 ` Matthieu Baerts
  2021-03-23  4:02   ` Geliang Tang
  2021-03-22 16:21 ` [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6" Matthieu Baerts
  2021-03-23  4:00 ` [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options" Geliang Tang
  2 siblings, 1 reply; 10+ messages in thread
From: Matthieu Baerts @ 2021-03-22 16:21 UTC (permalink / raw)
  To: mptcp, mptcp; +Cc: Geliang Tang, Matthieu Baerts

Fix issues reported by sparse because we were doing non explicit casting
from __be16 to u16 and the opposite.

  net/mptcp/options.c:251:51: warning: incorrect type in assignment (different base types)
  net/mptcp/options.c:251:51:    expected restricted __be16 [usertype] port
  net/mptcp/options.c:251:51:    got unsigned short
  net/mptcp/options.c:261:51: warning: incorrect type in assignment (different base types)
  net/mptcp/options.c:261:51:    expected restricted __be16 [usertype] port
  net/mptcp/options.c:261:51:    got unsigned short
  net/mptcp/options.c:998:59: warning: incorrect type in argument 5 (different base types)
  net/mptcp/options.c:998:59:    expected unsigned short [usertype] port
  net/mptcp/options.c:998:59:    got restricted __be16 [usertype] port
  net/mptcp/options.c:1004:60: warning: incorrect type in argument 5 (different base types)
  net/mptcp/options.c:1004:60:    expected unsigned short [usertype] port
  net/mptcp/options.c:1004:60:    got restricted __be16 [usertype] port

Before the mentioned commit, we were using port in u16 in
mptcp_options_received, everything was OK.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 net/mptcp/options.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 7fd40512df7f..43b85f2a5be1 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -248,7 +248,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 			ptr += 4;
 			if (opsize == TCPOLEN_MPTCP_ADD_ADDR_PORT ||
 			    opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) {
-				mp_opt->addr.port = get_unaligned_be16(ptr);
+				mp_opt->addr.port = cpu_to_be16(get_unaligned_be16(ptr));
 				ptr += 2;
 			}
 		}
@@ -258,7 +258,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 			ptr += 16;
 			if (opsize == TCPOLEN_MPTCP_ADD_ADDR6_PORT ||
 			    opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT) {
-				mp_opt->addr.port = get_unaligned_be16(ptr);
+				mp_opt->addr.port = cpu_to_be16(get_unaligned_be16(ptr));
 				ptr += 2;
 			}
 		}
@@ -995,13 +995,13 @@ static bool add_addr_hmac_valid(struct mptcp_sock *msk,
 		hmac = add_addr_generate_hmac(msk->remote_key,
 					      msk->local_key,
 					      mp_opt->addr.id, &mp_opt->addr.addr,
-					      mp_opt->addr.port);
+					      be16_to_cpu(mp_opt->addr.port));
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
 	else
 		hmac = add_addr6_generate_hmac(msk->remote_key,
 					       msk->local_key,
 					       mp_opt->addr.id, &mp_opt->addr.addr6,
-					       mp_opt->addr.port);
+					       be16_to_cpu(mp_opt->addr.port));
 #endif
 
 	pr_debug("msk=%p, ahmac=%llu, mp_opt->ahmac=%llu\n",
-- 
2.30.2


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

* [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6"
  2021-03-22 16:21 [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options" Matthieu Baerts
  2021-03-22 16:21 ` [PATCH mptcp-next 2/3] Squash to "mptcp: use mptcp_addr_info in mptcp_options_received" Matthieu Baerts
@ 2021-03-22 16:21 ` Matthieu Baerts
  2021-03-22 21:56   ` Mat Martineau
  2021-03-23  4:00 ` [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options" Geliang Tang
  2 siblings, 1 reply; 10+ messages in thread
From: Matthieu Baerts @ 2021-03-22 16:21 UTC (permalink / raw)
  To: mptcp, mptcp; +Cc: Geliang Tang, Matthieu Baerts

Fix issues reported by sparse because we are doing non explicit casting
from __be16 to integer.

  net/mptcp/options.c:604:24: warning: restricted __be16 degrades to integer
  net/mptcp/options.c:605:24: warning: restricted __be16 degrades to integer

Before the mentioned commit, we were using port in u16 given in argument
of add_addr_generate_hmac function, everything was OK.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 net/mptcp/options.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 071b446aa2c9..d9e5f864d774 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -586,6 +586,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 static u64 add_addr_generate_hmac(u64 key1, u64 key2,
 				  struct mptcp_addr_info *addr)
 {
+	u16 port = be16_to_cpu(addr->port);
 	u8 hmac[SHA256_DIGEST_SIZE];
 	u8 msg[19];
 	int i = 0;
@@ -601,8 +602,8 @@ static u64 add_addr_generate_hmac(u64 key1, u64 key2,
 		i += 16;
 	}
 #endif
-	msg[i++] = addr->port >> 8;
-	msg[i++] = addr->port & 0xFF;
+	msg[i++] = port >> 8;
+	msg[i++] = port & 0xFF;
 
 	mptcp_crypto_hmac_sha(key1, key2, msg, i, hmac);
 
-- 
2.30.2


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

* Re: [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6"
  2021-03-22 16:21 ` [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6" Matthieu Baerts
@ 2021-03-22 21:56   ` Mat Martineau
  2021-03-23  3:06     ` Geliang Tang
  0 siblings, 1 reply; 10+ messages in thread
From: Mat Martineau @ 2021-03-22 21:56 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: mptcp, mptcp, Geliang Tang


On Mon, 22 Mar 2021, Matthieu Baerts wrote:

> Fix issues reported by sparse because we are doing non explicit casting
> from __be16 to integer.
>
>  net/mptcp/options.c:604:24: warning: restricted __be16 degrades to integer
>  net/mptcp/options.c:605:24: warning: restricted __be16 degrades to integer
>
> Before the mentioned commit, we were using port in u16 given in argument
> of add_addr_generate_hmac function, everything was OK.
>
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
> net/mptcp/options.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

I think the subject line is incorrect on this one (it applies cleanly to 
"mptcp: unify add_addr(6)_generate_hmac" instead), but other than that all 
three patches look good to squash. Thanks!

Mat


>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 071b446aa2c9..d9e5f864d774 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -586,6 +586,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
> static u64 add_addr_generate_hmac(u64 key1, u64 key2,
> 				  struct mptcp_addr_info *addr)
> {
> +	u16 port = be16_to_cpu(addr->port);
> 	u8 hmac[SHA256_DIGEST_SIZE];
> 	u8 msg[19];
> 	int i = 0;
> @@ -601,8 +602,8 @@ static u64 add_addr_generate_hmac(u64 key1, u64 key2,
> 		i += 16;
> 	}
> #endif
> -	msg[i++] = addr->port >> 8;
> -	msg[i++] = addr->port & 0xFF;
> +	msg[i++] = port >> 8;
> +	msg[i++] = port & 0xFF;
>
> 	mptcp_crypto_hmac_sha(key1, key2, msg, i, hmac);
>
> -- 
> 2.30.2
>
>
>

--
Mat Martineau
Intel

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

* Re: [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6"
  2021-03-22 21:56   ` Mat Martineau
@ 2021-03-23  3:06     ` Geliang Tang
  2021-03-23  7:59       ` Matthieu Baerts
  0 siblings, 1 reply; 10+ messages in thread
From: Geliang Tang @ 2021-03-23  3:06 UTC (permalink / raw)
  To: Mat Martineau; +Cc: Matthieu Baerts, mptcp, mptcp

Hi Matt,

Thanks for your patches.

Mat Martineau <mathew.j.martineau@linux.intel.com> 于2021年3月23日周二 上午5:56写道:
>
>
> On Mon, 22 Mar 2021, Matthieu Baerts wrote:
>
> > Fix issues reported by sparse because we are doing non explicit casting
> > from __be16 to integer.
> >
> >  net/mptcp/options.c:604:24: warning: restricted __be16 degrades to integer
> >  net/mptcp/options.c:605:24: warning: restricted __be16 degrades to integer
> >
> > Before the mentioned commit, we were using port in u16 given in argument
> > of add_addr_generate_hmac function, everything was OK.
> >
> > Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> > ---
> > net/mptcp/options.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
>
> I think the subject line is incorrect on this one (it applies cleanly to
> "mptcp: unify add_addr(6)_generate_hmac" instead), but other than that all
> three patches look good to squash. Thanks!
>
> Mat
>
>
> >
> > diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> > index 071b446aa2c9..d9e5f864d774 100644
> > --- a/net/mptcp/options.c
> > +++ b/net/mptcp/options.c
> > @@ -586,6 +586,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
> > static u64 add_addr_generate_hmac(u64 key1, u64 key2,
> >                                 struct mptcp_addr_info *addr)
> > {
> > +     u16 port = be16_to_cpu(addr->port);

I prefer to use ntohs/htons instead of be16_to_cpu/cpu_to_be16 in these
three patches to keep the consistency of the port number converting.

WDYT?

-Geliang

> >       u8 hmac[SHA256_DIGEST_SIZE];
> >       u8 msg[19];
> >       int i = 0;
> > @@ -601,8 +602,8 @@ static u64 add_addr_generate_hmac(u64 key1, u64 key2,
> >               i += 16;
> >       }
> > #endif
> > -     msg[i++] = addr->port >> 8;
> > -     msg[i++] = addr->port & 0xFF;
> > +     msg[i++] = port >> 8;
> > +     msg[i++] = port & 0xFF;
> >
> >       mptcp_crypto_hmac_sha(key1, key2, msg, i, hmac);
> >
> > --
> > 2.30.2
> >
> >
> >
>
> --
> Mat Martineau
> Intel

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

* Re: [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options"
  2021-03-22 16:21 [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options" Matthieu Baerts
  2021-03-22 16:21 ` [PATCH mptcp-next 2/3] Squash to "mptcp: use mptcp_addr_info in mptcp_options_received" Matthieu Baerts
  2021-03-22 16:21 ` [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6" Matthieu Baerts
@ 2021-03-23  4:00 ` Geliang Tang
  2 siblings, 0 replies; 10+ messages in thread
From: Geliang Tang @ 2021-03-23  4:00 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: mptcp, mptcp

Hi Matt,

Please update the commit log too:

---
Since the port number became as a big-endian order now, use ntohs to
convert it before printing it out.
---

 ->

---
Since the port number became big-endian now, use ntohs to convert it
before sending it out with the ADD_ADDR suboption. Also convert it
when passing it to add_addr_generate_hmac or printing it out.
---

Thanks.

-Geliang

Matthieu Baerts <matthieu.baerts@tessares.net> 于2021年3月23日周二 上午12:21写道:
>
> Fix issues reported by sparse because we were doing non explicit casting
> from __be16 to u16.
>
>   net/mptcp/options.c:662:72: warning: incorrect type in argument 5 (different base types)
>   net/mptcp/options.c:662:72:    expected unsigned short [usertype] port
>   net/mptcp/options.c:662:72:    got restricted __be16 [usertype] port
>   net/mptcp/options.c:673:73: warning: incorrect type in argument 5 (different base types)
>   net/mptcp/options.c:673:73:    expected unsigned short [usertype] port
>   net/mptcp/options.c:673:73:    got restricted __be16 [usertype] port
>   net/mptcp/options.c:1244:62: warning: incorrect type in argument 1 (different base types)
>   net/mptcp/options.c:1244:62:    expected unsigned short [usertype] val
>   net/mptcp/options.c:1244:62:    got restricted __be16 [usertype] port
>   net/mptcp/options.c:1253:62: warning: restricted __be16 degrades to integer
>
> Before the mentioned commit, we were using port in u16 in
> mptcp_out_options, everything was OK.
>
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
>  net/mptcp/options.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 7e01f44ed885..03019a6d5059 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -659,7 +659,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
>                                                              msk->remote_key,
>                                                              opts->addr.id,
>                                                              &opts->addr.addr,
> -                                                            opts->addr.port);
> +                                                            be16_to_cpu(opts->addr.port));
>                 }
>         }
>  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
> @@ -670,7 +670,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
>                                                               msk->remote_key,
>                                                               opts->addr.id,
>                                                               &opts->addr.addr6,
> -                                                             opts->addr.port);
> +                                                             be16_to_cpu(opts->addr.port));
>                 }
>         }
>  #endif
> @@ -1238,10 +1238,12 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
>                                 ptr += 2;
>                         }
>                 } else {
> +                       u16 port = be16_to_cpu(opts->addr.port);
> +
>                         if (opts->ahmac) {
>                                 u8 *bptr = (u8 *)ptr;
>
> -                               put_unaligned_be16(opts->addr.port, bptr);
> +                               put_unaligned_be16(port, bptr);
>                                 bptr += 2;
>                                 put_unaligned_be64(opts->ahmac, bptr);
>                                 bptr += 8;
> @@ -1250,7 +1252,7 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
>
>                                 ptr += 3;
>                         } else {
> -                               put_unaligned_be32(opts->addr.port << 16 |
> +                               put_unaligned_be32(port << 16 |
>                                                    TCPOPT_NOP << 8 |
>                                                    TCPOPT_NOP, ptr);
>                                 ptr += 1;
> --
> 2.30.2
>

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

* Re: [PATCH mptcp-next 2/3] Squash to "mptcp: use mptcp_addr_info in mptcp_options_received"
  2021-03-22 16:21 ` [PATCH mptcp-next 2/3] Squash to "mptcp: use mptcp_addr_info in mptcp_options_received" Matthieu Baerts
@ 2021-03-23  4:02   ` Geliang Tang
  0 siblings, 0 replies; 10+ messages in thread
From: Geliang Tang @ 2021-03-23  4:02 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: mptcp, mptcp

Hi Matt,

Please update the commit log too:

---
Since the port number became as a big-endian order now, use ntohs to
convert it before printing it out.
---

 ->

---
Since the port number became big-endian now, use htons to convert the
incoming port number to it. Also use ntohs to convert it when passing
it to add_addr_generate_hmac or printing it out.
---

Thanks.

-Geliang

Matthieu Baerts <matthieu.baerts@tessares.net> 于2021年3月23日周二 上午12:21写道:
>
> Fix issues reported by sparse because we were doing non explicit casting
> from __be16 to u16 and the opposite.
>
>   net/mptcp/options.c:251:51: warning: incorrect type in assignment (different base types)
>   net/mptcp/options.c:251:51:    expected restricted __be16 [usertype] port
>   net/mptcp/options.c:251:51:    got unsigned short
>   net/mptcp/options.c:261:51: warning: incorrect type in assignment (different base types)
>   net/mptcp/options.c:261:51:    expected restricted __be16 [usertype] port
>   net/mptcp/options.c:261:51:    got unsigned short
>   net/mptcp/options.c:998:59: warning: incorrect type in argument 5 (different base types)
>   net/mptcp/options.c:998:59:    expected unsigned short [usertype] port
>   net/mptcp/options.c:998:59:    got restricted __be16 [usertype] port
>   net/mptcp/options.c:1004:60: warning: incorrect type in argument 5 (different base types)
>   net/mptcp/options.c:1004:60:    expected unsigned short [usertype] port
>   net/mptcp/options.c:1004:60:    got restricted __be16 [usertype] port
>
> Before the mentioned commit, we were using port in u16 in
> mptcp_options_received, everything was OK.
>
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
>  net/mptcp/options.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 7fd40512df7f..43b85f2a5be1 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -248,7 +248,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
>                         ptr += 4;
>                         if (opsize == TCPOLEN_MPTCP_ADD_ADDR_PORT ||
>                             opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) {
> -                               mp_opt->addr.port = get_unaligned_be16(ptr);
> +                               mp_opt->addr.port = cpu_to_be16(get_unaligned_be16(ptr));
>                                 ptr += 2;
>                         }
>                 }
> @@ -258,7 +258,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
>                         ptr += 16;
>                         if (opsize == TCPOLEN_MPTCP_ADD_ADDR6_PORT ||
>                             opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT) {
> -                               mp_opt->addr.port = get_unaligned_be16(ptr);
> +                               mp_opt->addr.port = cpu_to_be16(get_unaligned_be16(ptr));
>                                 ptr += 2;
>                         }
>                 }
> @@ -995,13 +995,13 @@ static bool add_addr_hmac_valid(struct mptcp_sock *msk,
>                 hmac = add_addr_generate_hmac(msk->remote_key,
>                                               msk->local_key,
>                                               mp_opt->addr.id, &mp_opt->addr.addr,
> -                                             mp_opt->addr.port);
> +                                             be16_to_cpu(mp_opt->addr.port));
>  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
>         else
>                 hmac = add_addr6_generate_hmac(msk->remote_key,
>                                                msk->local_key,
>                                                mp_opt->addr.id, &mp_opt->addr.addr6,
> -                                              mp_opt->addr.port);
> +                                              be16_to_cpu(mp_opt->addr.port));
>  #endif
>
>         pr_debug("msk=%p, ahmac=%llu, mp_opt->ahmac=%llu\n",
> --
> 2.30.2
>

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

* Re: [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6"
  2021-03-23  3:06     ` Geliang Tang
@ 2021-03-23  7:59       ` Matthieu Baerts
  2021-03-23  8:09         ` Geliang Tang
  0 siblings, 1 reply; 10+ messages in thread
From: Matthieu Baerts @ 2021-03-23  7:59 UTC (permalink / raw)
  To: Geliang Tang, Mat Martineau; +Cc: mptcp, mptcp

Hi Geliang, Mat,

Thank you for the reviews!

On 23/03/2021 04:06, Geliang Tang wrote:
> Hi Matt,
> 
> Thanks for your patches.
> 
> Mat Martineau <mathew.j.martineau@linux.intel.com> 于2021年3月23日周二 上午5:56写道:
>>
>>
>> On Mon, 22 Mar 2021, Matthieu Baerts wrote:
>>
>>> Fix issues reported by sparse because we are doing non explicit casting
>>> from __be16 to integer.
>>>
>>>   net/mptcp/options.c:604:24: warning: restricted __be16 degrades to integer
>>>   net/mptcp/options.c:605:24: warning: restricted __be16 degrades to integer
>>>
>>> Before the mentioned commit, we were using port in u16 given in argument
>>> of add_addr_generate_hmac function, everything was OK.
>>>
>>> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
>>> ---
>>> net/mptcp/options.c | 5 +++--
>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> I think the subject line is incorrect on this one (it applies cleanly to
>> "mptcp: unify add_addr(6)_generate_hmac" instead)

Oh yes sorry, I picked the wrong commit, thank you for noticing that :)

>> , but other than that all
>> three patches look good to squash. Thanks!
>>
>> Mat
>>
>>
>>>
>>> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
>>> index 071b446aa2c9..d9e5f864d774 100644
>>> --- a/net/mptcp/options.c
>>> +++ b/net/mptcp/options.c
>>> @@ -586,6 +586,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
>>> static u64 add_addr_generate_hmac(u64 key1, u64 key2,
>>>                                  struct mptcp_addr_info *addr)
>>> {
>>> +     u16 port = be16_to_cpu(addr->port);
> 
> I prefer to use ntohs/htons instead of be16_to_cpu/cpu_to_be16 in these
> three patches to keep the consistency of the port number converting.
> 
> WDYT?

No you are right, I don't know why I didn't use ntohs/htons, I think I 
was focused on the compiler issue forgetting the network env :)

I hope you don't mind if I apply the modifications (code and commit 
messages) directly without sending a v2. Then I would be able to unblock 
the CI to have new versions of the export branch.

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

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

* Re: [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6"
  2021-03-23  7:59       ` Matthieu Baerts
@ 2021-03-23  8:09         ` Geliang Tang
  2021-03-23 10:19           ` Matthieu Baerts
  0 siblings, 1 reply; 10+ messages in thread
From: Geliang Tang @ 2021-03-23  8:09 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: Mat Martineau, mptcp, mptcp

Hi Matt,

Matthieu Baerts <matthieu.baerts@tessares.net> 于2021年3月23日周二 下午3:59写道:
>
> Hi Geliang, Mat,
>
> Thank you for the reviews!
>
> On 23/03/2021 04:06, Geliang Tang wrote:
> > Hi Matt,
> >
> > Thanks for your patches.
> >
> > Mat Martineau <mathew.j.martineau@linux.intel.com> 于2021年3月23日周二 上午5:56写道:
> >>
> >>
> >> On Mon, 22 Mar 2021, Matthieu Baerts wrote:
> >>
> >>> Fix issues reported by sparse because we are doing non explicit casting
> >>> from __be16 to integer.
> >>>
> >>>   net/mptcp/options.c:604:24: warning: restricted __be16 degrades to integer
> >>>   net/mptcp/options.c:605:24: warning: restricted __be16 degrades to integer
> >>>
> >>> Before the mentioned commit, we were using port in u16 given in argument
> >>> of add_addr_generate_hmac function, everything was OK.
> >>>
> >>> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> >>> ---
> >>> net/mptcp/options.c | 5 +++--
> >>> 1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> >> I think the subject line is incorrect on this one (it applies cleanly to
> >> "mptcp: unify add_addr(6)_generate_hmac" instead)
>
> Oh yes sorry, I picked the wrong commit, thank you for noticing that :)
>
> >> , but other than that all
> >> three patches look good to squash. Thanks!
> >>
> >> Mat
> >>
> >>
> >>>
> >>> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> >>> index 071b446aa2c9..d9e5f864d774 100644
> >>> --- a/net/mptcp/options.c
> >>> +++ b/net/mptcp/options.c
> >>> @@ -586,6 +586,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
> >>> static u64 add_addr_generate_hmac(u64 key1, u64 key2,
> >>>                                  struct mptcp_addr_info *addr)
> >>> {
> >>> +     u16 port = be16_to_cpu(addr->port);
> >
> > I prefer to use ntohs/htons instead of be16_to_cpu/cpu_to_be16 in these
> > three patches to keep the consistency of the port number converting.
> >
> > WDYT?
>
> No you are right, I don't know why I didn't use ntohs/htons, I think I
> was focused on the compiler issue forgetting the network env :)
>
> I hope you don't mind if I apply the modifications (code and commit
> messages) directly without sending a v2. Then I would be able to unblock
> the CI to have new versions of the export branch.

Great, please apply them directly.

-Geliang

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

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

* Re: [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6"
  2021-03-23  8:09         ` Geliang Tang
@ 2021-03-23 10:19           ` Matthieu Baerts
  0 siblings, 0 replies; 10+ messages in thread
From: Matthieu Baerts @ 2021-03-23 10:19 UTC (permalink / raw)
  To: Geliang Tang, Mat Martineau; +Cc: mptcp, mptcp

Hi Geliang, Mat,

On 23/03/2021 09:09, Geliang Tang wrote:
> Matthieu Baerts <matthieu.baerts@tessares.net> 于2021年3月23日周二 下午3:59写道:
>> On 23/03/2021 04:06, Geliang Tang wrote:
>>> Mat Martineau <mathew.j.martineau@linux.intel.com> 于2021年3月23日周二 上午5:56写道:
>>>> On Mon, 22 Mar 2021, Matthieu Baerts wrote:
>>>>> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
>>>>> index 071b446aa2c9..d9e5f864d774 100644
>>>>> --- a/net/mptcp/options.c
>>>>> +++ b/net/mptcp/options.c
>>>>> @@ -586,6 +586,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
>>>>> static u64 add_addr_generate_hmac(u64 key1, u64 key2,
>>>>>                                   struct mptcp_addr_info *addr)
>>>>> {
>>>>> +     u16 port = be16_to_cpu(addr->port);
>>>
>>> I prefer to use ntohs/htons instead of be16_to_cpu/cpu_to_be16 in these
>>> three patches to keep the consistency of the port number converting.
>>>
>>> WDYT?
>>
>> No you are right, I don't know why I didn't use ntohs/htons, I think I
>> was focused on the compiler issue forgetting the network env :)
>>
>> I hope you don't mind if I apply the modifications (code and commit
>> messages) directly without sending a v2. Then I would be able to unblock
>> the CI to have new versions of the export branch.
> 
> Great, please apply them directly.

These 3 patches have been applied in our tree:

- 8759990266aa: "squashed" patch 1/3 in "mptcp: use mptcp_addr_info in 
mptcp_out_options"
- 1d75960e024f: "Signed-off-by" + "Co-developed-by"
- 57de81e7976c: mptcp: switch from be16_to_cpu to ntohs
- a22ece40c7b5: tg:msg: ntohs is used in more places

- 4b727db7b8d8: "squashed" patch 2/3 in "mptcp: use mptcp_addr_info in 
mptcp_options_received"
- 9306df23ef10: "Signed-off-by" + "Co-developed-by"
- d04e57dd8194: mptcp: switch from be16_to_cpu to ntohs
- 6ae92a7f3931: tg:msg: ntohs and htons are used in more places

- f2a9929ffe7b: conflict in t/mptcp-unify-add_addr-6-_generate_hmac
- fcd019ff3bb7: "squashed" patch 3/3 in "mptcp: unify 
add_addr(6)_generate_hmac"
- 1b3803eed9bd: "Signed-off-by" + "Co-developed-by"
- 49306de67569: mptcp: switch from be16_to_cpu to ntohs
- (commit message doesn't need to be modified)

- Results: 7a40c945f992..158c472c9dd4

Tests + export are in progress!

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

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

end of thread, other threads:[~2021-03-23 10:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 16:21 [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options" Matthieu Baerts
2021-03-22 16:21 ` [PATCH mptcp-next 2/3] Squash to "mptcp: use mptcp_addr_info in mptcp_options_received" Matthieu Baerts
2021-03-23  4:02   ` Geliang Tang
2021-03-22 16:21 ` [PATCH mptcp-next 3/3] Squash to "mptcp: drop MPTCP_ADDR_IPVERSION_4/6" Matthieu Baerts
2021-03-22 21:56   ` Mat Martineau
2021-03-23  3:06     ` Geliang Tang
2021-03-23  7:59       ` Matthieu Baerts
2021-03-23  8:09         ` Geliang Tang
2021-03-23 10:19           ` Matthieu Baerts
2021-03-23  4:00 ` [PATCH mptcp-next 1/3] Squash to "mptcp: use mptcp_addr_info in mptcp_out_options" Geliang Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).