From 8a8058a43610ba4ed8fe1bb1d05041c346b8e4f0 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Sun, 12 Jan 2020 20:30:22 +0100 Subject: [PATCH] netif: add IPV4_ADDR_VALID ext status callback reason This ext-callback reason is always issued when an IPv4 config has been set, even if it has not changed (e.g. DHCP reboot) See bug #55121 --- src/core/netif.c | 6 ++++++ src/include/lwip/netif.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/core/netif.c b/src/core/netif.c index 34842e22..fd91b31a 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -739,6 +739,12 @@ netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t * #if LWIP_NETIF_EXT_STATUS_CALLBACK if (change_reason != LWIP_NSC_NONE) { change_reason |= LWIP_NSC_IPV4_SETTINGS_CHANGED; + } + if (!remove) { + /* Isssue a callback even if the address hasn't changed, eg. DHCP reboot */ + change_reason |= LWIP_NSC_IPV4_ADDR_VALID; + } + if (change_reason != LWIP_NSC_NONE) { netif_invoke_ext_callback(netif, change_reason, &cb_args); } #endif diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h index 984e4a7b..1bdb14ee 100644 --- a/src/include/lwip/netif.h +++ b/src/include/lwip/netif.h @@ -599,6 +599,8 @@ typedef u16_t netif_nsc_reason_t; #define LWIP_NSC_IPV6_SET 0x0100 /** IPv6 address state has changed */ #define LWIP_NSC_IPV6_ADDR_STATE_CHANGED 0x0200 +/** IPv4 settings: valid address set, application may start to communicate */ +#define LWIP_NSC_IPV4_ADDR_VALID 0x0400 /** @ingroup netif * Argument supplied to netif_ext_callback_fn.