Selaa lähdekoodia

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
David Cermak 3 vuotta sitten
vanhempi
sitoutus
12fd9029bf
1 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  1. 6 4
      components/esp_netif/lwip/esp_netif_lwip.c

+ 6 - 4
components/esp_netif/lwip/esp_netif_lwip.c

@@ -1105,10 +1105,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,