From 0b81b32c95f6643936d0894671d0b00809fe22d6 Mon Sep 17 00:00:00 2001 From: Bhasker Hariharan Date: Fri, 21 Jan 2022 09:52:49 -0800 Subject: [PATCH] Do not reject TCP SYN w/ ECN flags set. This change does not add support for ECN flags in Netstack. It just ensures we don't reject valid SYN packets with ECN bits set. For a complete ECN implementation we would need to implement the following section https://datatracker.ietf.org/doc/html/rfc3168#section-6 as well as the IP bits to set the ECN bits accordingly. Fixes #7075 PiperOrigin-RevId: 423345617 --- pkg/tcpip/header/tcp.go | 8 +- pkg/tcpip/header/tcp_test.go | 18 ++-- pkg/tcpip/transport/tcp/BUILD | 1 + pkg/tcpip/transport/tcp/accept.go | 2 +- pkg/tcpip/transport/tcp/forwarder.go | 4 +- pkg/tcpip/transport/tcp/forwarder_test.go | 101 ++++++++++++++++++ pkg/tcpip/transport/tcp/tcp_test.go | 96 +++++++++++------ .../transport/tcp/testing/context/context.go | 2 +- test/packetimpact/testbench/layers_test.go | 2 +- 9 files changed, 188 insertions(+), 46 deletions(-) create mode 100644 pkg/tcpip/transport/tcp/forwarder_test.go diff --git a/pkg/tcpip/header/tcp.go b/pkg/tcpip/header/tcp.go index e82e9d9c1..568ee5d7e 100644 --- a/pkg/tcpip/header/tcp.go +++ b/pkg/tcpip/header/tcp.go @@ -60,7 +60,7 @@ func (f TCPFlags) Contains(o TCPFlags) bool { // String implements Stringer.String. func (f TCPFlags) String() string { - flagsStr := []byte("FSRPAU") + flagsStr := []byte("FSRPAUEC") for i := range flagsStr { if f&(1<