1) two events AP_STOP, AP_START shortly after each other may cause IGMP config on already stopped netif
2) not properly locked sending packets to queue from timer task
closes #2580
*/
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) {
{
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;
*/
esp_err_t tcpip_adapter_get_netif(tcpip_adapter_if_t tcpip_if, void ** netif);
+/**
+ * @brief Test if supplied interface is up or down
+ *
+ * @param[in] tcpip_if: the interface which we will get the hostname
+ *
+ * @return true: tcpip_if is UP
+ * false: tcpip_if id DOWN
+ */
+bool tcpip_adapter_is_netif_up(tcpip_adapter_if_t tcpip_if);
+
#ifdef __cplusplus
}
#endif
return ESP_OK;
}
+bool tcpip_adapter_is_netif_up(tcpip_adapter_if_t tcpip_if)
+{
+ if (esp_netif[tcpip_if] != NULL && netif_is_up(esp_netif[tcpip_if])) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
#endif /* CONFIG_TCPIP_LWIP */