forked from d-a-v/esp82xx-nonos-linklayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dhcp: add option for lowering discover interval
- Loading branch information
1 parent
f4918f9
commit 1372a35
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
diff --git a/src/core/ipv4/dhcp.c b/src/core/ipv4/dhcp.c | ||
index 534574fe..88c7669f 100644 | ||
--- a/src/core/ipv4/dhcp.c | ||
+++ b/src/core/ipv4/dhcp.c | ||
@@ -1024,7 +1024,15 @@ dhcp_discover(struct netif *netif) | ||
autoip_start(netif); | ||
} | ||
#endif /* LWIP_DHCP_AUTOIP_COOP */ | ||
+#ifdef LWIP_DHCP_DISCOVER_RETRANSMISSION_INTERVAL | ||
+/** | ||
+ * Since for embedded devices it's not that hard to miss a discover packet, so lower | ||
+ * the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s. | ||
+ */ | ||
+ msecs = (u16_t)((dhcp->tries < 6 ? 1 << dhcp->tries : 60) * LWIP_DHCP_DISCOVER_RETRANSMISSION_INTERVAL); | ||
+#else | ||
msecs = (u16_t)((dhcp->tries < 6 ? 1 << dhcp->tries : 60) * 1000); | ||
+#endif /* LWIP_DHCP_DISCOVER_RETRANSMISSION_INTERVAL */ | ||
dhcp->request_timeout = (u16_t)((msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS); | ||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_discover(): set request timeout %"U16_F" msecs\n", msecs)); | ||
return result; |