Skip to content

DHCP: free the state when dropping on state NONE#588

Open
rsmarples wants to merge 1 commit intomasterfrom
dhcp_free
Open

DHCP: free the state when dropping on state NONE#588
rsmarples wants to merge 1 commit intomasterfrom
dhcp_free

Conversation

@rsmarples
Copy link
Member

Fixes an issue when dhcpcd tries to release when the carrier is down.

Fixes #560

Fixes an issue when dhcpcd tries to release when the carrier
is down.

Fixes #560
@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

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: e1eabe72-191a-442b-a107-61913dbcb825

📥 Commits

Reviewing files that changed from the base of the PR and between 42ff6d2 and e238855.

📒 Files selected for processing (1)
  • src/dhcp.c

Walkthrough

A single line is added to the dhcp_drop() function in src/dhcp.c. When there is no existing DHCP state, the function now calls dhcp_free(ifp) to clean up allocated resources after removing the eloop timeout and before notifying via dhcpcd_dropped().

Changes

Cohort / File(s) Summary
DHCP state cleanup
src/dhcp.c
Added dhcp_free(ifp) call in dhcp_drop() when DHCP state is absent to ensure proper resource deallocation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: freeing DHCP state when dropping on state NONE, which directly addresses the linked issue.
Description check ✅ Passed The description is directly related to the changeset, explaining that it fixes an issue with dhcpcd release operations when the carrier is down.
Linked Issues check ✅ Passed The code change implements the required fix from issue #560 by freeing DHCP state in dhcp_drop() when state is NONE, preventing hangs during release with carrier down.
Out of Scope Changes check ✅ Passed All changes in src/dhcp.c are directly related to the linked issue #560, with no extraneous modifications detected.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dhcp_free
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can approve the review once all CodeRabbit's comments are resolved.

Enable the reviews.request_changes_workflow setting to automatically approve the review once all CodeRabbit's comments are resolved.

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.

Very long delay and error message with dhcpcd -k & dhcpcd -x

1 participant