Skip to content

Commit ac15e40

Browse files
committed
fix(tcpip_adapter): fix local IP changed when Wi-Fi disconnect
1 parent 2e8d74f commit ac15e40

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

components/tcpip_adapter/tcpip_adapter_lwip.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ esp_err_t tcpip_adapter_up(tcpip_adapter_if_t tcpip_if)
413413
}
414414

415415
/* use last obtained ip, or static ip */
416-
netif_set_addr(esp_netif[tcpip_if], &esp_ip[tcpip_if].ip, &esp_ip[tcpip_if].netmask, &esp_ip[tcpip_if].gw);
417-
netif_set_up(esp_netif[tcpip_if]);
416+
esp_netif[tcpip_if]->flags |= NETIF_FLAG_UP;
418417
}
419418

420419
tcpip_adapter_update_default_netif();
@@ -445,9 +444,7 @@ esp_err_t tcpip_adapter_down(tcpip_adapter_if_t tcpip_if)
445444
tcpip_adapter_reset_ip_info(tcpip_if);
446445
}
447446

448-
netif_set_addr(esp_netif[tcpip_if], IP4_ADDR_ANY4, IP4_ADDR_ANY4, IP4_ADDR_ANY4);
449-
netif_set_down(esp_netif[tcpip_if]);
450-
tcpip_adapter_start_ip_lost_timer(tcpip_if);
447+
esp_netif[tcpip_if]->flags &= ~NETIF_FLAG_UP;
451448
}
452449

453450
tcpip_adapter_update_default_netif();

0 commit comments

Comments
 (0)