More routing sanities - #1675
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesThe routing path now validates fib entries before adding them to groups, supports egress creation from resolved addresses, and encapsulates fibgroup storage behind accessors. Tests cover resolved and DROP outcomes, while packet egress metadata assignment and logging handle absent interface data. Routing and egress resolution
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 inconclusive)
✅ Passed checks (3 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@routing/src/rib/nexthop.rs`:
- Around line 919-962: Update test_nhop_instruction_build_and_fibroup so both
fibgroup entries are validated: collect the egress (ifindex, address) pair from
e1 and e2, then compare the resulting set or list against the two expected
interface/address pairs, preserving order independence and ensuring neither
entry can be incorrect.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ce183423-b6a4-44da-83c6-f79e5b6f13ca
📒 Files selected for processing (5)
dataplane/src/packet_processor/ipforward.rsrouting/src/fib/fibgroupstore.rsrouting/src/fib/fibobjects.rsrouting/src/rib/nexthop.rsrouting/src/rib/rib2fib.rs
There was a problem hiding this comment.
Pull request overview
This PR tightens routing/FIB “sanity” behavior by ensuring unresolved or invalid next-hop resolution results don’t accidentally get committed as usable forwarding entries, and by making egress-resolution intent clearer through both code and tests.
Changes:
- Emit
Egressinstructions for next-hops that have an address even when they don’t yet have anifindex, enabling correct recursive resolution behavior. - Add
FibEntry::is_valid()and use it during next-hop → fibgroup construction to ignore invalid leaf entries and only inject a DROP when the resulting group is empty. - Encapsulate
FibGroupinternals (privateentries) and add safe accessors; update call sites and add new unit tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| routing/src/rib/rib2fib.rs | Improves next-hop instruction generation and validates/sanitizes leaf fib entries before committing to groups. |
| routing/src/rib/nexthop.rs | Adds new sanity/unit tests around instruction building and DROP insertion behavior. |
| routing/src/fib/fibobjects.rs | Makes FibGroup.entries private, adds entries_mut(), and introduces FibEntry::is_valid(). |
| routing/src/fib/fibgroupstore.rs | Updates indexing and test helpers to use the new FibGroup accessors. |
| dataplane/src/packet_processor/ipforward.rs | Simplifies egress metadata assignment and logs when an egress object lacks an outgoing interface. |
qmonnet
left a comment
There was a problem hiding this comment.
I'd appreciate a comment to explain why a FIB entry is valid or not, but that's not blocking. Looks good otherwise, thanks!
Add method to validate a fib entries and replace by a drop if the entry is not correct. Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
f4b99e1 to
ba8a2e7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
routing/src/fib/fibobjects.rs:132
confidence: 8
tags: [style]
`FibGroup::entries_mut()` is only used from `#[cfg(test)]` code right now, but it’s exposed as a public API. This widens the public surface and lets callers arbitrarily mutate the internal `Vec`, undermining the intent of making `entries` private.
Consider restricting it to `pub(crate)` (or gating it under `#[cfg(test)]`) unless there’s a concrete external consumer that needs mutable access.
pub fn entries_mut(&mut self) -> &mut Vec<FibEntry> {
</details>
No description provided.