test: cover tcp_conntrack seq wraparound + exhaustive FSM index scan#82
Merged
Conversation
Two residual gaps from the test-coverage analysis of PR #72/#75's conntrack work (existing tests only exercised seq deltas far from the wrap point, and the constructor-built dispatch index was never scanned against the full state x event space): - test_seq_wraparound (8 assertions): tcp_conntrack_seq_update advances max_seq_end/max_ack across the 0xFFFFFFFF→0 boundary via the wrap-aware signed compare; stale pre-wrap seq/ack cannot roll the max back after the baseline crosses 0; the explicit ==0 seed guard fires for an ISN >= 2^31 (which looks "older than zero" under signed math). tcp_conntrack_seq_valid accepts in-window seq/ack just past the wrap (unsigned distance ~4G, signed delta tiny) and still drops seq >16MB and ack >0xFFFF past the wrap. - test_fsm_index_full_scan (11 assertions): mirrors tcp_conntrack_tbl as an expected-next-state matrix and drives tcp_conntrack_fsm through all 10x6 (state, event) combinations — defined rows must land on the table's next_state, undefined rows must keep the state and return SUCCESS (no state may hit the no-rows ERROR contract since every state has rows). Catches future table edits or index-build drift. Existing cases untouched. make test 1404/1404; e2e 73/73 PASS 0 SKIP. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Two residual
tcp_conntrackgaps from the test-coverage analysis of the PR #72/#75 conntrack work: the seq/ack window tests only exercised deltas far from the 32-bit wrap point, and the constructor-built O(1) FSM dispatch index was never verified against the full state × event space. Test-only change; no production code touched.New cases in
unit_test/pppd/tcp_conntrack_test.c(19 assertions)test_seq_wraparound(8)tcp_conntrack_seq_updateadvancesmax_seq_end/max_ackacross the0xFFFFFFFF → 0boundary (wrap-aware signed compare: unsigned distance ~4G, signed delta tiny positive)== 0seed guard fires for an ISN ≥ 2³¹ — without it the ISN looks "older than zero" under signed math and the baseline would never advancetcp_conntrack_seq_validaccepts in-window seq and ack just past the wrap, and still enforces the 16 MB seq slack and 0xFFFF ack slack across the wrap (both drop sides verified)test_fsm_index_full_scan(11)tcp_conntrack_tblas an expected-next-state matrix and drivestcp_conntrack_fsmthrough all 10 × 6 (state, event) combinations:next_stateSUCCESS(no state may hit the no-rowsERRORcontract, since every state has at least one row)MID_STREAM → ESTABLISHEDpromotion is handler-driven and already covered by the existing promotion testsExisting cases untouched.
Testing
make test: 1404/1404 passe2e_test/run_e2e_test.sh: 73 PASS / 0 FAIL / 0 SKIP