-
Notifications
You must be signed in to change notification settings - Fork 20
STM32H5 Fixes - Fixes DHCP issue broken in PR #65 #71
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4989,6 +4989,10 @@ static int dhcp_send_request(struct wolfIP *s) | |
| sin.sin_family = AF_INET; | ||
| wolfIP_sock_sendto(s, s->dhcp_udp_sd, &req, DHCP_HEADER_LEN + opt_sz, 0, | ||
| (struct wolfIP_sockaddr *)&sin, sizeof(struct wolfIP_sockaddr_in)); | ||
| /* Reset local_ip so DHCP ACK matches via DHCP_IS_RUNNING path in | ||
| * udp_try_recv(). wolfIP_sock_sendto() sets local_ip from conf->ip | ||
| * (the offered IP), but we haven't confirmed the lease yet. */ | ||
| s->udpsockets[SOCKET_UNMARK(s->dhcp_udp_sd)].local_ip = 0; | ||
|
Comment on lines
+4992
to
+4995
|
||
| tmr.expires = s->last_tick + DHCP_REQUEST_TIMEOUT + (wolfIP_getrandom() % 200); | ||
| tmr.arg = s; | ||
| tmr.cb = dhcp_timer_cb; | ||
|
|
||
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.
The loop assumes a specific core clock (64MHz HSI) and a specific
delay()loop cost, buttickis still incremented by 1 regardless of the actual elapsed time, making DHCP timeout behavior fragile across clock configuration changes/optimizations. Consider driving the timeout from a real timebase (SysTick/HAL tick/monotonic timer) or deriving the delay count fromSystemCoreClockand updatingtickbased on measured/actual elapsed time.