From d2791b32fde39549452b3b323b6002444ca6dab0 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 16 Dec 2022 16:58:48 +0100 Subject: [PATCH] esp_netif: Post IP event for PPP netifs unconditionally IP update notification for "point to point" interfaces is performed via the same callback function as for any other interfaces (dhcp_cb, although it's not DHCP related). In P2P interfaces we have to assure that we always get a notification, so we can set the interface up. This was omitted when getting the same IP address for the second time, causing the PPPoS interface (in esp-modem applications) failing to reconnect if disconnected. Closes https://github.com/espressif/esp-idf/issues/10308 Closes https://github.com/espressif/esp-protocols/issues/188 --- components/esp_netif/lwip/esp_netif_lwip.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/esp_netif/lwip/esp_netif_lwip.c b/components/esp_netif/lwip/esp_netif_lwip.c index 22f770869e..300f30bcad 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -1107,10 +1107,12 @@ static void esp_netif_internal_dhcpc_cb(struct netif *netif) if ( !ip4_addr_cmp(ip_2_ip4(&netif->ip_addr), IP4_ADDR_ANY4) ) { - //check whether IP is changed - if ( !ip4_addr_cmp(ip_2_ip4(&netif->ip_addr), (&ip_info->ip)) || - !ip4_addr_cmp(ip_2_ip4(&netif->netmask), (&ip_info->netmask)) || - !ip4_addr_cmp(ip_2_ip4(&netif->gw), (&ip_info->gw)) ) { + //check whether IP is changed (or if we're an PPP interface) + if ( (!ip4_addr_cmp(ip_2_ip4(&netif->ip_addr), (&ip_info->ip)) || + !ip4_addr_cmp(ip_2_ip4(&netif->netmask), (&ip_info->netmask)) || + !ip4_addr_cmp(ip_2_ip4(&netif->gw), (&ip_info->gw))) + // post IP event for PPP interfaces even if IP hasn't changed + || (_IS_NETIF_ANY_POINT2POINT_TYPE(esp_netif))) { ip_event_got_ip_t evt = { .esp_netif = esp_netif, .ip_changed = false,