From 11d446a117d1295eee8e137a2e8c7d350cc91042 Mon Sep 17 00:00:00 2001
From: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: Mon, 29 Apr 2019 09:39:27 +0200
Subject: [PATCH] prevent showing bsss from other band in list_neighbor

---
 wifimngr_wifi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/wifimngr_wifi.c b/wifimngr_wifi.c
index 038a7d5..ddb2061 100644
--- a/wifimngr_wifi.c
+++ b/wifimngr_wifi.c
@@ -66,10 +66,16 @@ int wifimngr_wifi_nbr_list(struct blob_buf *bb, char *ifname, bool wildcard)
 	void *a, *t;
 	char bssid_str[18] = {0};
 	int i;
+	int channel = 0;
+	int band = -1;
 
 	if (wifi_get_neighbor_list(ifname, &nbr, &nr) < 0)
 		return -1;
 
+	wifi_get_channel(ifname, &channel);
+	if (channel != 0)
+		band = channel >= 36 ? 1 : 0;
+
 	if (!wildcard)
 		a = blobmsg_open_array(bb, "neighbors");
 
@@ -77,6 +83,14 @@ int wifimngr_wifi_nbr_list(struct blob_buf *bb, char *ifname, bool wildcard)
 		struct nbr *e;
 
 		e = nbr + i;
+
+		/* ugly workaround to make sure that BSSs from the other
+		 * band do not get listed.
+		 */
+		if ((band == 1 && e->channel < 36) ||
+			(band == 0 && channel >= 36))
+			continue;
+
 		t = blobmsg_open_table(bb, "");
 		sprintf(bssid_str, "%02X:%02X:%02X:%02X:%02X:%02X",
 				e->bssid[0], e->bssid[1], e->bssid[2],
-- 
GitLab