Skip to content

[Backport v4.1-branch] net: dhcpv4: Fixes for Pad option handling and Request message xid value #89668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: v4.1-branch
Choose a base branch
from

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented May 8, 2025

Backport 1c46508~5..1c46508 from #89534.

Fixes #89641

rlubos added 5 commits May 8, 2025 13:56
In case the received DHCP message is malformed and contains invalid
message type, the code responsible for matching message type with a
string would assert. This shouldn't be the case that external conditions
(like receiving malformed packet) trigger asserts in the system.
Therefore modify that code, to return "invalid" string in such case
instead.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit f4408c0)
Pad option (option code 0) can be present in between other options for
alignment. The option has a fixed 1-byte length (i. e. no length field),
therefore it did not fall under the common processing code for
unrecognized options (which include the length field at the second
byte). Therefore, not processing this option explicitly could disturb
other options processing, as the parser would wrongly interpret the next
option code as the length field. This commit adds Pad option handling to
fix the issue.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 9d54465)
According to RFC 2131, DHCP clients should use the same xid as
received in the Offer message when sending DHCP Requests. Therefore,
when generating DHCP Request message, the xid value should not be
incremented.

One vague topic is whether the xid value should be updated when
sending Requests from Renewing or Rebinding states, however RFC makes no
exception for those states, and other implementations (dhclient, lwip)
seem to reuse the same xid in such cases, so comply with this behavior.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 45a1cf7)
Add Pad option to the DHCP packets generated by the fake server, to
verify the client processes them correctly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit eabeb84)
According to RFC 2131 Request message Exchange ID should be the same as
the one received in the Offer message from the server. Modify test to
verify that.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 1c46508)
@github-actions github-actions bot added the Backport Backport PR and backport failure issues label May 8, 2025
@github-project-automation github-project-automation bot moved this to To do in Backports May 8, 2025
@rlubos rlubos requested review from jukkar and maass-hamburg May 8, 2025 14:06
@kartben kartben closed this May 19, 2025
@kartben kartben reopened this May 19, 2025
@github-project-automation github-project-automation bot moved this from To do to Done in Backports May 19, 2025
@github-project-automation github-project-automation bot moved this from Done to Needs more info in Backports May 19, 2025
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking Backport Backport PR and backport failure issues
Projects
Status: Needs more info
Development

Successfully merging this pull request may close these issues.

5 participants