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
This commit is contained in:
David Cermak 2022-12-16 16:58:48 +01:00
parent 81932a273a
commit 12fd9029bf

View File

@ -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,