mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(nan): pass no event payload to NAN netif bring-up action
The NAN-started handler brought the netif up via esp_netif_action_connected() using the NAN-started event's base/event_id/data. Feeding a "connected" action from a "started" event and handing it an unrelated event payload is fragile: it would misbehave if the action handler ever interpreted data (which is not a wifi_event_sta_connected_t here). esp_netif_up() is private to the esp_netif component, so keep the public esp_netif_action_connected() but pass NULL base, 0 event_id, NULL data. This is safe because the NAN netif is not a DHCP client: the handler only calls esp_netif_up() and never reads the event args.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2019-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -184,9 +184,10 @@ static void wifi_default_action_nan_started(void *arg, esp_event_base_t base, in
|
||||
if (s_wifi_netifs[WIFI_IF_NAN] != NULL) {
|
||||
wifi_start(s_wifi_netifs[WIFI_IF_NAN], base, event_id, data);
|
||||
esp_nan_action_start(s_wifi_netifs[WIFI_IF_NAN]);
|
||||
/* Bring the netif up before creating the link-local address;
|
||||
* esp_netif_create_ip6_linklocal() is a no-op unless netif_is_up(). */
|
||||
esp_netif_action_connected(s_wifi_netifs[WIFI_IF_NAN], base, event_id, data);
|
||||
/* Bring the netif up before esp_netif_create_ip6_linklocal() (a no-op unless
|
||||
* netif_is_up()). esp_netif_up() is private, so use the public action handler;
|
||||
* NAN is non-DHCP, so it only calls esp_netif_up() and ignores the event args. */
|
||||
esp_netif_action_connected(s_wifi_netifs[WIFI_IF_NAN], NULL, 0, NULL);
|
||||
esp_netif_create_ip6_linklocal(s_wifi_netifs[WIFI_IF_NAN]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user