* [PATCH net] ipv6: tcp: enable flowlabel reflection in some RST packets
@ 2019-06-04 19:29 Eric Dumazet
2019-06-05 1:16 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2019-06-04 19:29 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet
This extends commit 22b6722bfa59 ("ipv6: Add sysctl for per
namespace flow label reflection"), for some TCP RST packets.
When RST packets are sent because no socket could be found,
it makes sense to use flowlabel_reflect sysctl to decide
if a reflection of the flowlabel is requested.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/tcp_ipv6.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index beaf284563015ef0677c39fc056e6ecde3518920..07684f1e02f773a9d3e22a86ae4e7b853cc0b73e 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -916,15 +916,17 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
{
const struct tcphdr *th = tcp_hdr(skb);
+ struct ipv6hdr *ipv6h = ipv6_hdr(skb);
u32 seq = 0, ack_seq = 0;
struct tcp_md5sig_key *key = NULL;
#ifdef CONFIG_TCP_MD5SIG
const __u8 *hash_location = NULL;
- struct ipv6hdr *ipv6h = ipv6_hdr(skb);
unsigned char newhash[16];
int genhash;
struct sock *sk1 = NULL;
#endif
+ __be32 label = 0;
+ struct net *net;
int oif = 0;
if (th->rst)
@@ -936,6 +938,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
if (!sk && !ipv6_unicast_destination(skb))
return;
+ net = dev_net(skb_dst(skb)->dev);
#ifdef CONFIG_TCP_MD5SIG
rcu_read_lock();
hash_location = tcp_parse_md5sig_option(th);
@@ -949,7 +952,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
* Incoming packet is checked with md5 hash with finding key,
* no RST generated if md5 hash doesn't match.
*/
- sk1 = inet6_lookup_listener(dev_net(skb_dst(skb)->dev),
+ sk1 = inet6_lookup_listener(net,
&tcp_hashinfo, NULL, 0,
&ipv6h->saddr,
th->source, &ipv6h->daddr,
@@ -979,9 +982,13 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
oif = sk->sk_bound_dev_if;
if (sk_fullsock(sk))
trace_tcp_send_reset(sk, skb);
+ } else {
+ if (net->ipv6.sysctl.flowlabel_reflect)
+ label = ip6_flowlabel(ipv6h);
}
- tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0, 0);
+ tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0,
+ label);
#ifdef CONFIG_TCP_MD5SIG
out:
--
2.22.0.rc1.311.g5d7573a151-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] ipv6: tcp: enable flowlabel reflection in some RST packets
2019-06-04 19:29 [PATCH net] ipv6: tcp: enable flowlabel reflection in some RST packets Eric Dumazet
@ 2019-06-05 1:16 ` Eric Dumazet
2019-06-05 1:31 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2019-06-05 1:16 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller; +Cc: netdev, Eric Dumazet
On 6/4/19 12:29 PM, Eric Dumazet wrote:
> This extends commit 22b6722bfa59 ("ipv6: Add sysctl for per
> namespace flow label reflection"), for some TCP RST packets.
>
> When RST packets are sent because no socket could be found,
> it makes sense to use flowlabel_reflect sysctl to decide
> if a reflection of the flowlabel is requested.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Please wait for a V2, I will use another bit from the sysctl to limit the
risk of regressions.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] ipv6: tcp: enable flowlabel reflection in some RST packets
2019-06-05 1:16 ` Eric Dumazet
@ 2019-06-05 1:31 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2019-06-05 1:31 UTC (permalink / raw)
To: eric.dumazet; +Cc: edumazet, netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 4 Jun 2019 18:16:00 -0700
> On 6/4/19 12:29 PM, Eric Dumazet wrote:
>> This extends commit 22b6722bfa59 ("ipv6: Add sysctl for per
>> namespace flow label reflection"), for some TCP RST packets.
>>
>> When RST packets are sent because no socket could be found,
>> it makes sense to use flowlabel_reflect sysctl to decide
>> if a reflection of the flowlabel is requested.
>>
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> Please wait for a V2, I will use another bit from the sysctl to limit the
> risk of regressions.
Ok.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-05 1:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-04 19:29 [PATCH net] ipv6: tcp: enable flowlabel reflection in some RST packets Eric Dumazet
2019-06-05 1:16 ` Eric Dumazet
2019-06-05 1:31 ` David Miller
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).