From fa589b02380f0a5f47ce4706ea365494680b1e69 Mon Sep 17 00:00:00 2001 From: user Date: Wed, 4 Feb 2026 21:11:24 +0100 Subject: [PATCH] fix: Revert explicit REQUIRES mbedtls, move flood globals before NVS load The main component in ESP-IDF auto-includes all components; explicit REQUIRES overrides this and breaks the build. mbedtls is available without it. Also moved flood detection globals above config_load_nvs to fix undeclared identifier errors. --- .../csi_recv_router/main/CMakeLists.txt | 3 +-- get-started/csi_recv_router/main/app_main.c | 26 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/get-started/csi_recv_router/main/CMakeLists.txt b/get-started/csi_recv_router/main/CMakeLists.txt index e03523a..a941e22 100644 --- a/get-started/csi_recv_router/main/CMakeLists.txt +++ b/get-started/csi_recv_router/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES mbedtls) + INCLUDE_DIRS ".") diff --git a/get-started/csi_recv_router/main/app_main.c b/get-started/csi_recv_router/main/app_main.c index ad9b00d..ed11865 100644 --- a/get-started/csi_recv_router/main/app_main.c +++ b/get-started/csi_recv_router/main/app_main.c @@ -149,6 +149,19 @@ static uint16_t s_target_port; /* runtime target port */ static char s_hostname[32]; /* runtime hostname (NVS or Kconfig default) */ static char s_auth_secret[65] = ""; /* empty = auth disabled */ +/* Deauth flood detection */ +#define FLOOD_WINDOW_DEFAULT 10 +#define FLOOD_THRESH_DEFAULT 5 +#define FLOOD_RING_SIZE 64 + +static int s_flood_thresh = FLOOD_THRESH_DEFAULT; +static int s_flood_window_s = FLOOD_WINDOW_DEFAULT; +static bool s_flood_active = false; +static int64_t s_flood_alert_ts = 0; +static struct { int64_t ts; } s_deauth_ring[FLOOD_RING_SIZE]; +static int s_deauth_ring_head = 0; +static int s_deauth_ring_count = 0; + /* --- NVS helpers --- */ static void config_load_nvs(void) @@ -824,19 +837,6 @@ typedef struct { uint16_t seq_ctrl; } __attribute__((packed)) wifi_ieee80211_mac_hdr_t; -/* Deauth flood detection */ -#define FLOOD_WINDOW_DEFAULT 10 -#define FLOOD_THRESH_DEFAULT 5 -#define FLOOD_RING_SIZE 64 - -static int s_flood_thresh = FLOOD_THRESH_DEFAULT; -static int s_flood_window_s = FLOOD_WINDOW_DEFAULT; -static bool s_flood_active = false; -static int64_t s_flood_alert_ts = 0; -static struct { int64_t ts; } s_deauth_ring[FLOOD_RING_SIZE]; -static int s_deauth_ring_head = 0; -static int s_deauth_ring_count = 0; - /* Probe request deduplication: report each MAC at most once per N seconds */ #define PROBE_DEDUP_SIZE 32 #define PROBE_DEDUP_DEFAULT_US 10000000LL