Skip to content

Commit ba9e04a

Browse files
tracywwnjdavem330
authored andcommitted
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: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Wei Wang <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6fd40d3 commit ba9e04a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv4/ip_output.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include <net/icmp.h>
7575
#include <net/checksum.h>
7676
#include <net/inetpeer.h>
77+
#include <net/inet_ecn.h>
7778
#include <net/lwtunnel.h>
7879
#include <linux/bpf-cgroup.h>
7980
#include <linux/igmp.h>
@@ -1703,7 +1704,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
17031704
if (IS_ERR(rt))
17041705
return;
17051706

1706-
inet_sk(sk)->tos = arg->tos;
1707+
inet_sk(sk)->tos = arg->tos & ~INET_ECN_MASK;
17071708

17081709
sk->sk_protocol = ip_hdr(skb)->protocol;
17091710
sk->sk_bound_dev_if = arg->bound_dev_if;

0 commit comments

Comments
 (0)