Clear any existing IP before sending a DHCP request (#2979)

Fixes #2978
This commit is contained in:
Earle F. Philhower, III 2025-05-31 11:20:14 -07:00 committed by GitHub
parent 73bd6a0891
commit 948e9bfd22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -393,7 +393,10 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
}
if (_isDHCP) {
// IP not set, starting DHCP
// Destroy any existing address
ip4_addr_set_u32(ip_2_ip4(&_netif.ip_addr), 0);
// Start a new DHCP request
_netif.flags |= NETIF_FLAG_UP;
switch (dhcp_start(&_netif)) {
case ERR_OK: