Skip to main content

6.1.1 TCP Initialization

6.1.1 TCP Initialization

During the TCP connection establishment phase, the source and destination TCPs exchange information about their willingness to use ECN. After this negotiation phase is complete, the TCP sender sets the ECT codepoint in the IP header of data packets to indicate to the network that the transport is willing and able to participate in ECN for this packet. This indicates to routers that they may mark this packet with the CE codepoint if they wish to use that as a method of congestion notification. If the TCP connection does not wish to use ECN notification for a particular data packet, then the sending TCP sets the ECN codepoint to not-ECT, and the TCP receiver ignores the CE codepoint in received packets.

In this discussion, we will designate the host initiating the connection as host A, and the host responding as host B. We will refer to a SYN packet with both the ECE and CWR flags set as an "ECN-setup SYN packet", and refer to a SYN packet with at least one of the ECE and CWR flags not set as a "non-ECN-setup SYN packet". Similarly, we will refer to a SYN-ACK packet with only the ECE flag set but not the CWR flag as an "ECN-setup SYN-ACK packet", and refer to a SYN-ACK packet with any other configuration of the ECE and CWR flags as a "non-ECN-setup SYN-ACK packet".

Before a TCP connection can use ECN, host A sends an ECN-setup SYN packet, and host B sends an ECN-setup SYN-ACK packet. For a SYN packet, the simultaneous setting of the ECN-Echo and CWR flags in an ECN-setup SYN packet is defined as an indication that the TCP transmitting the SYN packet is ECN-capable, not as an indication of congestion or of a response to congestion. More precisely, an ECN-setup SYN packet indicates that the TCP implementation transmitting the SYN packet will participate in ECN both as a sender and as a receiver. In particular, as a receiver it will respond to incoming data packets with the CE codepoint set in the IP header by setting ECE in outgoing TCP acknowledgement (ACK) packets. As a sender, it will respond to incoming packets with ECE set by reducing the congestion window and setting CWR at the appropriate time. An ECN-setup SYN packet does not commit the TCP sender to set the ECT codepoint in any or all of the packets that it might transmit. However, the commitment to respond appropriately to incoming data packets with the CE codepoint set remains even if the TCP sender transmits subsequent SYN packets without the ECE and CWR flags within this TCP connection.

When host B sends an ECN-setup SYN-ACK packet, it sets the ECE flag but not the CWR flag. An ECN-setup SYN-ACK packet is defined as an indication that the TCP transmitting the SYN-ACK packet is ECN-capable. As with the SYN packet, an ECN-setup SYN-ACK packet does not commit the TCP host to set the ECT codepoint in transmitted packets.

The following rules apply to sending ECN-setup packets within a TCP connection, where a TCP connection is defined by the standard rules for TCP connection establishment and termination.

  • If a host receives an ECN-setup SYN packet, then it MAY send an ECN-setup SYN-ACK packet. Otherwise, it MUST NOT send an ECN-setup SYN-ACK packet.

  • A host MUST NOT set ECT on a packet unless it has sent at least one ECN-setup SYN or ECN-setup SYN-ACK packet, and has received at least one ECN-setup SYN or ECN-setup SYN-ACK packet, and has not sent any non-ECN-setup SYN or non-ECN-setup SYN-ACK packet. A host SHOULD NOT set ECT on a packet if it has received at least one non-ECN-setup SYN or non-ECN-setup SYN-ACK packet.

  • If a host has ever set the ECT codepoint on a packet, then that host MUST correctly set/clear the CWR TCP bit on all later packets in the connection.

  • If a host has sent at least one ECN-setup SYN or ECN-setup SYN-ACK packet, and has not received any non-ECN-setup SYN or non-ECN-setup SYN-ACK packet, then if that host receives a TCP packet with both ECT and CE codepoints set in the IP header, then that host MUST process the packet as specified for ECN-capable connections.

  • A host that is not willing to use ECN on a TCP connection SHOULD clear the ECE and CWR flags in all non-ECN-setup SYN and/or SYN-ACK packets that it sends to indicate this unwillingness. A receiver MUST correctly process all forms of non-ECN-setup SYN and SYN-ACK packets.

  • A host MUST NOT set ECT on SYN or SYN-ACK packets.

A TCP client enters the TIME-WAIT state after receiving a FIN-ACK, and transitions to the CLOSED state after a timeout. Many TCP implementations create a new TCP connection when a SYN packet within the window is received during the TIME-WAIT state. When a TCP host enters the TIME-WAIT or CLOSED state, it SHOULD forget any previous state about ECN negotiation for that connection.