Skip to content

More routing sanities - #1675

Open
Fredi-raspall wants to merge 2 commits into
mainfrom
pr/fredi/routing_sanities2
Open

More routing sanities#1675
Fredi-raspall wants to merge 2 commits into
mainfrom
pr/fredi/routing_sanities2

Conversation

@Fredi-raspall

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 30, 2026 14:42
@Fredi-raspall
Fredi-raspall requested a review from a team as a code owner July 30, 2026 14:42
@Fredi-raspall
Fredi-raspall requested review from daniel-noland and removed request for a team July 30, 2026 14:42
@Fredi-raspall Fredi-raspall added the ci:+vlab Enable VLAB tests label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 42859616-d68e-450b-aa87-c8d08610081e

📥 Commits

Reviewing files that changed from the base of the PR and between f4b99e1 and ba8a2e7.

📒 Files selected for processing (5)
  • dataplane/src/packet_processor/ipforward.rs
  • routing/src/fib/fibgroupstore.rs
  • routing/src/fib/fibobjects.rs
  • routing/src/rib/nexthop.rs
  • routing/src/rib/rib2fib.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • routing/src/fib/fibgroupstore.rs

📝 Walkthrough

Walkthrough

Changes

The 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

Layer / File(s) Summary
FIB accessors and entry validation
routing/src/fib/fibobjects.rs, routing/src/fib/fibgroupstore.rs
FibGroup entries are accessed through methods, and FibEntry::is_valid() classifies instruction sequences before storage.
Next-hop instruction and fibgroup construction
routing/src/rib/rib2fib.rs, routing/src/rib/nexthop.rs
Non-local nexthops emit Egress instructions when an interface or address exists; invalid recursive results are omitted, with DROP insertion for empty groups. Tests cover resolved entries and DROP substitution.
Packet egress metadata handling
dataplane/src/packet_processor/ipforward.rs
Egress execution directly assigns optional interface and address metadata and logs whether an outgoing interface is present.

Possibly related PRs

Suggested reviewers: daniel-noland, copilot, qmonnet

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is relevant, but it is too generic to convey the main routing changes. Use a concise title that names the primary change, such as the fib/nexthop routing sanity updates.
Description check ❓ Inconclusive No pull request description was provided, so the intended change cannot be assessed from the description. Add a short description summarizing the routing and fib/nexthop sanity changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between ce05789 and f4b99e1.

📒 Files selected for processing (5)
  • dataplane/src/packet_processor/ipforward.rs
  • routing/src/fib/fibgroupstore.rs
  • routing/src/fib/fibobjects.rs
  • routing/src/rib/nexthop.rs
  • routing/src/rib/rib2fib.rs

Comment thread routing/src/rib/nexthop.rs

Copilot AI 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.

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 Egress instructions for next-hops that have an address even when they don’t yet have an ifindex, 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 FibGroup internals (private entries) 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.

Comment thread routing/src/rib/nexthop.rs Outdated
Comment thread routing/src/rib/nexthop.rs
Comment thread routing/src/fib/fibobjects.rs Outdated

@qmonnet qmonnet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd appreciate a comment to explain why a FIB entry is valid or not, but that's not blocking. Looks good otherwise, thanks!

Comment thread routing/src/fib/fibobjects.rs
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>
Copilot AI review requested due to automatic review settings July 30, 2026 17:07
@Fredi-raspall
Fredi-raspall force-pushed the pr/fredi/routing_sanities2 branch from f4b99e1 to ba8a2e7 Compare July 30, 2026 17:07

Copilot AI 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.

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:+vlab Enable VLAB tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants