Skip to content

Fixed static-route compaction during interface detach - #482

Merged
fdesbiens merged 2 commits into
eclipse-threadx:devfrom
tinic:codex/fix-static-route-detach-compaction
Oct 16, 2026
Merged

fdesbiens merged 2 commits into
eclipse-threadx:devfrom
tinic:codex/fix-static-route-detach-compaction

Conversation

@tinic

@tinic tinic commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Detaching an interface with a full static-route table currently reads one entry beyond the array. When two routes for that interface are adjacent, the removal loop skips the route shifted into the current slot and leaves it pointing at the detached interface. The loop now stops at the last entry and rechecks the current slot after each removal.

The existing interface-detach regression now fills the route table, detaches the second interface, and checks that all its routes are removed while the route through the first interface survives. This exercises both the full-table boundary and adjacent removals.

Validation: Clang C99 syntax checks passed for the changed source and regression test with IPv4 and IPv6 configurations. The completed Linux v4_full_build CI run passed 895/895 tests, including the expanded detach regression. A separate Clang source-coverage fixture compiled the actual nx_ip_interface_detach.c with NX_ENABLE_IP_STATIC_ROUTING, NX_DISABLE_IPV6, and four physical interfaces. It exercised an empty table and three full eight-entry tables (mixed adjacent removals, all removed, and none removed): every executable line in the changed route loop ran, and all three loop conditions had both outcomes (6/6 branches). Whole-file coverage in this focused fixture was 72.16% line and 59.09% branch because unrelated detach paths were outside its scope. git diff --check passed. The macOS host could not run ThreadX's Linux port.

Detaching an interface with a full static-route table read one entry past the
array. The removal loop also skipped a route shifted into the current slot,
leaving adjacent routes bound to the detached interface.

Stop shifting at the last entry and recheck the current slot after removal.
Extend the interface-detach regression to fill the table, remove adjacent
routes, and verify that a route on the surviving interface remains.

Clang C99 syntax checks passed for IPv4 and IPv6 variants. The Linux
v4_full_build regression suite is selected by upstream CI.

Assisted-by: Claude Code (Opus 5.5) <noreply@anthropic.com>
Assisted-by: Codex (gpt-6.1-sol) <codex@openai.com>
@fdesbiens fdesbiens self-assigned this Oct 15, 2026
@fdesbiens
fdesbiens self-requested a review October 15, 2026 12:48
@fdesbiens

Copy link
Copy Markdown
Contributor

Hi @tinic.

Welcome back! I should be able to review this next week.

@fdesbiens fdesbiens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tinic. Thank you for this contribution. The corrected shift bound and recheck of the current slot address both route-removal defects. The completed v4_full_build CI run passed 895/895 tests, including the expanded interface-detach regression. Could you update the PR’s proof paragraph with that result and report line and branch coverage for the changed loop in a profile with NX_ENABLE_IP_STATIC_ROUTING? The published coverage reports use profiles without that option, so they do not measure these branches.

@tinic

tinic commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

The proof paragraph is updated with the completed v4_full_build result (895/895) and focused static-routing coverage. A Clang fixture compiled the actual nx_ip_interface_detach.c with NX_ENABLE_IP_STATIC_ROUTING, NX_DISABLE_IPV6, and four physical interfaces. It covered the empty table and full tables with mixed adjacent removals, all routes removed, and no routes removed: every executable line in the changed loop ran, with all 6/6 branch outcomes covered. This is focused loop coverage; the whole-file figures are 72.16% line and 59.09% branch. All current-head PR checks are now green.

The two modified C files used block comments for their AI disclosure lines,
which differed from the established single-line source header format.

Placed the standard single-line marker directly below each license header.
The routing logic and regression behavior are unchanged.

The diff passed whitespace checks. No test suite was rerun for this comment-only
change; the preceding PR head passed its full CI matrix.

Assisted-by: Codex (GPT-6) <noreply@openai.com>

@fdesbiens fdesbiens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tinic. Thank you for this contribution. The corrected shift bound and recheck of the current slot address both route-removal defects. Thanks for adding the coverage result: your focused static-routing fixture covered all 6/6 changed-loop branches, and the completed v4_full_build CI run passed 895/895 tests. I aligned the disclosure markers beneath the license headers in both modified C files; that commit changes comments only. Approved.

@fdesbiens
fdesbiens merged commit 2cd5aa4 into eclipse-threadx:dev Oct 16, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants