Fix DHCP ACK parsing#41
Conversation
There was a problem hiding this comment.
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_ackthat 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.
a967388 to
50606a1
Compare
d76e193 to
161baf9
Compare
7a36b1d to
1c1403b
Compare
Attempt to improve test stability
Attempt to stabilize CI tests
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fenrir / C-2
fernir security / C-1