autoip: fix 'autoip_remove_struct()' after changing storage to 'netif_client_data'

Reported-by: Amena El Homsi <amena.elhomsi@gmail.com>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Simon Goldschmidt 2019-11-21 22:19:35 +01:00
parent 79cd89f99d
commit 03998f5147
2 changed files with 18 additions and 2 deletions

View File

@ -109,6 +109,23 @@ autoip_set_struct(struct netif *netif, struct autoip *autoip)
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, autoip); netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, autoip);
} }
/**
* @ingroup autoip
* Remove a struct autoip previously set to the netif using autoip_set_struct()
*
* @param netif the netif for which to set the struct autoip
*/
void
autoip_remove_struct(struct netif *netif)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT("netif != NULL", netif != NULL);
LWIP_ASSERT("netif has no struct autoip set",
netif_autoip_data(netif) != NULL);
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, NULL);
}
/** Restart AutoIP client and check the next address (conflict detected) /** Restart AutoIP client and check the next address (conflict detected)
* *
* @param netif The netif under AutoIP control * @param netif The netif under AutoIP control

View File

@ -69,8 +69,7 @@ struct autoip
void autoip_set_struct(struct netif *netif, struct autoip *autoip); void autoip_set_struct(struct netif *netif, struct autoip *autoip);
/** Remove a struct autoip previously set to the netif using autoip_set_struct() */ void autoip_remove_struct(struct netif *netif);
#define autoip_remove_struct(netif) do { (netif)->autoip = NULL; } while (0)
err_t autoip_start(struct netif *netif); err_t autoip_start(struct netif *netif);
err_t autoip_stop(struct netif *netif); err_t autoip_stop(struct netif *netif);
void autoip_network_changed_link_up(struct netif *netif); void autoip_network_changed_link_up(struct netif *netif);