mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
fix(esp_netif): Fix mldv6 report memory leak in esp_netif
This commit is contained in:
@ -122,8 +122,8 @@ static void esp_netif_api_cb(void *api_msg)
|
|||||||
|
|
||||||
|
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
static void netif_set_mldv6_flag(struct netif *netif);
|
static void netif_set_mldv6_flag(esp_netif_t *netif);
|
||||||
static void netif_unset_mldv6_flag(struct netif *netif);
|
static void netif_unset_mldv6_flag(esp_netif_t *netif);
|
||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -596,7 +596,7 @@ static void esp_netif_lwip_remove(esp_netif_t *esp_netif)
|
|||||||
}
|
}
|
||||||
#if ESP_MLDV6_REPORT && LWIP_IPV6
|
#if ESP_MLDV6_REPORT && LWIP_IPV6
|
||||||
if (esp_netif->flags & ESP_NETIF_FLAG_MLDV6_REPORT) {
|
if (esp_netif->flags & ESP_NETIF_FLAG_MLDV6_REPORT) {
|
||||||
netif_unset_mldv6_flag(esp_netif->lwip_netif);
|
netif_unset_mldv6_flag(esp_netif);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
netif_remove(esp_netif->lwip_netif);
|
netif_remove(esp_netif->lwip_netif);
|
||||||
@ -1390,7 +1390,7 @@ static esp_err_t esp_netif_down_api(esp_netif_api_msg_t *msg)
|
|||||||
#if CONFIG_LWIP_IPV6
|
#if CONFIG_LWIP_IPV6
|
||||||
#if ESP_MLDV6_REPORT
|
#if ESP_MLDV6_REPORT
|
||||||
if (esp_netif->flags & ESP_NETIF_FLAG_MLDV6_REPORT) {
|
if (esp_netif->flags & ESP_NETIF_FLAG_MLDV6_REPORT) {
|
||||||
netif_unset_mldv6_flag(esp_netif->lwip_netif);
|
netif_unset_mldv6_flag(esp_netif);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for(int8_t i = 0 ;i < LWIP_IPV6_NUM_ADDRESSES ;i++) {
|
for(int8_t i = 0 ;i < LWIP_IPV6_NUM_ADDRESSES ;i++) {
|
||||||
@ -1673,25 +1673,31 @@ esp_err_t esp_netif_get_dns_info(esp_netif_t *esp_netif, esp_netif_dns_type_t ty
|
|||||||
|
|
||||||
static void netif_send_mldv6(void *arg)
|
static void netif_send_mldv6(void *arg)
|
||||||
{
|
{
|
||||||
struct netif *netif = arg;
|
esp_netif_t *esp_netif = arg;
|
||||||
if (!netif_is_up(netif)) {
|
esp_netif->mldv6_report_timer_started = false;
|
||||||
|
if (!netif_is_up(esp_netif->lwip_netif)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mld6_report_groups(netif);
|
mld6_report_groups(esp_netif->lwip_netif);
|
||||||
sys_timeout(CONFIG_LWIP_MLDV6_TMR_INTERVAL*1000, netif_send_mldv6, netif);
|
esp_netif->mldv6_report_timer_started = true;
|
||||||
|
sys_timeout(CONFIG_LWIP_MLDV6_TMR_INTERVAL*1000, netif_send_mldv6, esp_netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void netif_set_mldv6_flag(struct netif *netif)
|
static void netif_set_mldv6_flag(esp_netif_t *esp_netif)
|
||||||
{
|
{
|
||||||
if (!netif_is_up(netif)) {
|
if (!netif_is_up(esp_netif->lwip_netif) || esp_netif->mldv6_report_timer_started) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sys_timeout(CONFIG_LWIP_MLDV6_TMR_INTERVAL*1000, netif_send_mldv6, netif);
|
esp_netif->mldv6_report_timer_started = true;
|
||||||
|
sys_timeout(CONFIG_LWIP_MLDV6_TMR_INTERVAL*1000, netif_send_mldv6, esp_netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void netif_unset_mldv6_flag(struct netif *netif)
|
static void netif_unset_mldv6_flag(esp_netif_t *esp_netif)
|
||||||
{
|
{
|
||||||
sys_untimeout(netif_send_mldv6, netif);
|
if (esp_netif->mldv6_report_timer_started) {
|
||||||
|
esp_netif->mldv6_report_timer_started = false;
|
||||||
|
sys_untimeout(netif_send_mldv6, esp_netif);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -1739,7 +1745,7 @@ static void esp_netif_nd6_cb(struct netif *p_netif, uint8_t ip_index)
|
|||||||
|
|
||||||
if (esp_netif->flags&ESP_NETIF_FLAG_MLDV6_REPORT) {
|
if (esp_netif->flags&ESP_NETIF_FLAG_MLDV6_REPORT) {
|
||||||
#if ESP_MLDV6_REPORT
|
#if ESP_MLDV6_REPORT
|
||||||
netif_set_mldv6_flag(p_netif);
|
netif_set_mldv6_flag(esp_netif);
|
||||||
#else
|
#else
|
||||||
ESP_LOGW(TAG,"CONFIG_LWIP_ESP_MLDV6_REPORT not enabled, but esp-netif configured with ESP_NETIF_FLAG_MLDV6_REPORT");
|
ESP_LOGW(TAG,"CONFIG_LWIP_ESP_MLDV6_REPORT not enabled, but esp-netif configured with ESP_NETIF_FLAG_MLDV6_REPORT");
|
||||||
#endif
|
#endif
|
||||||
|
@ -134,6 +134,9 @@ struct esp_netif_obj {
|
|||||||
char * if_key;
|
char * if_key;
|
||||||
char * if_desc;
|
char * if_desc;
|
||||||
int route_prio;
|
int route_prio;
|
||||||
|
|
||||||
|
// mldv6 timer
|
||||||
|
bool mldv6_report_timer_started;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */
|
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */
|
||||||
|
Reference in New Issue
Block a user