Merge branch 'bugfix/mdns_interface_del_crash_v4.2' into 'release/v4.2'

mdns: Fix of crash when wifi interface get deleted and mdns receives the packets(Backport v4.2)

See merge request espressif/esp-idf!13856
This commit is contained in:
David Čermák 2021-06-24 16:23:53 +00:00
commit 0f5628a63d

View File

@ -73,6 +73,17 @@ esp_netif_t *_mdns_get_esp_netif(mdns_if_t tcpip_if)
return NULL;
}
/*
* @brief Clean internal mdns interface's pointer
*/
static inline void _mdns_clean_netif_ptr(mdns_if_t tcpip_if) {
if (tcpip_if < MDNS_IF_MAX) {
s_esp_netifs[tcpip_if] = NULL;
}
}
/*
* @brief Convert esp-netif handle to mdns if
*/
@ -3110,6 +3121,8 @@ void _mdns_enable_pcb(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
*/
void _mdns_disable_pcb(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
{
_mdns_clean_netif_ptr(tcpip_if);
if (_mdns_server->interfaces[tcpip_if].pcbs[ip_protocol].pcb) {
_mdns_clear_pcb_tx_queue_head(tcpip_if, ip_protocol);
_mdns_pcb_deinit(tcpip_if, ip_protocol);