Skip to content

Comments

Fix DHCP ACK parsing#41

Open
danielinux wants to merge 5 commits intowolfSSL:masterfrom
danielinux:fix-dhcp-reuse-stale-option-data
Open

Fix DHCP ACK parsing#41
danielinux wants to merge 5 commits intowolfSSL:masterfrom
danielinux:fix-dhcp-reuse-stale-option-data

Conversation

@danielinux
Copy link
Member

@danielinux danielinux commented Feb 23, 2026

  • fenrir / C-2

  • fernir security / C-1

Copy link
Contributor

Copilot AI left a comment

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 fixes a critical bug in DHCP ACK message parsing where a reused variable caused all DHCP options to use the value from the first option, resulting in incorrect network configuration. The fix moves the variable declaration inside the parsing loop, and the test is enhanced to verify all DHCP options are parsed correctly with distinct values.

Changes:

  • Fixed variable scoping bug in dhcp_parse_ack that caused all DHCP options to reuse the first option's value
  • Enhanced test coverage to verify IP address, netmask, gateway, and DNS are all parsed correctly with distinct values

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/wolfip.c Moved data variable declaration inside the option parsing loop to ensure each DHCP option is parsed with its own value instead of reusing the first option's value
src/test/unit/unit.c Added separate test variables for router and DNS IPs, added DHCP_OPTION_ROUTER and DHCP_OPTION_OFFER_IP to test message, and added assertions to verify all configuration fields are set correctly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

LinuxJedi
LinuxJedi previously approved these changes Feb 23, 2026
@danielinux danielinux force-pushed the fix-dhcp-reuse-stale-option-data branch from a967388 to 50606a1 Compare February 23, 2026 12:15
@danielinux danielinux force-pushed the fix-dhcp-reuse-stale-option-data branch from d76e193 to 161baf9 Compare February 23, 2026 14:02
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.

2 participants