-
Notifications
You must be signed in to change notification settings - Fork 479
Reuse server DHCPOFFER transaction id in DHCPREQUEST #1061
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
Reuse server DHCPOFFER transaction id in DHCPREQUEST #1061
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1061 +/- ##
==========================================
- Coverage 81.17% 80.33% -0.84%
==========================================
Files 81 81
Lines 28955 24341 -4614
==========================================
- Hits 23503 19554 -3949
+ Misses 5452 4787 -665 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks for the review! |
src/socket/dhcpv4.rs
Outdated
@@ -72,6 +72,8 @@ struct RequestState { | |||
server: ServerInfo, | |||
/// IP address that we're trying to request. | |||
requested_ip: Ipv4Address, | |||
/// Transaction ID from server's `Offer` message | |||
offer_transaction_id: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this field is redundant. We know the xid of DHCPOFFER is the same as the xid of DHCPDISCOVER, which is stored in the Socket.transaction_id
field.
This seems to work as well - I see that the DHCP Discover and Request use the same transaction id. |
looks good. I got a few more questions tho:
|
I can't find a clear answer regarding DHCPREQUEST xid:s at renew/rebind in the RFC. However, both Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for checking. looks good to me then 🚀
Hello! From my understanding of the DHCP specification rfc2131 smoltcp currently does not follow the specification when it comes to the
transaction id
used for DHCPREQUEST messages. I initially saw this mentioned in a discussion here esp-rs/esp-hal#2345 (reply in thread).If I understand the spec. correctly, when a DHCPOFFER is received from a server, the follow-up DHCPREQUEST should reuse the
transaction id
from the DHCPOFFER message. Currently a new randomtransaction id
is used for the request instead.The relevant parts of the RFC is Table 5 and the text just after it (page 36-37).
I have only been able to test this on my home setup so far but it seems to work as expected there at least. I'm not sure how to add a proper test for this or if the change might interact with retries in some way that needs additional handling.