diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index 3827f022db0..cebdcb45497 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -933,8 +933,8 @@ typedef enum { WIFI_NAN_CSID_NCS_SK_256 = 2, /**< NCS-SK-256 (PSK/Passphrase). Reserved: not supported right now. */ WIFI_NAN_CSID_NCS_PK_2WDH_128 = 3, /**< NCS-PK-2WDH-128. Reserved: not supported right now. */ WIFI_NAN_CSID_NCS_PK_2WDH_256 = 4, /**< NCS-PK-2WDH-256. Reserved: not supported right now. */ - WIFI_NAN_CSID_NCS_GTK_CCM_128 = 5, /**< Group-data cipher (GTKSA). Selected internally when group_data_prot is set; not user-selectable via csid_bitmap. */ - WIFI_NAN_CSID_NCS_GTK_GCM_256 = 6, /**< Reserved: not supported right now. */ + WIFI_NAN_CSID_NCS_GTK_CCMP_128 = 5, /**< NCS-GTK-CCMP-128, the group-data cipher (GTKSA). Selected internally when group_data_prot is set; not user-selectable via csid_bitmap. */ + WIFI_NAN_CSID_NCS_GTK_GCMP_256 = 6, /**< NCS-GTK-GCMP-256. Reserved: not supported right now. */ WIFI_NAN_CSID_NCS_PK_PASN_128 = 7, /**< NCS-PK-PASN-128 (NAN Pairing). Requires CONFIG_ESP_WIFI_NAN_PAIRING and the Wi-Fi Aware component (esp-wifi-apps); not usable with stand-alone ESP-IDF. */ WIFI_NAN_CSID_NCS_PK_PASN_256 = 8, /**< NCS-PK-PASN-256. Reserved: not supported right now. */ } wifi_nan_cipher_suite_id_t; @@ -943,8 +943,8 @@ typedef enum { #define WIFI_NAN_CSID_BIT_NCS_SK_256 (1 << WIFI_NAN_CSID_NCS_SK_256) #define WIFI_NAN_CSID_BIT_NCS_PK_2WDH_128 (1 << WIFI_NAN_CSID_NCS_PK_2WDH_128) #define WIFI_NAN_CSID_BIT_NCS_PK_2WDH_256 (1 << WIFI_NAN_CSID_NCS_PK_2WDH_256) -#define WIFI_NAN_CSID_BIT_NCS_GTK_CCM_128 (1 << WIFI_NAN_CSID_NCS_GTK_CCM_128) -#define WIFI_NAN_CSID_BIT_NCS_GTK_GCM_256 (1 << WIFI_NAN_CSID_NCS_GTK_GCM_256) +#define WIFI_NAN_CSID_BIT_NCS_GTK_CCMP_128 (1 << WIFI_NAN_CSID_NCS_GTK_CCMP_128) +#define WIFI_NAN_CSID_BIT_NCS_GTK_GCMP_256 (1 << WIFI_NAN_CSID_NCS_GTK_GCMP_256) #define WIFI_NAN_CSID_BIT_NCS_PK_PASN_128 (1 << WIFI_NAN_CSID_NCS_PK_PASN_128) #define WIFI_NAN_CSID_BIT_NCS_PK_PASN_256 (1 << WIFI_NAN_CSID_NCS_PK_PASN_256) diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index df62dea0bcf..c9950ae98a8 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit df62dea0bcf2f81ce3f3a841347441ed07f6fca0 +Subproject commit c9950ae98a8a422a98cc80726c5e91d8b191b319 diff --git a/components/esp_wifi/remote/include/injected/esp_wifi_netif.h b/components/esp_wifi/remote/include/injected/esp_wifi_netif.h index 7dfa724b066..ca054e8a6e1 100644 --- a/components/esp_wifi/remote/include/injected/esp_wifi_netif.h +++ b/components/esp_wifi/remote/include/injected/esp_wifi_netif.h @@ -81,6 +81,42 @@ bool esp_wifi_is_if_ready_when_started(wifi_netif_driver_t ifx); */ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t fn, void * arg); +/** + * @brief Derive an IPv6 link-local address from a link-layer (MAC) address + * + * Computes fe80::/64 combined with the EUI-64 form of the given MAC (the 802 + * group bit complemented) into an esp_ip6_addr_t (zone 0). Interface-agnostic. + * + * @param[out] ip6 destination, set to the derived IPv6 link-local address + * @param[in] mac source link-layer (MAC) address (6 bytes) + */ +void esp_wifi_netif_get_ip6_linklocal_from_mac(esp_ip6_addr_t *ip6, const uint8_t mac[6]); + +#if CONFIG_LWIP_ND6_SUPPORT_STATIC_ENTRIES +/** + * @brief Pin (or remove) a static IPv6 link-local neighbor mapping on a wifi netif + * + * Installs a fixed link-local IPv6 -> MAC mapping for a peer reachable on the + * given wifi interface so that traffic to the peer bypasses Neighbor Discovery + * (no NS/NA exchanged), or removes a previously installed one. This layer owns + * both the netif lookup (from the interface type) and the derivation of the + * peer's link-local address from its MAC, so the caller only supplies the + * interface and the peer MAC. Only available when lwIP static ND6 entries are + * enabled. + * + * @param[in] wifi_if wifi interface the peer is reachable on + * @param[in] mac peer's link-layer (MAC) address + * @param[in] add true to add the mapping, false to remove it + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if mac is NULL or wifi_if is out of range + * - ESP_ERR_INVALID_STATE if the interface's netif is not up + * - error code from the underlying esp_netif call otherwise + */ +esp_err_t esp_wifi_netif_set_static_neighbor(wifi_interface_t wifi_if, const uint8_t mac[6], bool add); +#endif /* CONFIG_LWIP_ND6_SUPPORT_STATIC_ENTRIES */ + #ifdef __cplusplus } #endif diff --git a/components/esp_wifi/remote/include/injected/esp_wifi_types_generic.h b/components/esp_wifi/remote/include/injected/esp_wifi_types_generic.h index 960f6a8e529..4b6bb15b336 100644 --- a/components/esp_wifi/remote/include/injected/esp_wifi_types_generic.h +++ b/components/esp_wifi/remote/include/injected/esp_wifi_types_generic.h @@ -933,9 +933,9 @@ typedef enum { WIFI_NAN_CSID_NCS_SK_256 = 2, /**< NCS-SK-256 (PSK/Passphrase). Reserved: not supported right now. */ WIFI_NAN_CSID_NCS_PK_2WDH_128 = 3, /**< NCS-PK-2WDH-128. Reserved: not supported right now. */ WIFI_NAN_CSID_NCS_PK_2WDH_256 = 4, /**< NCS-PK-2WDH-256. Reserved: not supported right now. */ - WIFI_NAN_CSID_NCS_GTK_CCM_128 = 5, - WIFI_NAN_CSID_NCS_GTK_GCM_256 = 6, - WIFI_NAN_CSID_NCS_PK_PASN_128 = 7, /**< NCS-PK-PASN-128. Reserved: not supported right now. */ + WIFI_NAN_CSID_NCS_GTK_CCMP_128 = 5, /**< NCS-GTK-CCMP-128, the group-data cipher (GTKSA). Selected internally when group_data_prot is set; not user-selectable via csid_bitmap. */ + WIFI_NAN_CSID_NCS_GTK_GCMP_256 = 6, /**< NCS-GTK-GCMP-256. Reserved: not supported right now. */ + WIFI_NAN_CSID_NCS_PK_PASN_128 = 7, /**< NCS-PK-PASN-128 (NAN Pairing). Requires CONFIG_WIFI_RMT_NAN_PAIRING and the Wi-Fi Aware component (esp-wifi-apps); not usable with stand-alone ESP-IDF. */ WIFI_NAN_CSID_NCS_PK_PASN_256 = 8, /**< NCS-PK-PASN-256. Reserved: not supported right now. */ } wifi_nan_cipher_suite_id_t; @@ -943,8 +943,8 @@ typedef enum { #define WIFI_NAN_CSID_BIT_NCS_SK_256 (1 << WIFI_NAN_CSID_NCS_SK_256) #define WIFI_NAN_CSID_BIT_NCS_PK_2WDH_128 (1 << WIFI_NAN_CSID_NCS_PK_2WDH_128) #define WIFI_NAN_CSID_BIT_NCS_PK_2WDH_256 (1 << WIFI_NAN_CSID_NCS_PK_2WDH_256) -#define WIFI_NAN_CSID_BIT_NCS_GTK_CCM_128 (1 << WIFI_NAN_CSID_NCS_GTK_CCM_128) -#define WIFI_NAN_CSID_BIT_NCS_GTK_GCM_256 (1 << WIFI_NAN_CSID_NCS_GTK_GCM_256) +#define WIFI_NAN_CSID_BIT_NCS_GTK_CCMP_128 (1 << WIFI_NAN_CSID_NCS_GTK_CCMP_128) +#define WIFI_NAN_CSID_BIT_NCS_GTK_GCMP_256 (1 << WIFI_NAN_CSID_NCS_GTK_GCMP_256) #define WIFI_NAN_CSID_BIT_NCS_PK_PASN_128 (1 << WIFI_NAN_CSID_NCS_PK_PASN_128) #define WIFI_NAN_CSID_BIT_NCS_PK_PASN_256 (1 << WIFI_NAN_CSID_NCS_PK_PASN_256) @@ -975,8 +975,8 @@ typedef struct { * is computed by the stack as the union of each credential's @c csid. */ typedef struct { - uint8_t group_data_prot: 1; /**< Group addressed data frame protection. Reserved: not supported right now. */ - uint8_t group_mgmt_prot: 1; /**< Group addressed management frame protection. Reserved: not supported right now. */ + uint8_t group_data_prot: 1; /**< Group addressed data frame protection (GTKSA): distribute a GTK on the secured NDP so multicast data frames are protected. */ + uint8_t group_mgmt_prot: 1; /**< Group addressed management frame protection (IGTKSA/BIGTKSA): BIP-protect multicast SDFs and Beacons. */ uint8_t reserved: 6; /**< Reserved */ uint8_t num_credentials; /**< Number of valid entries in @c creds (0..ESP_WIFI_NAN_MAX_CREDS_PER_SVC). 0 = open service. */ wifi_nan_credential_t creds[ESP_WIFI_NAN_MAX_CREDS_PER_SVC]; /**< Credentials list. */ diff --git a/components/esp_wifi/wifi_apps/nan_app/src/nan_security.c b/components/esp_wifi/wifi_apps/nan_app/src/nan_security.c index b282aac6a73..56e094ded71 100644 --- a/components/esp_wifi/wifi_apps/nan_app/src/nan_security.c +++ b/components/esp_wifi/wifi_apps/nan_app/src/nan_security.c @@ -68,10 +68,10 @@ static struct { #define NAN_CSID_VALID_BITMAP ((uint16_t)0x01FE) /* NCS-GTK cipher-suite bits (group-addressed data). Advertised when a service - * sets group_data_prot; the basic default we generate/advertise is CCM-128. */ -#define NAN_CSID_GTK_BITS (WIFI_NAN_CSID_BIT_NCS_GTK_CCM_128 | \ - WIFI_NAN_CSID_BIT_NCS_GTK_GCM_256) -#define NAN_CSID_GTK_DEFAULT WIFI_NAN_CSID_BIT_NCS_GTK_CCM_128 + * sets group_data_prot; the basic default we generate/advertise is CCMP-128. */ +#define NAN_CSID_GTK_BITS (WIFI_NAN_CSID_BIT_NCS_GTK_CCMP_128 | \ + WIFI_NAN_CSID_BIT_NCS_GTK_GCMP_256) +#define NAN_CSID_GTK_DEFAULT WIFI_NAN_CSID_BIT_NCS_GTK_CCMP_128 /* Sentinel for peer_svc->matched_cred_idx: no PMKID match remembered yet. */ #define NAN_NO_MATCHED_CRED 0xFF @@ -1274,7 +1274,7 @@ esp_err_t nan_derive_security_params(const char *service_name, } if (sec_cfg->group_data_prot) { - ESP_LOGI(TAG, "NAN GTK: advertising NCS-GTK-CCM-128 (group_data_prot=1) for svc='%s'", + ESP_LOGI(TAG, "NAN GTK: advertising NCS-GTK-CCMP-128 (group_data_prot=1) for svc='%s'", service_name); }