Commit Graph
1602 Commits
Author SHA1 Message Date
Sarvesh Bodakhe dc3ada69b5 refactor(nan): drop commented-out debug logging
Remove the dead commented-out ESP_LOGI debug prints flagged in review: the
"Sent Publish to Peer" line in nan_app.c, and the SCIA-construct,
CSIA-construct and CSIA-len-getter blocks in nan_security.c.
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe 553d969c4f 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.
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe 0baa39835e fix(nan): restore SCIA length getter debug log
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.
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe d0e2943621 fix(nan): source group_mgmt_prot from start config, not blob read-back
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).
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe a870826c5a fix(nan): set group_mgmt_prot in 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.
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe e74b5f7bda fix(nan): clear group keys on NAN stop and peer NDP teardown
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.
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe c2c825299a fix(nan): scrub group keys from stack, demote key hexdumps to DEBUG
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.
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe 65d822f202 fix(nan): detect ND-TK install failure at NDP confirm
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.
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe 22a9321fea fix(nan): free NDL slot and deny peer when get_mac fails on NDP resp
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.
2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe 0577b5b1aa fix(wifi): sync wifi-remote injected header for NAN group_mgmt_prot 2026-07-01 18:12:24 +05:30
Sarvesh Bodakhe 08e98f6f30 feat(nan): pin datapath IPv6 neighbor via esp_netif static entry
- 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
2026-07-01 18:11:52 +05:30
Sarvesh Bodakhe 932a9e33d8 feat(wifi): add NAN group data and management frame protection
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.
2026-07-01 13:35:15 +05:30
akshat f4708595e6 bugfix(wifi): Clear Sta TX queue to prevent key 2 send failure
Also, Ensure correct return values for key 2 and key 4.
2026-06-30 14:56:15 +05:30
Nachiket Kukade 17ff376098 bugfix(nan): Fix hard/soft reset cases in NAN Pairing verification
- Update pairing complete API to record for peer
- Terminate NAN Datapaths using publish_id after receiving PASN M1
2026-06-30 12:58:44 +05:30
Sajia c18887b05c feat(nan): Add support for NAN Pairing Verification
- 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
2026-06-30 12:58:41 +05:30
yinqingzhao 9bb9bbc781 fix(wifi): fix tx issues introduced by keeping alive optimization 2026-06-29 16:18:38 +08:00
Jiang Jiang Jian d9b3b6984a Merge branch 'bugfix/fix_smartconfig_stop_assert_issue' into 'master'
fix(wifi): added start check when calling smartconfig stop

Closes WIFI-7432

See merge request espressif/esp-idf!49993
2026-06-26 14:04:33 +08:00
Akshat Agrawal 7b477596a7 fix(nan): Move the required variables under the NAN_SYNC block 2026-06-25 09:15:21 +05:30
zhangyanjiao 3d1bff8b42 fix(wifi): added start check when calling smartconfig stop 2026-06-25 09:53:29 +08:00
Jiang Jiang Jian 87a6c90160 Merge branch 'bugfix/pub_ndp_setup_timeout' into 'master'
fix(nan): Cluster merging and NIK NVS persistence, including pairing and NDP fixes

Closes WIFIBUG-1932, WIFIBUG-1931, WIFIBUG-1927, WIFIBUG-1942, WIFIBUG-1948, WIFIBUG-1955, WIFIBUG-1986, and WIFIBUG-1975

See merge request espressif/esp-idf!49185
2026-06-24 20:57:22 +08:00
Jiang Jiang Jian 16da34ad67 Merge branch 'feat/ftm_esp32s31_calib_values' into 'master'
feat(ftm): Update ftm calibration values esp32s31

See merge request espressif/esp-idf!49221
2026-06-24 16:28:29 +08:00
Akshat Agrawal 7a9acae345 Remove hardcoded GSP subattributes 2026-06-24 10:34:04 +05:30
Akshat Agrawal b7b54b3650 Fix unwanted encryption of NAFs 2026-06-23 22:12:44 +05:30
Nachiket Kukade d36416980c feat(nan): Add aes_wrap/unwrap crypto callbacks
- Use crypto callbacks instead of calling internal API's
- Clean up of unused code, flags. Re-arrange functions
2026-06-23 22:08:06 +05:30
Akshat Agrawal c4b1e06057 Address review comments VNC 2026-06-23 22:08:06 +05:30
Akshat Agrawal 2c134933ec Address review comments and fix build errors 2026-06-23 22:08:06 +05:30
Akshat Agrawal 601faef85b fix(nan): Add service hash to NVS to maintain pairing states after reset 2026-06-23 22:08:06 +05:30
Akshat Agrawal afd5a13e71 Change the NIRA verification logic 2026-06-23 22:08:06 +05:30
Akshat Agrawal e64f0d7b1d fix(nan): Disable/Enable Pairing setup bit based on NIK stored in NVS
- Only send pairing followup only if nik caching is enabled
2026-06-23 22:08:06 +05:30
Nachiket Kukade 7d6d7ead9a feat(nan): persist NIK/NPK credentials in NVS
Replace nik/nik_valid in wifi_nan_sync_config_t with reset_current_nvs_creds
and use_nvs_for_caching. On NAN start, load the saved own NIK and peer
credentials from NVS (or erase them when reset is requested); generate and
persist a fresh own NIK only when none is valid and caching is enabled.

PASN reuses the SAE module (PWE/crypto and the comeback-token mechanism),
so define CONFIG_SAE whenever SoftAP-SAE or PASN is enabled. This fixes the
undefined references to check_comeback_token()/auth_build_token_req() when
SOFTAP config is disabled.
2026-06-23 22:08:06 +05:30
Nachiket Kukade 11ac60fcbb refactor(nan): consolidate NIRA construction into esp_nan_construct_nira 2026-06-23 22:08:06 +05:30
Akshat Agrawal 713fee2929 Add pairing followup timeout and post CONFIRM Failure 2026-06-23 22:08:06 +05:30
Nachiket Kukade b45178e798 fix(nan): Move Pairing API's to private header 2026-06-23 22:08:06 +05:30
Nachiket Kukade 0d9225db5a fix(nan): address esp_ai_reviewer review comments 2026-06-23 22:08:06 +05:30
Akshat Agrawal 92a41a8f37 Address Review comments 2026-06-23 22:08:06 +05:30
Akshat Agrawal f68fb697f7 fix(nan): fix NAN pairing NIK/NIRA exchange and verification
Register esp_nan_verify_nira, cache NIRA for publish frames, send own_nik
in pairing follow-up, and complete pairing only after peer NIK is stored.
2026-06-23 22:08:06 +05:30
Akshat Agrawal cd94023075 fix(nan): Add CLUSTER_JOIN Event and Cluster merging feat 2026-06-23 22:08:06 +05:30
Akshat Agrawal 2a8c1b5b24 fix(nan): Add NDP Setup timeout at the publisher side
- fix PASN initiator pmksa_cache_get() usage with the extra argument
- Add attributes to secured NDP frames according to Specs
- Resolve M2 MIC verification failure in secured datapath
2026-06-23 22:08:06 +05:30
muhaidong c6c152bef3 fix(wifi): post disconnect event after disassociation tx callback 2026-06-22 17:50:50 +08:00
Sajia 1d044feba3 feat(ftm): Update ftm calibration values esp32s31 2026-06-22 16:14:52 +08:00
yinqingzhao 951d2d902b fix(wifi): fix still performing active scan on unsupported channels in auto policy 2026-06-17 09:55:01 +08:00
yinqingzhao 07623db26a feat(wifi): support ftm for esp32s31 2026-06-10 19:57:21 +08:00
yinqingzhao 63b92cf17e fix(wifi): fix scheduling issue when tasks have the same priority as the Wi-Fi task 2026-06-10 11:48:26 +08:00
yinqingzhao 42744902c6 feat(wifi): optimizations ralated to keep alive 2026-06-09 16:16:15 +08:00
Jiang Jiang Jian 853a2cfd3a Merge branch 'chip/support_wifi_low_power_for_s31_rebase_master' into 'master'
Chip/support wifi low power for s31 rebase master

Closes IDF-14579 and IDF-14582

See merge request espressif/esp-idf!48532
2026-06-09 15:16:53 +08:00
sibeibei 1b8b73ae41 fix(ci): fix pre-commit issue 2026-06-08 19:24:30 +08:00
sibeibei bd7dc2da07 feat(wifi): adpater apb clock is independent 2026-06-08 19:24:30 +08:00
Kapil Gupta db6f99e160 Merge branch 'bugfix/isolate_remote_local_cache' into 'master'
fix(esp_wifi): Isolate wifi-remote API check from local station build

See merge request espressif/esp-idf!48866
2026-06-01 14:42:57 +05:30
Kapil Gupta 620973393c fix(esp_wifi): Isolate wifi-remote API check from local station build
Use scripts/station_gen_build with -B and -D SDKCONFIG so generate_and_check
does not read the station example's sdkconfig or build tree. Apply
sdkconfig.defaults and IDF_TARGET=esp32 for stable header preprocessing.

Unset GIT_DIR/GIT_INDEX_FILE (and related vars) before git subprocesses so
pre-commit and git worktrees do not mis-resolve paths after cd into scripts/.
2026-05-29 14:20:15 +08:00
Guillaume Souchere d670774f5c feat(esp_common): implement composable error code registration via link-time arrays
Refactor the esp_err_to_name() system to decouple esp_common from
higher-level components. Instead of a monolithic generated table,
each component registers its error codes into a dedicated linker
section (.esp_err_msg_table) via idf_define_esp_err_codes() in its
CMakeLists.txt.

New files:
- tools/err_codes_extract.py: extract ESP_ERR_* defines from headers to CSV
- tools/err_codes_to_c.py: generate C source placing entries into linker section
- tools/err_codes_to_rst.py: generate RST documentation from error codes
- tools/cmake/err_codes.cmake: CMake module providing idf_define_esp_err_codes()
- components/esp_common/include/esp_err_codes.h: esp_err_msg_t typedef
- components/esp_common/src/esp_err_to_name_new.c: new lookup using link-time array
- tools/test_apps/build_system/err_codes_check/: CI test app

Changes:
- Remove all optional component dependencies from esp_common/CMakeLists.txt
- Add .esp_err_msg_table section to all 5 linker scripts
- Register error codes in 18 components via idf_define_esp_err_codes()
- Add new scripts to .gitlab/ci/rules.yml build_check patterns
- use new scripts to generate doc and add CI validation
- Update esp_err.rst to add description of composable code registration
2026-05-28 09:53:32 +02:00