Page MenuHomeFreeBSD

tcp rack: fix sending
ClosedPublic

Authored by tuexen on Apr 3 2024, 10:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 5:17 AM
Unknown Object (File)
Oct 2 2024, 9:00 PM
Unknown Object (File)
Oct 2 2024, 12:19 AM
Unknown Object (File)
Sep 30 2024, 7:05 PM
Unknown Object (File)
Sep 30 2024, 10:26 AM
Unknown Object (File)
Sep 28 2024, 8:29 AM
Unknown Object (File)
Sep 27 2024, 9:36 AM
Unknown Object (File)
Sep 22 2024, 1:24 AM

Details

Summary

In rack_output(), idle is used as a boolean variable. So don't use it as an int and don't clear it afterwards. This avoids setting idle to false, when it is not intended.

Test Plan

Run the following packetdrill-script:

--tolerance_usecs=75000
--ip_version=ipv4

 0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0.000 setsockopt(3, IPPROTO_TCP, TCP_LOG, [4], 4) = 0
+0.000 setsockopt(3, IPPROTO_TCP, TCP_FUNCTION_BLK, {function_set_name="rack",
                                                     pcbcnt=0}, 36) = 0
+0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0.000 bind(3, ..., ...) = 0
+0.000 listen(3, 1) = 0
+0.000 < S     0:0(0)               win 32767 <mss 1000,sackOK,eol,eol>
+0.000 > S.    0:0(0)       ack   1 win 65535 <mss 1460,sackOK,eol,eol>
+0.050 <  .    1:1(0)       ack   1 win 32767
+0.000 accept(3, ..., ...) = 4
+0.000 close(3) = 0
+0.000 getsockopt(4, IPPROTO_TCP, TCP_MAXSEG, [1000], [4]) = 0
+0.000 send(4, ..., 2500, 0) = 2500
+0.000 >  .    1:1001(1000) ack    1 win 65535
+0.000 >  . 1001:2001(1000) ack    1 win 65535
+0.000 > P. 2001:2501(500)  ack    1 win 65535
+0.050 <  .    1:1(0)       ack 2501 win 32767
+1.000 < F.    1:1(0)       ack 2501 win 32767
+0.000 >  . 2501:2501(0)    ack    2 win 65535
+0.000 close(4) = 0
+0.000 > F. 2501:2501(0)    ack    2 win 65535
+0.050 <  .    2:2(0)       ack 2502 win 32767

Diff Detail

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

Event Timeline

if idle is used as a boolean, why not be consequent about it and declare it as such also? To prevent future misuses with numeric calculations...

if idle is used as a boolean, why not be consequent about it and declare it as such also? To prevent future misuses with numeric calculations...

I totally agree, but wanted to do that in a separate commit, since that has no functional change.

This revision is now accepted and ready to land.Apr 3 2024, 4:49 PM
This revision was automatically updated to reflect the committed changes.