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)
Thu, Oct 24, 2:55 AM
Unknown Object (File)
Wed, Oct 23, 8:19 PM
Unknown Object (File)
Oct 4 2024, 11:03 AM
Unknown Object (File)
Sep 20 2024, 6:16 PM
Unknown Object (File)
Sep 19 2024, 10:16 PM
Unknown Object (File)
Sep 19 2024, 5:22 PM
Unknown Object (File)
Sep 18 2024, 1:08 AM
Unknown Object (File)
Sep 16 2024, 3:22 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