-
Notifications
You must be signed in to change notification settings - Fork 447
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
Update DHCP example #905
Update DHCP example #905
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #905 +/- ##
=======================================
Coverage 79.92% 79.92%
=======================================
Files 80 80
Lines 28234 28234
=======================================
Hits 22566 22566
Misses 5668 5668 ☔ View full report in Codecov by Sentry. |
Converting to draft for the moment. During testing, found that while this allows the interface to obtain an IP address, if there are sockets already configured on the interface, they will not update properly unless there was already an IP address in place before they were initialized and before an IP address was obtained via DHCP. Solution in my case is to initialize the interface with an UNSPECIFIED address and then replace that address with the new one. This is more similar to what the original example did, but with an added step in initialization. |
4d29a3b
to
53d7d0f
Compare
…an ip address from some other source
1191598
to
28b9901
Compare
we should not have UNSPECIFIED addrs in the interface, it's not correct. The way to make the interface have no addresses is to make the address vec empty.
what do you mean with "update"? if there's some issue in the socket logic we should fix that instead of workarounding it with UNSPECIFIED addrs. |
@Dirbaio @thvdveld , this is ready for review, but I'm not sure why tests are failing. Able to build & pass clippy locally on stable (1.76) and MSRV without specifying features. The test breakage is not related to these changes. On main, the test breakage still occurs:
|
Seems the cause is sunfishcode/is-terminal#36. To reproduce locally, delete Cargo.lock to get upated deps. |
Yep, that worked locally - if you want to rerun the failed workflows, it should be fine now |
have you seen this comment though? #905 (comment) |
I replaced both usages of setting an UNSPECIFIED address with just clearing the addrs vec, and I can confirm that works at least in my particular application (a bare-metal stm32h743 on ethernet). I didn't dig too far into why that was happening, and I was casually inferring that the sockets had some state related to the IP address available when they were created. Removing that initial assignment of an UNSPECIFIED address has no effect today, and a UDP socket created between initialization and when a real IP address is acquired works fine. My best guess is that because I'm testing immediately after flashing a chip that is already connected to ethernet, I may have been seeing the dhcp socket get deconfigured by the router due to the link going down, causing an UNSPECIFIED address to be pushed. |
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!
Fixes #783