1
1
/*
2
- * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
2
+ * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
3
3
*
4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
@@ -140,8 +140,8 @@ static void esp_netif_internal_dhcpc_cb(struct netif *netif);
140
140
#endif
141
141
#if LWIP_IPV6
142
142
static void esp_netif_internal_nd6_cb (struct netif * p_netif , uint8_t ip_index );
143
- static void netif_set_mldv6_flag (struct netif * netif );
144
- static void netif_unset_mldv6_flag (struct netif * netif );
143
+ static void netif_set_mldv6_flag (esp_netif_t * netif );
144
+ static void netif_unset_mldv6_flag (esp_netif_t * netif );
145
145
#endif /* LWIP_IPV6 */
146
146
147
147
static esp_err_t esp_netif_destroy_api (esp_netif_api_msg_t * msg );
@@ -156,7 +156,8 @@ static void netif_callback_fn(struct netif* netif, netif_nsc_reason_t reason, co
156
156
#if LWIP_IPV6
157
157
if ((reason & LWIP_NSC_IPV6_ADDR_STATE_CHANGED ) && (args != NULL )) {
158
158
s8_t addr_idx = args -> ipv6_addr_state_changed .addr_index ;
159
- if (netif_ip6_addr_state (netif , addr_idx ) & IP6_ADDR_VALID ) {
159
+ if (!(args -> ipv6_addr_state_changed .old_state & IP6_ADDR_VALID ) &&
160
+ netif_ip6_addr_state (netif , addr_idx ) & IP6_ADDR_VALID ) {
160
161
/* address is valid -> call the callback function */
161
162
esp_netif_internal_nd6_cb (netif , addr_idx );
162
163
}
@@ -845,7 +846,7 @@ static void esp_netif_lwip_remove(esp_netif_t *esp_netif)
845
846
#endif
846
847
#if ESP_MLDV6_REPORT && LWIP_IPV6
847
848
if (esp_netif -> flags & ESP_NETIF_FLAG_MLDV6_REPORT ) {
848
- netif_unset_mldv6_flag (esp_netif -> lwip_netif );
849
+ netif_unset_mldv6_flag (esp_netif );
849
850
}
850
851
#endif
851
852
if (esp_netif -> flags & ESP_NETIF_DHCP_CLIENT ) {
@@ -1693,7 +1694,7 @@ static esp_err_t esp_netif_down_api(esp_netif_api_msg_t *msg)
1693
1694
#if CONFIG_LWIP_IPV6
1694
1695
#if ESP_MLDV6_REPORT
1695
1696
if (esp_netif -> flags & ESP_NETIF_FLAG_MLDV6_REPORT ) {
1696
- netif_unset_mldv6_flag (esp_netif -> lwip_netif );
1697
+ netif_unset_mldv6_flag (esp_netif );
1697
1698
}
1698
1699
#endif
1699
1700
for (int8_t i = 0 ;i < LWIP_IPV6_NUM_ADDRESSES ;i ++ ) {
@@ -1997,25 +1998,31 @@ esp_err_t esp_netif_get_dns_info(esp_netif_t *esp_netif, esp_netif_dns_type_t ty
1997
1998
1998
1999
static void netif_send_mldv6 (void * arg )
1999
2000
{
2000
- struct netif * netif = arg ;
2001
- if (!netif_is_up (netif )) {
2001
+ esp_netif_t * esp_netif = arg ;
2002
+ esp_netif -> mldv6_report_timer_started = false;
2003
+ if (!netif_is_up (esp_netif -> lwip_netif )) {
2002
2004
return ;
2003
2005
}
2004
- mld6_report_groups (netif );
2005
- sys_timeout (CONFIG_LWIP_MLDV6_TMR_INTERVAL * 1000 , netif_send_mldv6 , netif );
2006
+ mld6_report_groups (esp_netif -> lwip_netif );
2007
+ esp_netif -> mldv6_report_timer_started = true;
2008
+ sys_timeout (CONFIG_LWIP_MLDV6_TMR_INTERVAL * 1000 , netif_send_mldv6 , esp_netif );
2006
2009
}
2007
2010
2008
- static void netif_set_mldv6_flag (struct netif * netif )
2011
+ static void netif_set_mldv6_flag (esp_netif_t * esp_netif )
2009
2012
{
2010
- if (!netif_is_up (netif ) ) {
2013
+ if (!netif_is_up (esp_netif -> lwip_netif ) || esp_netif -> mldv6_report_timer_started ) {
2011
2014
return ;
2012
2015
}
2013
- sys_timeout (CONFIG_LWIP_MLDV6_TMR_INTERVAL * 1000 , netif_send_mldv6 , netif );
2016
+ esp_netif -> mldv6_report_timer_started = true;
2017
+ sys_timeout (CONFIG_LWIP_MLDV6_TMR_INTERVAL * 1000 , netif_send_mldv6 , esp_netif );
2014
2018
}
2015
2019
2016
- static void netif_unset_mldv6_flag (struct netif * netif )
2020
+ static void netif_unset_mldv6_flag (esp_netif_t * esp_netif )
2017
2021
{
2018
- sys_untimeout (netif_send_mldv6 , netif );
2022
+ if (esp_netif -> mldv6_report_timer_started ) {
2023
+ esp_netif -> mldv6_report_timer_started = false;
2024
+ sys_untimeout (netif_send_mldv6 , esp_netif );
2025
+ }
2019
2026
}
2020
2027
2021
2028
#endif
@@ -2062,7 +2069,7 @@ static void esp_netif_internal_nd6_cb(struct netif *netif, uint8_t ip_index)
2062
2069
2063
2070
if (esp_netif -> flags & ESP_NETIF_FLAG_MLDV6_REPORT ) {
2064
2071
#if ESP_MLDV6_REPORT
2065
- netif_set_mldv6_flag (netif );
2072
+ netif_set_mldv6_flag (esp_netif );
2066
2073
#else
2067
2074
ESP_LOGW (TAG ,"CONFIG_LWIP_ESP_MLDV6_REPORT not enabled, but esp-netif configured with ESP_NETIF_FLAG_MLDV6_REPORT" );
2068
2075
#endif
0 commit comments