Skip to content

Honor explicit DHCP for aliased networks#452

Open
s4heid wants to merge 1 commit into
cloudfoundry:mainfrom
s4heid:explicit-dhcp-settings
Open

Honor explicit DHCP for aliased networks#452
s4heid wants to merge 1 commit into
cloudfoundry:mainfrom
s4heid:explicit-dhcp-settings

Conversation

@s4heid

@s4heid s4heid commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What is this change about?

Honor explicit DHCP for aliased networks so both address families are grouped into one DHCP-enabled networkd unit. Preserve existing static alias behavior when use_dhcp is false.

Please provide contextual information.

An interface alias identifies which device a network belongs to when the CPI cannot provide a MAC address. It must not override the network's explicit use_dhcp setting.

Azure assigns control-plane static addresses through DHCP in the guest. For networks sharing a NIC, the CPI therefore supplies the same interface alias with use_dhcp set to true for both IPv4 and IPv6.

The agent previously treated every aliased network as static. Each address family was consequently written separately to the same networkd file, and the last write discarded the other family.

What tests have you run against this PR?

How should this change be described in bosh-agent release notes?

Something brief that conveys the change and is written with the Operator audience in mind.
See previous release notes for examples.

Does this PR introduce a breaking change?

No

Tag your pair, your PM, and/or team!

@a-hassanin

AI Review Feedback

All AI review comments (CodeRabbit, and Copilot when assigned) must be resolved before human reviewers will look at the PR. For each comment, either:

  • Make the suggested change, or
  • Reply to the comment explaining why it does not apply, then resolve the thread.

An interface alias identifies which device a network belongs to when the
CPI cannot provide a MAC address. It must not override the network's
explicit use_dhcp setting.

Azure assigns control-plane static addresses through DHCP in the guest.
For networks sharing a NIC, the CPI therefore supplies the same interface
alias with use_dhcp set to true for both IPv4 and IPv6.

The agent previously treated every aliased network as static. Each address
family was consequently written separately to the same networkd file, and
the last write discarded the other family.

Honor explicit DHCP for aliased networks so both address families are
grouped into one DHCP-enabled networkd unit. Preserve existing static alias
behavior when use_dhcp is false.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Updated DHCP selection to recognize explicitly enabled DHCP networks even when an alias is present. Added coverage for IPv4 and IPv6 DHCP networks sharing an alias, including interface configuration creation and combined systemd-networkd output with IPv6, router acceptance, and DNS settings.

Suggested reviewers: aramprice

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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.
Title check ✅ Passed The title clearly summarizes the main change: honoring explicit DHCP for aliased networks.
Description check ✅ Passed The description covers the change, context, tests, breaking change, and team tag; only the release-notes section remains a placeholder.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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

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 `@platform/net/interface_configuration_creator.go`:
- Around line 224-225: Update the DHCP/static branch condition in the network
interface configuration creator so DHCP networks with a non-empty Alias and no
explicit use_dhcp remain on the dynamic DHCP path. Do not require UseDHCP for
the implicit DHCP case; preserve the existing static path for genuinely static
configurations.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 4307a2fe-7fc8-4775-b3f4-7431f972ec33

📥 Commits

Reviewing files that changed from the base of the PR and between 2617b33 and e4830df.

📒 Files selected for processing (3)
  • platform/net/interface_configuration_creator.go
  • platform/net/interface_configuration_creator_test.go
  • platform/net/ubuntu_net_manager_ipv6_test.go

Comment thread platform/net/interface_configuration_creator.go
@github-project-automation github-project-automation Bot moved this from Waiting for Changes | Open for Contribution to Pending Merge | Prioritized in Foundational Infrastructure Working Group Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Merge | Prioritized

Development

Successfully merging this pull request may close these issues.

1 participant