Skip to content

fix: treat IPv4LL DHCP assignments as incomplete during boot#2649

Open
ljm42 wants to merge 1 commit into
masterfrom
fix-dhcp-ipv4ll-boot-wait
Open

fix: treat IPv4LL DHCP assignments as incomplete during boot#2649
ljm42 wants to merge 1 commit into
masterfrom
fix-dhcp-ipv4ll-boot-wait

Conversation

@ljm42
Copy link
Copy Markdown
Member

@ljm42 ljm42 commented May 22, 2026

Summary

  • Treat IPv4LL/link-local DHCP assignments as incomplete during boot.
  • When IPv4 DHCP is enabled and the interface has carrier, rc.inet1 now waits up to 60 seconds for a non-link-local IPv4 address instead of continuing as soon as dhcpcd assigns a 169.254.x.x address.
  • Clarify DHCP fallback logs to distinguish an existing dhcpcd process from starting a new background process.

Validation

  • Ran: bash -n etc/rc.d/rc.inet1
  • Tested on test4 with the updated rc.inet1 override. During boot, dhcpcd assigned 169.254.150.83 at 14:25:51, then rc.inet1 continued waiting until dhcpcd leased 10.11.1.191 at 14:25:59.
  • Confirmed current test4 state: br0 has 10.11.1.191/24, default route via 10.11.1.1, and nameserver 10.11.1.1.

Summary by CodeRabbit

  • Bug Fixes

    • Improved IPv4 DHCP polling to better distinguish between assigned addresses and link-local-only configurations.
    • Enhanced network interface initialization to handle cases where DHCP is already active, reducing unnecessary restart attempts.
  • New Features

    • Added more robust polling mechanisms for IPv4 address detection during interface startup.

Review Change Stack

When IPv4 DHCP is enabled and the interface has carrier, rc.inet1 now waits up to 60 seconds for a non-link-local IPv4 address instead of continuing as soon as dhcpcd assigns a 169.254.x.x address.

If no usable IPv4 address is received within the timeout, dhcpcd continues polling in the background.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: efc442df-6a78-4697-9eee-671c154a6cc3

📥 Commits

Reviewing files that changed from the base of the PR and between 7b789bb and 5cf8a69.

📒 Files selected for processing (1)
  • etc/rc.d/rc.inet1

Walkthrough

This PR enhances DHCP address polling for network interface initialization. It adds helper functions to detect non-link-local IPv4 addresses and enables extended polling to distinguish between "only IPv4LL assigned" and "non-link-local acquired" states. The ipaddr_up() function is refactored to use these helpers and branch on distinct return codes.

Changes

DHCP Polling Enhancement

Layer / File(s) Summary
DHCP polling helper functions
etc/rc.d/rc.inet1
Adds dhcp4_addr() to test for non-169.254.x.x IPv4 addresses and dhcp_wait() to wrap dhcpcd -w with up to 60 seconds of polling for IPv4 to return distinct status when only link-local is assigned.
DHCP startup flow integration
etc/rc.d/rc.inet1
Refactors ipaddr_up() carrier-present path to call dhcp_wait() and branch on return status: exit code 0 requires no action, 2 logs IPv4LL-only state without starting daemon, and other failures start dhcpcd -b in background. Updates carrier-down log message wording.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A rabbit's gift: two functions small,

dhcp4_addr() catches link-local's call,

While dhcp_wait() polls the line,

Sixty seconds to distinguish fine—

IPv4LL or real address tall! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: treating IPv4LL (169.254.x.x) DHCP assignments as incomplete during boot by adding wait logic.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-dhcp-ipv4ll-boot-wait

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 and usage tips.

@github-actions
Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.05.22.2141
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2649/webgui-pr-2649.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
etc/rc.d/rc.inet1

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2649, or run:

plugin remove webgui-pr-2649

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@ljm42 ljm42 marked this pull request as ready for review May 22, 2026 21:44
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.

1 participant