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.
The MR had turned the active ESP_LOGD("GET SCIA LEN") into a commented-out
ESP_LOGI. Restore the original ESP_LOGD so the log stays live at DEBUG and
no dead commented code is left behind.
esp_nan_action_start() read group_mgmt_prot back from the blob via
esp_wifi_get_config() and defaulted to true when the read failed, which
force-enabled device-global IGTK/BIGTK (BIP beacons, forced GTKSA) on a
path where the user's intent is unknown. group_mgmt_prot is a pure
pass-through user flag, so capture it directly into s_nan_ctx from the
config in esp_wifi_nan_sync_start() (next to use_nvs_for_caching) and drop
the read-back and its ambiguous default. Behaviour now follows the user's
config exactly (default false via WIFI_NAN_SYNC_CONFIG_DEFAULT).
The default initializer explicitly sets every other bool field but omitted
the new group_mgmt_prot, leaving the intended default ambiguous. Set it to
false so the macro stays exhaustive; both example apps use it.
Fix group-key lifecycle gaps on the secured NDP path:
- On NAN stop, reset the device-global IGTK/BIGTK state via new
nan_security_reset_own_group_keys() so the next start regenerates fresh
keys. Previously the one-shot nan_ensure_own_igtk/bigtk kept own_*_set,
so restart re-installed the stale key with IPN/BIPN=0, resetting the
blob's monotonic replay counter (and reusing keys if the NMI changed).
- On peer teardown (nan_app_clear_one_peer_tks), remove the peer RX
IGTK/BIGTK from the blob (they were installed against the peer NMI at
NDP confirm) and scrub ndl->igtk/bigtk + flags. Previously only the GTK
was removed, leaving stale BIP keys installed and key bytes in memory.
- Copy the GTK Key RSC into the descriptor only when a GTK KDE is present,
matching the comment and avoiding stale RSC on an IGTK/BIGTK-only path.
Harden group-key material handling on the secured NDP path:
- Zero the stack buffers that hold plaintext/decrypted group keys before
they leave scope: pad in nan_kek_wrap_key_data, plain in
nan_append_own_group_kdes (single-exit cleanup), and the decrypted plain
in esp_nan_parse_ndp_key_desc. Mirrors the existing forced_memzero(pmk)
scrubs so GTK/IGTK/BIGTK bytes do not persist on the stack.
- Demote the ND-TK / GTK / IGTK / BIGTK ESP_LOG_BUFFER_HEXDUMP calls (own
keys in nan_security.c, pairwise and peer keys in nan_app.c) from
ESP_LOG_INFO to ESP_LOG_DEBUG so raw key bytes are not printed at the
default log level.
The ND-TK (pairwise data key) install return value was overwritten by the
subsequent NM-TK install before being checked, so an ND-TK failure went
undetected: the NDP was marked accepted and NDP_CONFIRM posted while
unicast data frames had no encryption key installed. Check ND-TK first
and tear down on failure, then install and check NM-TK separately.
The NDP indication handler recorded an NDL slot, then on esp_wifi_get_mac
failure unlocked and returned without releasing the slot or answering the
peer: the slot leaked (counting against the NDL limit) and the peer waited
indefinitely. On failure now reset the NDL and send a deny response,
mirroring the existing allocation-failure cleanup path.
Also drop the redundant pre-branch get_mac/IPv6-derive: its result was
only used on the auto-response path, which recomputes it, so on the
indication path it was dead work and a second leak site.
- Add esp_wifi_netif_set_static_neighbor() that to add/remove IPv6
static entry using netif API to skip Neighbor Discovery Protocol
- Move the fe80::/64 + EUI-64 derivation to esp_wifi_netif.c
Add Wi-Fi Aware group-key support to secured NDPs so group-addressed
traffic can be protected, for interop with iOS/macOS peers:
- GTK (NCS-GTK-CCM-128) protects group-addressed data.
- IGTK/BIGTK (BIP) protect group management traffic - multicast SDFs,
Beacons.
Capabilities are advertised in the CSIA IE: group_data_prot maps to GTKSA,
group_mgmt_prot to IGTKSA/BIGTKSA. The CSIA cannot encode IGTK/BIGTK
without GTK (WiFi Aware spec 9.5.21.2, Table 122), so enabling group_mgmt_prot
forces group_data_prot on for every secured service.
Expose per-service group_data_prot and device-global group_mgmt_prot.
httpd_req_get_hdr_value_str() detected truncation with `val_size < full_size`, where full_size is the strlcpy() return value. strlcpy() returns strlen() of the source (the terminating null is not counted), so truncation actually occurs when strlen(src) >= val_size. At strlen(src) == val_size the value is copied as val_size - 1 chars + NUL (i.e. truncated) yet ESP_OK was returned, so the caller never learned the value was cut.
Use `val_size <= full_size` and correct the misleading comment about strlcpy()'s return value.
Same truncation-reporting class fixed for httpd_cookie_key_value in PR #16202; httpd_req_get_hdr_value_str was missed. No memory-safety impact: strlcpy() null-terminates if val_size > 0.
Handle absent IROM/DROM alignment gap in SPIRAM-XIP memprot tests
Closes IDFCI-5004, IDFCI-11739, and IDFCI-11738
See merge request espressif/esp-idf!50133
- Add nira attr and verification for pasn auth frames
- Refine key clearing and pairing complete logic for pasn verify
- Add NIRA own-service resolution, cached NIK checks, and dynamic
pairing IE construction for bootstrap vs verify paths.
- Replace NAN bootstrap events by private callbacks