diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index 38d678268..443b39846 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -3794,13 +3794,14 @@ static esp_err_t _mdns_send_search_action(mdns_action_type_t type, mdns_search_o */ static void _mdns_scheduler_run() { + MDNS_SERVICE_LOCK(); mdns_tx_packet_t * p = _mdns_server->tx_queue_head; mdns_action_t * action = NULL; if (!p) { + MDNS_SERVICE_UNLOCK(); return; } - MDNS_SERVICE_LOCK(); if ((int32_t)(p->send_at - (xTaskGetTickCount() * portTICK_PERIOD_MS)) < 0) { action = (mdns_action_t *)malloc(sizeof(mdns_action_t)); if (action) { diff --git a/components/mdns/mdns_networking.c b/components/mdns/mdns_networking.c index 4e64e36cf..9aac3ec89 100644 --- a/components/mdns/mdns_networking.c +++ b/components/mdns/mdns_networking.c @@ -62,6 +62,12 @@ static esp_err_t _udp_join_group(tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t { struct netif * netif = NULL; void * nif = NULL; + + if (!tcpip_adapter_is_netif_up(tcpip_if)) { + // Network interface went down before event propagated, skipping IGMP config + return ESP_ERR_INVALID_STATE; + } + esp_err_t err = tcpip_adapter_get_netif(tcpip_if, &nif); if (err) { return ESP_ERR_INVALID_ARG;