From db314c0fb388a3de47a9e6db5d944d7fabc832c6 Mon Sep 17 00:00:00 2001
From: Anjan Chanda <anjan.chanda@genexis.eu>
Date: Fri, 13 Jun 2025 10:55:36 +0200
Subject: [PATCH] wifi_dataelements.h: store bssid and ruid for quick lookup

---
 src/cntlr_map.c         | 3 +++
 src/wifi_dataelements.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/cntlr_map.c b/src/cntlr_map.c
index 0bf45bfe..808f6c41 100644
--- a/src/cntlr_map.c
+++ b/src/cntlr_map.c
@@ -246,6 +246,7 @@ int handle_topology_notification(void *cntlr, struct cmdu_buff *cmdu,
 						node_del_sta(old_n, s);
 				}
 
+				memcpy(s->de_sta->bssid, ev->bssid, 6);
 				node_add_sta(n, s);
 
 				txcmdu = cntlr_gen_client_caps_query(c, c->almacaddr, s->macaddr, s->bssid);
@@ -278,6 +279,7 @@ int handle_topology_notification(void *cntlr, struct cmdu_buff *cmdu,
 				memcpy(s->bssid, ev->bssid, 6);
 				s->state = STA_CONNECTED;
 
+				memcpy(s->de_sta->bssid, ev->bssid, 6);
 				node_add_sta(n, s);
 
 				txcmdu = cntlr_gen_client_caps_query(c, c->almacaddr, s->macaddr, s->bssid);
@@ -631,6 +633,7 @@ int handle_topology_response(void *cntlr, struct cmdu_buff *cmdu, struct node *n
 					s->de_sta->conn_time = conntime;
 					s->assoc_time = time(NULL) - conntime;
 
+					memcpy(s->de_sta->bssid, bssid, 6);
 					node_add_sta(n, s);
 					cntlr_dbg(LOG_STA, "%s: STA " MACFMT " connected to Node " MACFMT "\n",
 						  __func__, MAC2STR(s->macaddr), MAC2STR(n->almacaddr));
diff --git a/src/wifi_dataelements.h b/src/wifi_dataelements.h
index 0ede77b7..e7d86e8e 100644
--- a/src/wifi_dataelements.h
+++ b/src/wifi_dataelements.h
@@ -292,6 +292,7 @@ struct wifi_sta_element {
 	time_t tsp;                   /* when the last STA-Link metrics response received */
 	uint32_t time_delta;          /* tsp - time_delta (in ms) = when STA's metrics actually collected */
 	uint8_t macaddr[6];
+	uint8_t bssid[6];
 	struct wifi_caps_element caps;
 	struct wifi_wifi6_capabilities wifi6caps;
 	uint32_t dl_rate;             /* latest data rate in Kbps: ap -> sta */
@@ -360,6 +361,7 @@ struct wifi_bss_element {
 	int invalidate;
 	time_t tsp;
 	uint8_t bssid[6];
+	uint8_t ruid[6];
 	uint8_t ssidlen;
 	char ssid[33];
 	bool enabled;
-- 
GitLab