Skip to contentSkip to conversation

ip: fix tos reflection in ack and reset packets

PATCH In review Wei Wang 2 participants 2 messages Sep 8, 2020 – Sep 9, 2020

Subsystems (3)
lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH 1/1 ip: fix tos reflection in ack and reset packets

Currently, in tcp_v4_reqsk_send_ack() and tcp_v4_send_reset(), we echo the TOS value of the received packets in the response. However, we do not want to echo the lower 2 ECN bits in accordance with RFC 3168 6.1.5 robustness principles.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 net/ipv4/ip_output.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/ip_output.c +2 -1
index 61f802d5350c..e6f2ada9e7d5 100644
@@ -74,6 +74,7 @@
 #include <net/icmp.h>
 #include <net/checksum.h>
 #include <net/inetpeer.h>
+#include <net/inet_ecn.h>
 #include <net/lwtunnel.h>
 #include <linux/bpf-cgroup.h>
 #include <linux/igmp.h>
@@ -1703,7 +1704,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
 	if (IS_ERR(rt))
 		return;
 
-	inet_sk(sk)->tos = arg->tos;
+	inet_sk(sk)->tos = arg->tos & ~INET_ECN_MASK;
 
 	sk->sk_protocol = ip_hdr(skb)->protocol;
 	sk->sk_bound_dev_if = arg->bound_dev_if;
Signature · 1 line
2.28.0.526.ge36021eeef-goog
maintainer
#1 lore raw

From: Wei Wang <[email protected]>
Date: Tue, 8 Sep 2020 14:09:34 -0700

Quoted 9 lines

Currently, in tcp_v4_reqsk_send_ack() and tcp_v4_send_reset(), we echo the TOS value of the received packets in the response. However, we do not want to echo the lower 2 ECN bits in accordance with RFC 3168 6.1.5 robustness principles.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

Applied and queued up for -stable, thanks.