diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index 7b7363ea38..c50006fdb1 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -1312,8 +1312,9 @@ typedef struct { * @brief Argument structure for WIFI_EVENT_STA_NEIGHBOR_REP event */ typedef struct { - uint8_t report[ESP_WIFI_MAX_NEIGHBOR_REP_LEN]; /**< Neighbor Report received from the AP*/ + uint8_t report[ESP_WIFI_MAX_NEIGHBOR_REP_LEN]; /**< Neighbor Report received from the AP (will be deprecated in next major release, use n_report instead)*/ uint16_t report_len; /**< Length of the report*/ + uint8_t n_report[]; /**< Neighbor Report received from the AP*/ } wifi_event_neighbor_report_t; /** Argument structure for WIFI_EVENT_AP_WRONG_PASSWORD event */ diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 8848c2e127..f709d89ad9 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 8848c2e127a25df01856404761de8eab89dee958 +Subproject commit f709d89ad90f70c93c57b6de3152246d0614f959 diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_common.c b/components/wpa_supplicant/esp_supplicant/src/esp_common.c index ceb71055d9..27a9703a0c 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_common.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_common.c @@ -546,15 +546,20 @@ void neighbor_report_recvd_cb(void *ctx, const uint8_t *report, size_t report_le esp_event_post(WIFI_EVENT, WIFI_EVENT_STA_NEIGHBOR_REP, NULL, 0, 0); return; } - if (report_len > ESP_WIFI_MAX_NEIGHBOR_REP_LEN) { - wpa_printf(MSG_ERROR, "RRM: Neighbor report too large (>%d bytes), hence not reporting", ESP_WIFI_MAX_NEIGHBOR_REP_LEN); - return; - } wpa_printf(MSG_DEBUG, "RRM: Notifying neighbor report (token = %d)", report[0]); - wifi_event_neighbor_report_t neighbor_report_event = {0}; - os_memcpy(neighbor_report_event.report, report, report_len); - neighbor_report_event.report_len = report_len; + + wifi_event_neighbor_report_t *neighbor_report_event = os_zalloc(sizeof(wifi_event_neighbor_report_t) + report_len); + if (neighbor_report_event == NULL) { + wpa_printf(MSG_DEBUG, "memory alloc failed"); + } + + if (report_len < ESP_WIFI_MAX_NEIGHBOR_REP_LEN) { + os_memcpy(neighbor_report_event->report, report, report_len); + } + os_memcpy(neighbor_report_event->n_report, report, report_len); + neighbor_report_event->report_len = report_len; esp_event_post(WIFI_EVENT, WIFI_EVENT_STA_NEIGHBOR_REP, &neighbor_report_event, sizeof(wifi_event_neighbor_report_t), 0); + os_free(neighbor_report_event); } int esp_rrm_send_neighbor_report_request(void) diff --git a/examples/wifi/roaming/roaming_11kvr/main/roaming_example.c b/examples/wifi/roaming/roaming_11kvr/main/roaming_example.c index 3e47cbb158..edf0669494 100644 --- a/examples/wifi/roaming/roaming_11kvr/main/roaming_example.c +++ b/examples/wifi/roaming/roaming_11kvr/main/roaming_example.c @@ -364,9 +364,8 @@ static void esp_bss_rssi_low_handler(void* arg, esp_event_base_t event_base, { wifi_event_bss_rssi_low_t *event = event_data; - ESP_LOGI(TAG, "%s:bss rssi is=%d", __func__, event->rssi); + ESP_LOGI(TAG, "%s:bss rssi is=%ld", __func__, event->rssi); /* Lets check channel conditions */ - rrm_ctx++; if (esp_rrm_send_neighbor_report_request() < 0) { /* failed to send neighbor report request */ ESP_LOGI(TAG, "failed to send neighbor report request");