All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] about "ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT"
@ 2015-05-12 13:47 Eric Dumazet
  2015-05-15 22:24 ` [PATCH net] tcp/ipv6: fix flow label setting in TIME_WAIT state Florent Fourcot
  2015-05-15 22:28 ` [RFC] about "ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT" Florent Fourcot
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2015-05-12 13:47 UTC (permalink / raw)
  To: Florent Fourcot; +Cc: netdev

Hi Florent 

make C=2 CF=-D__CHECK_ENDIAN__ net/ipv4/tcp_minisocks.o
...
net/ipv4/tcp_minisocks.c:303:46: warning: restricted __be32 degrades to integer

            tw->tw_flowlabel = np->flow_label >> 12;


np->flow_label is a __be32 (network byte order)

Not sure what is expected from this shift on a BE machine, I am guessing
this is not giving the expected result.

Thanks

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

* [PATCH net] tcp/ipv6: fix flow label setting in TIME_WAIT state
  2015-05-12 13:47 [RFC] about "ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT" Eric Dumazet
@ 2015-05-15 22:24 ` Florent Fourcot
  2015-05-18  2:48   ` Eric Dumazet
  2015-05-18  3:42   ` David Miller
  2015-05-15 22:28 ` [RFC] about "ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT" Florent Fourcot
  1 sibling, 2 replies; 5+ messages in thread
From: Florent Fourcot @ 2015-05-15 22:24 UTC (permalink / raw)
  To: netdev; +Cc: Eric Dumazet, Florent Fourcot

commit 1d13a96c74fc ("ipv6: tcp: fix flowlabel value in ACK messages
send from TIME_WAIT") added the flow label in the last TCP packets.
Unfortunately, it was not casted properly.

This patch replace the buggy shift with be32_to_cpu/cpu_to_be32.

Fixes: 1d13a96c74fc ("ipv6: tcp: fix flowlabel value in ACK messages")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
---
 net/ipv4/tcp_minisocks.c | 2 +-
 net/ipv6/tcp_ipv6.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index ebe2ab2..d322e84 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -300,7 +300,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
 			tw->tw_v6_daddr = sk->sk_v6_daddr;
 			tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
 			tw->tw_tclass = np->tclass;
-			tw->tw_flowlabel = np->flow_label >> 12;
+			tw->tw_flowlabel = be32_to_cpu(np->flow_label & IPV6_FLOWLABEL_MASK);
 			tw->tw_ipv6only = sk->sk_ipv6only;
 		}
 #endif
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b6575d6..3adffb3 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -914,7 +914,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb)
 			tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale,
 			tcp_time_stamp + tcptw->tw_ts_offset,
 			tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw),
-			tw->tw_tclass, (tw->tw_flowlabel << 12));
+			tw->tw_tclass, cpu_to_be32(tw->tw_flowlabel));
 
 	inet_twsk_put(tw);
 }
-- 
2.1.4

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

* Re: [RFC] about "ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT"
  2015-05-12 13:47 [RFC] about "ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT" Eric Dumazet
  2015-05-15 22:24 ` [PATCH net] tcp/ipv6: fix flow label setting in TIME_WAIT state Florent Fourcot
@ 2015-05-15 22:28 ` Florent Fourcot
  1 sibling, 0 replies; 5+ messages in thread
From: Florent Fourcot @ 2015-05-15 22:28 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev

Hi Eric,

thanks for reporting this issue. The patch sent some seconds ago should
solve the problem.

Regards,

Florent.

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

* Re: [PATCH net] tcp/ipv6: fix flow label setting in TIME_WAIT state
  2015-05-15 22:24 ` [PATCH net] tcp/ipv6: fix flow label setting in TIME_WAIT state Florent Fourcot
@ 2015-05-18  2:48   ` Eric Dumazet
  2015-05-18  3:42   ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2015-05-18  2:48 UTC (permalink / raw)
  To: Florent Fourcot; +Cc: netdev

On Sat, 2015-05-16 at 00:24 +0200, Florent Fourcot wrote:
> commit 1d13a96c74fc ("ipv6: tcp: fix flowlabel value in ACK messages
> send from TIME_WAIT") added the flow label in the last TCP packets.
> Unfortunately, it was not casted properly.
> 
> This patch replace the buggy shift with be32_to_cpu/cpu_to_be32.
> 
> Fixes: 1d13a96c74fc ("ipv6: tcp: fix flowlabel value in ACK messages")
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
> ---

Acked-by: Eric Dumazet <edumazet@google.com>

Merci Florent !

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

* Re: [PATCH net] tcp/ipv6: fix flow label setting in TIME_WAIT state
  2015-05-15 22:24 ` [PATCH net] tcp/ipv6: fix flow label setting in TIME_WAIT state Florent Fourcot
  2015-05-18  2:48   ` Eric Dumazet
@ 2015-05-18  3:42   ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-05-18  3:42 UTC (permalink / raw)
  To: florent.fourcot; +Cc: netdev, eric.dumazet

From: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
Date: Sat, 16 May 2015 00:24:59 +0200

> commit 1d13a96c74fc ("ipv6: tcp: fix flowlabel value in ACK messages
> send from TIME_WAIT") added the flow label in the last TCP packets.
> Unfortunately, it was not casted properly.
> 
> This patch replace the buggy shift with be32_to_cpu/cpu_to_be32.
> 
> Fixes: 1d13a96c74fc ("ipv6: tcp: fix flowlabel value in ACK messages")
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Florent Fourcot <florent.fourcot@enst-bretagne.fr>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2015-05-18  3:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 13:47 [RFC] about "ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT" Eric Dumazet
2015-05-15 22:24 ` [PATCH net] tcp/ipv6: fix flow label setting in TIME_WAIT state Florent Fourcot
2015-05-18  2:48   ` Eric Dumazet
2015-05-18  3:42   ` David Miller
2015-05-15 22:28 ` [RFC] about "ipv6: tcp: fix flowlabel value in ACK messages send from TIME_WAIT" Florent Fourcot

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.