From 2e173e77548d423ddbc0afb042c2b9c9c68a1ef4 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 14 Apr 2025 18:49:43 +0200 Subject: [PATCH] fix(esp_netif): Fix incorrect DHCP call for PPP interfaces Closes https://github.com/espressif/esp-protocols/issues/800 --- components/esp_netif/lwip/esp_netif_lwip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/esp_netif/lwip/esp_netif_lwip.c b/components/esp_netif/lwip/esp_netif_lwip.c index e7c538bdee..8769284b10 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -1387,7 +1387,14 @@ static void esp_netif_internal_dhcpc_cb(struct netif *netif) ESP_LOGE(TAG, "dhcpc cb: failed to post got ip event (%x)", ret); } #ifdef CONFIG_LWIP_DHCP_RESTORE_LAST_IP - dhcp_ip_addr_store(netif); + /* + * Store the IP address only for non-Point-to-Point interfaces. + * P2P interfaces (like PPP) have dynamic addressing that shouldn't be stored + * for later restoration, as they're negotiated on each connection. + */ + if (!_IS_NETIF_ANY_POINT2POINT_TYPE(esp_netif)) { + dhcp_ip_addr_store(netif); + } #endif /* CONFIG_LWIP_DHCP_RESTORE_LAST_IP */ } else { ESP_LOGD(TAG, "if%p ip unchanged", esp_netif);