diff --git a/src/core/ipv4/autoip.c b/src/core/ipv4/autoip.c index 4e7ed6ac..399b66e7 100644 --- a/src/core/ipv4/autoip.c +++ b/src/core/ipv4/autoip.c @@ -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); } +/** + * @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) * * @param netif The netif under AutoIP control diff --git a/src/include/lwip/autoip.h b/src/include/lwip/autoip.h index b7558eb0..b3f9feb1 100644 --- a/src/include/lwip/autoip.h +++ b/src/include/lwip/autoip.h @@ -69,8 +69,7 @@ struct autoip void autoip_set_struct(struct netif *netif, struct autoip *autoip); -/** Remove a struct autoip previously set to the netif using autoip_set_struct() */ -#define autoip_remove_struct(netif) do { (netif)->autoip = NULL; } while (0) +void autoip_remove_struct(struct netif *netif); err_t autoip_start(struct netif *netif); err_t autoip_stop(struct netif *netif); void autoip_network_changed_link_up(struct netif *netif);