From 454927151d3cc4e134cd614d757c9523f7a994d3 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Tue, 14 Feb 2017 21:02:38 +0100 Subject: [PATCH] Continue working on ext netif callback Docs, better callback points (e.g. before netif is set down) --- src/core/netif.c | 3 ++- src/include/lwip/netif.h | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/netif.c b/src/core/netif.c index 87ba15bb..3a41edcd 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -692,6 +692,8 @@ void netif_set_down(struct netif *netif) { if (netif->flags & NETIF_FLAG_UP) { + netif_invoke_ext_callback(netif, LWIP_NSC_STATUS_CHANGED, 0, NULL); + netif->flags &= ~NETIF_FLAG_UP; MIB2_COPY_SYSUPTIME_TO(&netif->ts); @@ -706,7 +708,6 @@ netif_set_down(struct netif *netif) #endif /* LWIP_IPV6 */ NETIF_STATUS_CALLBACK(netif); - netif_invoke_ext_callback(netif, LWIP_NSC_STATUS_CHANGED, 0, NULL); } } diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h index 519acf13..be0ba9b6 100644 --- a/src/include/lwip/netif.h +++ b/src/include/lwip/netif.h @@ -512,13 +512,17 @@ struct netif* netif_get_by_index(u8_t idx); */ typedef enum { - /** netif was added. num: 0; arg: NULL */ + /** netif was added. num: 0; arg: NULL\n + * Called AFTER netif was added. */ LWIP_NSC_NETIF_ADDED, - /** netif was removed. num: 0; arg: NULL */ + /** netif was removed. num: 0; arg: NULL\n + * Called BEFORE netif is removed. */ LWIP_NSC_NETIF_REMOVED, /** link changed. num: 1 up, 0 down; arg: NULL */ LWIP_NSC_LINK_CHANGED, - /** netif administrative status changed. num: 1 up, 0 down; arg: NULL */ + /** netif administrative status changed. num: 1 up, 0 down; arg: NULL\n + * up is called AFTER netif is set up.\n + * down is called BEFORE the netif is actually set down. */ LWIP_NSC_STATUS_CHANGED, /** IPv4 address has changed. num: 0; arg is ip_addr_t* old address */ LWIP_NSC_IPV4_ADDRESS_CHANGED,