Skip to content

fix(agent): leak IPv6 host routes to the underlay - #4543

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-2391
Aug 5, 2026
Merged

fix(agent): leak IPv6 host routes to the underlay#4543
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-2391

Conversation

@chet

@chet chet commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Historically, TmplConfigPort.IPs has carried both IPv4 and IPv6 addresses so one port can render as dual stack. The underlay leak rule also iterates IPs, though, which means an IPv6 prefix can wind up under ALLOW_TO_UNDERLAY_PREFIX_LIST while the IPv6 list keeps only its default deny.

So, split each port's interface and SVI addresses into IPs/IPsIpv6 and SviIPs/SviIPsIpv6 before Gtmpl sees them. Rust now also prepares the final family-specific leak inputs: IPv4 keeps the existing gateway CIDR behavior, and IPv6 uses HostIPv6Route. FNN only renders those prepared lists, while ETV renders both address buckets so its existing dual-stack behavior stays the same.

The tests cover dual-stack FNN and ETV interfaces, dual-stack SVI and VRR addresses, profile gating, and an enabled IPv4-only VPC. They also check the exact prefixes in each allow-list and keep the IPv6 default deny in place.

Related issues

This supports #2391

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Validation:

  • cargo test -p carbide-agent --lib -- 199 passed
  • cargo make format-nightly
  • cargo make clippy
  • cargo make carbide-lints

Additional Notes

TmplConfigPort remains one logical port. Only its family-sensitive address collections are separated before templating, which avoids duplicating interface stanzas. IPs remains the IPv4 gateway CIDR source for compatibility; IPv6 deliberately uses HostIPv6Route.

Closes #2391

@chet
chet requested a review from a team as a code owner August 4, 2026 22:20
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: eb7f4380-b736-4be6-8207-a123e2aeea4f

📥 Commits

Reviewing files that changed from the base of the PR and between 01db078 and a8d5c81.

📒 Files selected for processing (4)
  • crates/agent/src/nvue.rs
  • crates/agent/templates/nvue_startup_etv.conf
  • crates/agent/templates/nvue_startup_fnn.conf
  • crates/agent/templates/tests/nvue_build_fnn_dual_stack.yaml.expected

Summary by CodeRabbit

  • New Features

    • Added IPv6 address configuration for FNN interfaces, L2 SVIs, ETV VLAN interfaces, and SVI VRRP addresses.
    • Added IPv6 tenant host-route leakage support when enabled by the routing profile.
    • Improved IPv4 and IPv6 underlay prefix handling using gateway network ranges.
  • Bug Fixes

    • Corrected dual-stack prefix-list rules for appropriate IPv4 and IPv6 underlay prefixes.
    • Ensured route-leaking behavior consistently follows routing-profile settings.

Walkthrough

The change separates IPv4 and IPv6 NVUE address data, computes family-specific tenant host routes, renders dual-stack interface and underlay configuration, and adds routing-profile tests for FNN, L2, and ETV paths.

Changes

Dual-stack underlay leakage

Layer / File(s) Summary
Template data and leakage detection
crates/agent/src/nvue.rs
TmplConfigPort stores IPv4 and IPv6 gateway and SVI addresses separately. TmplNvue receives family-specific tenant host routes and leakage indicators. YAML mapping validation now rejects unsupported shapes and non-string keys.
NVUE dual-stack rendering
crates/agent/templates/nvue_startup_fnn.conf, crates/agent/templates/nvue_startup_etv.conf
FNN interfaces, SVIs, VRRP addresses, and ETV VLAN interfaces render IPv6 addresses. FNN underlay prefix lists use precomputed IPv4 and IPv6 route data.
Dual-stack leakage validation
crates/agent/src/nvue.rs, crates/agent/templates/tests/nvue_build_fnn_dual_stack.yaml.expected
Shared fixtures and parameterized tests validate family-specific address rendering and routing-profile-controlled IPv4 and IPv6 permit rules. Golden output includes rule 65002 for both address families.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VPCConfiguration
  participant TmplNvue
  participant FNNTemplate
  participant UnderlayPrefixLists
  VPCConfiguration->>TmplNvue: provide separated addresses and tenant host routes
  TmplNvue->>FNNTemplate: render IPv4 and IPv6 interface data
  TmplNvue->>FNNTemplate: pass family-specific leakage indicators and routes
  FNNTemplate->>UnderlayPrefixLists: render conditional IPv4 and IPv6 permit rules
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing IPv6 host-route leakage to the underlay.
Description check ✅ Passed The description directly explains the IPv4 and IPv6 template changes, testing, and underlay leakage fix.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@chet

chet commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@chet: I will perform a complete review of pull request #4543.

ᕱᕱ

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
crates/agent/src/nvue.rs (1)

2410-2446: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an IPv4-only FNN leakage scenario.

The current scenarios only use a dual-stack port. Add a profile-enabled case with host_ipv6_route: None or an empty route. Assert that IPv4 rule 65002 exists, IPv6 rule 65002 does not exist, and IPv6 rule 65535 remains the deny rule.

As per PR objectives, IPv4-only VPCs must retain a deny-only IPv6 list.

🤖 Prompt for 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.

In `@crates/agent/src/nvue.rs` around lines 2410 - 2446, Add an IPv4-only scenario
to test_build_fnn_dual_stack_leaks_follow_profile by configuring the FNN profile
with host_ipv6_route absent or empty while leakage is enabled. Extend the
collected assertions to verify IPv4 rule 65002 exists, IPv6 rule 65002 is
absent, and the IPv6 prefix list retains deny rule 65535, while preserving the
existing dual-stack cases.
🤖 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.

Nitpick comments:
In `@crates/agent/src/nvue.rs`:
- Around line 2410-2446: Add an IPv4-only scenario to
test_build_fnn_dual_stack_leaks_follow_profile by configuring the FNN profile
with host_ipv6_route absent or empty while leakage is enabled. Extend the
collected assertions to verify IPv4 rule 65002 exists, IPv6 rule 65002 is
absent, and the IPv6 prefix list retains deny rule 65535, while preserving the
existing dual-stack cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f133a016-d9c1-453e-bfdc-ba6f8191058f

📥 Commits

Reviewing files that changed from the base of the PR and between adced9f and 253e5f1.

📒 Files selected for processing (3)
  • crates/agent/src/nvue.rs
  • crates/agent/templates/nvue_startup_fnn.conf
  • crates/agent/templates/tests/nvue_build_fnn_dual_stack.yaml.expected

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
crates/agent/src/nvue.rs (1)

2410-2444: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an enabled IPv4-only scenario. Extend the table with an enabled profile and host_ipv6_route: None; assert IPv4 rule 65002 exists, IPv6 rule 65002 is absent, and IPv6 rule 65535 still denies all traffic.

🤖 Prompt for 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.

In `@crates/agent/src/nvue.rs` around lines 2410 - 2444, Extend the scenarios in
test_build_fnn_dual_stack_leaks_follow_profile with an enabled IPv4-only
configuration using host_ipv6_route: None. Assert that IPv4 prefix-list rule
65002 exists, IPv6 rule 65002 is absent, and IPv6 rule 65535 remains present to
deny all traffic.

Source: Path instructions

🤖 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.

Nitpick comments:
In `@crates/agent/src/nvue.rs`:
- Around line 2410-2444: Extend the scenarios in
test_build_fnn_dual_stack_leaks_follow_profile with an enabled IPv4-only
configuration using host_ipv6_route: None. Assert that IPv4 prefix-list rule
65002 exists, IPv6 rule 65002 is absent, and IPv6 rule 65535 remains present to
deny all traffic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: df675ad2-0a10-4f70-8541-098b7772b0a1

📥 Commits

Reviewing files that changed from the base of the PR and between adced9f and 253e5f1.

📒 Files selected for processing (3)
  • crates/agent/src/nvue.rs
  • crates/agent/templates/nvue_startup_fnn.conf
  • crates/agent/templates/tests/nvue_build_fnn_dual_stack.yaml.expected

Historically, `TmplConfigPort.IPs` has carried both IPv4 and IPv6 addresses so one port can render as dual stack. The underlay leak rule also iterates `IPs`, though, which means an IPv6 prefix can wind up under `ALLOW_TO_UNDERLAY_PREFIX_LIST` while the IPv6 list keeps only its default deny.

So, split each port's interface and SVI addresses into `IPs`/`IPsIpv6` and `SviIPs`/`SviIPsIpv6` before Gtmpl sees them. Rust now also prepares the final family-specific leak inputs: IPv4 keeps the existing gateway CIDR behavior, and IPv6 uses `HostIPv6Route`. FNN only renders those prepared lists, while ETV renders both address buckets so its existing dual-stack behavior stays the same.

The tests cover dual-stack FNN and ETV interfaces, dual-stack SVI and VRR addresses, profile gating, and an enabled IPv4-only VPC. They also check the exact prefixes in each allow-list and keep the IPv6 default deny in place.

This supports NVIDIA#2391

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@chet

chet commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@chet: I will perform a complete review of pull request #4543.

ᕱᕱ

✅ Action performed

Full review finished.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

@chet
chet merged commit 858b03b into NVIDIA:main Aug 5, 2026
64 checks passed
@chet
chet deleted the gh-issue-2391 branch August 5, 2026 18:49
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.

Underlay/02 — IPv6 host-route leaks to the underlay

2 participants