Page MenuHomeFreeBSD

Explicitly set IP ECN header codepoint properly
ClosedPublic

Authored by rscheff on Feb 2 2022, 11:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Feb 26, 10:33 PM
Unknown Object (File)
Feb 10 2025, 2:41 AM
Unknown Object (File)
Feb 8 2025, 1:08 AM
Unknown Object (File)
Jan 28 2025, 1:31 PM
Unknown Object (File)
Jan 25 2025, 5:36 PM
Unknown Object (File)
Dec 5 2024, 6:12 PM
Unknown Object (File)
Dec 3 2024, 5:58 AM
Unknown Object (File)
Dec 1 2024, 3:02 AM
Subscribers

Details

Summary

TCP RACK appears to cache the IP header when preparing
a new TCP packet for transmission - other than the base
stack.

As the IP ECN codepoint is only "OR"ed in, bits can
apparently only be set, but not reset, if the ECN
protocol needs them changed.

By masking out the IP ECN codepoint first in the IP TOS
byte, and then setting it subsequently, the correct
IP ECN codepoints get set in the IP header.

Test Plan

// Simultaneous Open

Establish a regular TCP ECN connection.
+0.0 echo 'parallel open: ECN'
+0.10 sysctl net.inet.tcp.ecn.enable=1
+0.40 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0.01 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0.01 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0.01 setsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=1, linger=0}, 8) = 0
+0.01 setsockopt(3, SOL_SOCKET, SO_DEBUG, [1], 4) = 0
+0.04 connect(3, ..., ...) = -1
EINPROGRESS
+0.00 >[noecn] SEW 0:0(0) win 65535 <...>
+0.00 <[noecn] SEW 0:0(0) ack 1 win 65535 <mss 1000>
+0.00 >[noecn] SE. 0:0(0) ack 1 win 65535 <...>
+0.00 <[noecn] SE. 0:0(0) ack 1 win 65535 <mss 1000>
+0.00 >[noecn] . 1:1(0) ack 1 win 65535
+0.01 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+0.01 fcntl(3, F_SETFL, O_RDWR) = 0
+0.05 write(3, ..., 1000) = 1000
+0.00 >[ect0] PW. 1:1001(1000) ack 1 win 65535
+0.00 <[noecn] E. 1:1(0) ack 1001 win 65535
+0.05 write(3, ..., 1000) = 1000
+0.00 >[ect0] PW. 1001:2001(1000) ack 1 win 65535
+0.00 <[ce] . 1:2(1) ack 2001 win 65535

// rack: ect0 prior to this change
+0.00 >[noecn] E. 2001:2001(0) ack 2 win 65535
+0.00 close(3) = 0

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable