Repository navigation
AROSTCP: what a segment that is not the peer's may change - #2448
Merged
Kalamatee merged 4 commits intoNov 30, 2026
Merged
Conversation
tcp_dooptions() took the options of any SYN over, before anything else of the segment was looked at: one on an established connection, of any sequence number, changed its MSS, its window scale and ts_recent. With a timestamp newer than the peer's, PAWS then dropped all the peer sent. The segment itself was answered with a challenge ACK (RFC 5961 section 4), too late. They count now only in a state in which a SYN may open the connection (RFC 9293 section 3.7.1).
A segment wholly before the window is kept for its ACK or RST, but its timestamp was recorded too: SEG.SEQ <= Last.ACK.sent was the only condition. RFC 7323 section 5.3 rejects one outside the window (R2) before it takes the timestamp (R3). Any such segment with a newer timestamp made PAWS drop what the peer sent next. The segment must now reach the last ACK sent, as in FreeBSD's tcp_input().
RFC 5961 section 4.2 has a SYN in a synchronized state answered with a challenge ACK irrespective of its sequence number. One before the window lost its SYN in the trimming, and was dropped without an answer: a peer that restarted, whose new SYN came to be there, learned nothing of the old connection and repeated the SYN until it gave up. The SYN is now checked before the timestamps and the trimming, as FreeBSD does. TIME_WAIT stays as it was.
Segments made with a raw socket over loopback, IPv4 and IPv6, on a connection that has its handshake behind it: SYNs without options, with timestamps and with an MSS, ACKs outside the window with timestamps, and the challenge ACKs a SYN gets in ESTABLISHED, CLOSE_WAIT and FIN_WAIT_2. Before: at least ten of the fourteen tests fail; now none.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What a segment that is not the peer's may change on a connection: nothing. Three fixes in
tcp_input(), one commit each, and the test; the revision bump is in the last one: 5.53, kernel v0.92.Scope
tcp_dooptions()took the options of any SYN over before anything else of the segment was looked at. One on an established connection, whatever its sequence number, changed its MSS, its window scale andts_recent; with a timestamp newer than the peer's, PAWS then dropped all the peer sent. Someone who cannot see the connection needs only its addresses and ports.Not changed: in SYN_SENT the options are still taken before the ACK is checked, as in FreeBSD.
Validation
New CUnit test,
cunit-net-tcpsynopt: segments made with a raw socket over loopback, IPv4 and IPv6. The connection's numbers are not known to it: it sends sequence numbers and timestamps half the space apart, all four combinations on one connection, so that one of them is always the one that matters.On the master the number varies in the SYN-with-ACK cases, whose ACK number is not the connection's.
cunit-net-*programs on hosted, two tap.device units, dual stack: 443 tests, 0 failures.rst_probe7 of 7 cases,listen_probe,tsval_probeandloss_probeas on master.transport.prothas 134 bytes more of text (50801 to 50935).One more run of the A3000 with this did not get through its startup in 240 s, the test not begun; it has not happened again in the four that followed, and its cause is not known.
Not tested: real hardware. The m68k system was master 83004d5 with this transport.prot.