File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
components/esp_netif/lwip Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -1395,6 +1395,11 @@ static void esp_netif_internal_dhcpc_cb(struct netif *netif)
13951395 } else {
13961396 if (!ip4_addr_cmp (& ip_info -> ip , IP4_ADDR_ANY4 )) {
13971397 esp_netif_start_ip_lost_timer (esp_netif );
1398+ // synchronize lwip netif with esp_netif setting ip_info to 0,
1399+ // so the next time we get a valid IP we can raise the event
1400+ ip4_addr_set (& ip_info -> ip , ip_2_ip4 (& netif -> ip_addr ));
1401+ ip4_addr_set (& ip_info -> netmask , ip_2_ip4 (& netif -> netmask ));
1402+ ip4_addr_set (& ip_info -> gw , ip_2_ip4 (& netif -> gw ));
13981403 }
13991404 }
14001405}
@@ -1422,6 +1427,7 @@ static void esp_netif_ip_lost_timer(void *arg)
14221427 esp_netif_update_default_netif (esp_netif , ESP_NETIF_LOST_IP );
14231428 ESP_LOGD (TAG , "if%p ip lost tmr: raise ip lost event" , esp_netif );
14241429 memset (esp_netif -> ip_info_old , 0 , sizeof (esp_netif_ip_info_t ));
1430+ memset (esp_netif -> ip_info , 0 , sizeof (esp_netif_ip_info_t ));
14251431 if (esp_netif -> lost_ip_event ) {
14261432 ret = esp_event_post (IP_EVENT , esp_netif -> lost_ip_event ,
14271433 & evt , sizeof (evt ), 0 );
You can’t perform that action at this time.
0 commit comments