esp_netif/lwip: Use netif-client-data to store esp_netif ptr

lwip/netif struct has two places to store user's data
* netif->state (1 void*) but that might be occupied in special cases
* netif->client_dtat (n void*s) but that must be enabled in opts.h
This commit stores esp_netif_t* primarily in state, but if any special
netif is enabled in menuconfig (bridgeif, pppos), it uses netif->client_data.
This commit also fixes incorrect esp_netif that is attached to
IP_EVENT_GOT_IP6 event posted by pppos interfaces in:
c585618b97/components/esp_netif/lwip/esp_netif_lwip_ppp.c (L114)

Closes https://github.com/espressif/esp-idf/issues/9345
This commit is contained in:
David Cermak
2022-07-15 17:32:52 +02:00
committed by David Čermák
parent 96c29841bb
commit 64f4f0ac1e
7 changed files with 69 additions and 102 deletions

View File

@@ -155,8 +155,7 @@ err_t ethernetif_init(struct netif *netif)
{
LWIP_ASSERT("netif != NULL", (netif != NULL));
/* Have to get the esp-netif handle from netif first and then driver==ethernet handle from there */
esp_netif_t *esp_netif = esp_netif_get_handle_from_netif_impl(netif);
esp_netif_t *esp_netif = netif->state;
/* Initialize interface hostname */
#if LWIP_NETIF_HOSTNAME
#if ESP_LWIP