Skip to content

Commit 0b698b8

Browse files
committed
rp2/mpnetworkport: Deregister all sys timeouts when netif is removed.
When mDNS is active on a netif it registers a lot of timeouts, namely: mdns_probe_and_announce mdns_handle_tc_question mdns_multicast_probe_timeout_reset_ipv4 mdns_multicast_timeout_25ttl_reset_ipv4 mdns_multicast_timeout_reset_ipv4 mdns_send_multicast_msg_delayed_ipv4 mdns_send_unicast_msg_delayed_ipv4 mdns_multicast_probe_timeout_reset_ipv6 mdns_multicast_timeout_25ttl_reset_ipv6 mdns_multicast_timeout_reset_ipv6 mdns_send_multicast_msg_delayed_ipv6 mdns_send_unicast_msg_delayed_ipv6 These may still be active after a netif is removed, and if they are called they will find that the mDNS state pointer in the netif is NULL and they will crash. These functions could be explicitly removed using `sys_untimeout()`, but `mdns_handle_tc_question()` is static so it's not possible to access it. Instead use the new `sys_untimeout_all_with_arg()` helper to deregister all timeout callbacks when a netif is removed. Fixes issue micropython#17621. Signed-off-by: Damien George <damien@micropython.org>
1 parent cf490ed commit 0b698b8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ports/rp2/mpnetworkport.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#if MICROPY_PY_LWIP
3232

33+
#include "extmod/modnetwork.h"
3334
#include "shared/runtime/softtimer.h"
3435
#include "lwip/netif.h"
3536
#include "lwip/timeouts.h"
@@ -183,6 +184,10 @@ static void mp_network_netif_status_cb(struct netif *netif, netif_nsc_reason_t r
183184
mp_network_soft_timer.mode = SOFT_TIMER_MODE_PERIODIC;
184185
soft_timer_reinsert(&mp_network_soft_timer, LWIP_TICK_RATE_MS);
185186
}
187+
188+
if (reason == LWIP_NSC_NETIF_REMOVED) {
189+
sys_untimeout_all_with_arg(netif);
190+
}
186191
}
187192

188193
#endif // MICROPY_PY_LWIP

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy