From 596ae436ef8fdf767b29cb67a12745b02f61a994 Mon Sep 17 00:00:00 2001 From: Randall Stewart Date: Wed, 12 Feb 2020 13:04:19 +0000 Subject: [PATCH] This small fix makes it so we properly follow the RFC and only enable ECN when both the CWR and ECT bits our set within the SYN packet. Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D23645 --- sys/netinet/tcp_syncache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 98c90c561d13..e5f7dde531ca 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1668,7 +1668,8 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, sc->sc_peer_mss = to->to_mss; /* peer mss may be zero */ if (ltflags & TF_NOOPT) sc->sc_flags |= SCF_NOOPT; - if ((th->th_flags & (TH_ECE|TH_CWR)) && V_tcp_do_ecn) + if (((th->th_flags & (TH_ECE|TH_CWR)) == (TH_ECE|TH_CWR)) && + V_tcp_do_ecn) sc->sc_flags |= SCF_ECN; if (V_tcp_syncookies)