From 037603a68f9ba84f43b77cb137f295e2cbec3393 Mon Sep 17 00:00:00 2001 From: Mario Maz Date: Mon, 27 Jul 2020 17:43:39 +0200 Subject: [PATCH 1/7] bwl: add bss field to VAPElement struct https://jira.prplfoundation.org/browse/PPM-311 Add a new field to VAPElement structure to hold the BSS (name) of the VAP. This field will later be used "as is", instead of the hardcoded value that is currently being computed from the VAP ID with method `beerocks::utils::get_iface_string_from_iface_vap_ids` Signed-off-by: Mario Maz --- common/beerocks/bwl/include/bwl/base_wlan_hal_types.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h index 9b0d45d92f..49baa69ae0 100644 --- a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h +++ b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h @@ -46,17 +46,21 @@ enum class AntMode { Invalid = 0, ANT_1X1, ANT_2X2, ANT_3X3, ANT_4X4 }; enum class WiFiChanBW { Invalid = 0, BW_20 = 20, BW_40 = 40, BW_80 = 80 }; struct VAPElement { + /** + * Basic Service Set (i.e.: VAP name, e.g.: wlan0.0, wlan0.1, wlan0.2, ...). + */ + std::string bss; std::string ssid; std::string mac; bool fronthaul; bool backhaul; - virtual bool operator==(const VAPElement &other) const + bool operator==(const VAPElement &other) const { return (ssid == other.ssid && mac == other.mac); } - virtual bool operator!=(const VAPElement &other) const + bool operator!=(const VAPElement &other) const { return (ssid != other.ssid || mac != other.mac); } From ab0dc74ad583e6d28c2334b36285b8e06be12e32 Mon Sep 17 00:00:00 2001 From: Mario Maz Date: Mon, 27 Jul 2020 17:47:15 +0200 Subject: [PATCH 2/7] bwl: nl80211: update refresh_vap_info to fill in bss field https://jira.prplfoundation.org/browse/PPM-311 Fill in the BSS field of the VAPElement structure while refreshing VAP info. Signed-off-by: Mario Maz --- common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp b/common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp index b333e7b61a..4edfc381a7 100644 --- a/common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp +++ b/common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp @@ -764,6 +764,7 @@ bool base_wlan_hal_nl80211::refresh_vaps_info(int id) VAPElement vap_element; // Try reading the BSSID and SSID of the requested VAP + vap_element.bss = reply["bss[" + std::to_string(vap_id) + "]"]; vap_element.mac = reply["bssid[" + std::to_string(vap_id) + "]"]; vap_element.ssid = reply["ssid[" + std::to_string(vap_id) + "]"]; // TODO https://github.com/prplfoundation/prplMesh/issues/1175 @@ -780,7 +781,7 @@ bool base_wlan_hal_nl80211::refresh_vaps_info(int id) // Store the VAP element LOG(DEBUG) << "Detected VAP ID (" << vap_id << ") - MAC: " << vap_element.mac - << ", SSID: " << vap_element.ssid; + << ", SSID: " << vap_element.ssid << ", BSS: " << vap_element.bss; m_radio_info.available_vaps[vap_id] = vap_element; } @@ -789,6 +790,7 @@ bool base_wlan_hal_nl80211::refresh_vaps_info(int id) VAPElement vap_element; // Try reading the BSSID and SSID of the requested VAP + vap_element.bss = reply["bss[" + std::to_string(id) + "]"]; vap_element.mac = reply["bssid[" + std::to_string(id) + "]"]; vap_element.ssid = reply["ssid[" + std::to_string(id) + "]"]; // TODO https://github.com/prplfoundation/prplMesh/issues/1175 From 54f067d82e56ae36c8c7ab4e5d18901b5de3155a Mon Sep 17 00:00:00 2001 From: Mario Maz Date: Tue, 28 Jul 2020 14:14:34 +0200 Subject: [PATCH 3/7] bwl: dwpal: update refresh_vap_info to fill in bss field https://jira.prplfoundation.org/browse/PPM-311 Fill in the BSS field of the VAPElement structure while refreshing VAP info. Signed-off-by: Mario Maz --- common/beerocks/bwl/dwpal/base_wlan_hal_dwpal.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/beerocks/bwl/dwpal/base_wlan_hal_dwpal.cpp b/common/beerocks/bwl/dwpal/base_wlan_hal_dwpal.cpp index cd359cd7d0..fbf1eb428c 100644 --- a/common/beerocks/bwl/dwpal/base_wlan_hal_dwpal.cpp +++ b/common/beerocks/bwl/dwpal/base_wlan_hal_dwpal.cpp @@ -969,6 +969,7 @@ bool base_wlan_hal_dwpal::refresh_vap_info(int vap_id) // New VAP Element VAPElement vapElement; + vapElement.bss = ifname; vapElement.mac = std::string(bssid); vapElement.ssid = std::string(ssid); if (!get_vap_type(ifname, vapElement.fronthaul, vapElement.backhaul)) { From 4803cdaaf479668bed1a2613291914f4795c2948 Mon Sep 17 00:00:00 2001 From: Mario Maz Date: Mon, 27 Jul 2020 17:48:18 +0200 Subject: [PATCH 4/7] fronthaul: monitor: use bss field of VAPElement struct https://jira.prplfoundation.org/browse/PPM-311 Do not use `beerocks::utils::get_iface_string_from_iface_vap_ids()` to compute the VAP name from the VAP id. Instead of the hardcoded value, use the BSS field of the VAPElement structure which was read from device. Signed-off-by: Mario Maz --- .../src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp b/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp index d87b4a3d4d..b15ac86457 100644 --- a/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp +++ b/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp @@ -2241,8 +2241,7 @@ void monitor_thread::update_vaps_in_db() // if vap exist in HAL, update it in the local db. if (radio_vaps.find(vap_id) != radio_vaps.end()) { - auto iface_name = beerocks::utils::get_iface_string_from_iface_vap_ids( - mon_wlan_hal->get_radio_info().iface_name, vap_id); + auto iface_name = radio_vaps.at(vap_id).bss; auto curr_vap = radio_vaps.at(vap_id); From a1fbd8716dc739aa021688a0d0ce1412a9845ae6 Mon Sep 17 00:00:00 2001 From: Mario Maz Date: Tue, 28 Jul 2020 10:57:22 +0200 Subject: [PATCH 5/7] fronthaul: ap_manager: use bss field of VAPElement struct https://jira.prplfoundation.org/browse/PPM-311 Do not use `beerocks::utils::get_iface_string_from_iface_vap_ids()` to compute the VAP name from the VAP id. Instead of the hardcoded value, use the BSS field of the VAPElement structure which was read from device. Signed-off-by: Mario Maz --- .../fronthaul_manager/ap_manager/ap_manager_thread.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/agent/src/beerocks/fronthaul_manager/ap_manager/ap_manager_thread.cpp b/agent/src/beerocks/fronthaul_manager/ap_manager/ap_manager_thread.cpp index 3e78044054..b86c8b32d4 100644 --- a/agent/src/beerocks/fronthaul_manager/ap_manager/ap_manager_thread.cpp +++ b/agent/src/beerocks/fronthaul_manager/ap_manager/ap_manager_thread.cpp @@ -948,9 +948,12 @@ bool ap_manager_thread::handle_cmdu(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_ return element.second.mac == bssid; }); - auto vap_id = it->first; - auto vap_name = utils::get_iface_string_from_iface_vap_ids( - ap_wlan_hal->get_radio_info().iface_name, vap_id); + if (vap_unordered_map.end() == it) { + LOG(ERROR) << "BSSID " << bssid << " not found"; + return false; + } + + auto vap_name = it->second.bss; if (!request->params().remove) { if (!ap_wlan_hal->sta_softblock_add( From 828137f64f7e7386228031c3665899fdfbb3c94c Mon Sep 17 00:00:00 2001 From: Mario Maz Date: Tue, 11 Aug 2020 10:36:51 +0200 Subject: [PATCH 6/7] fixup! bwl: add bss field to VAPElement struct --- common/beerocks/bwl/include/bwl/base_wlan_hal_types.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h index 49baa69ae0..82898bc1b5 100644 --- a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h +++ b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h @@ -57,13 +57,10 @@ struct VAPElement { bool operator==(const VAPElement &other) const { - return (ssid == other.ssid && mac == other.mac); + return (bss == other.bss && ssid == other.ssid && mac == other.mac); } - bool operator!=(const VAPElement &other) const - { - return (ssid != other.ssid || mac != other.mac); - } + bool operator!=(const VAPElement &other) const { return !(*this == other); } }; enum class ChanSwReason { Unknown = 0, Radar = 1, CoEx_20 = 2, CoEx_40 = 3 }; From 0ee69e48b9d385282aad85f6cab8191529d18e10 Mon Sep 17 00:00:00 2001 From: Mario Maz Date: Tue, 11 Aug 2020 10:39:13 +0200 Subject: [PATCH 7/7] fixup! bwl: nl80211: update refresh_vap_info to fill in bss field --- common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp b/common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp index 4edfc381a7..255066fbfc 100644 --- a/common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp +++ b/common/beerocks/bwl/nl80211/base_wlan_hal_nl80211.cpp @@ -763,7 +763,7 @@ bool base_wlan_hal_nl80211::refresh_vaps_info(int id) vap_id++) { VAPElement vap_element; - // Try reading the BSSID and SSID of the requested VAP + // Try reading values of the requested VAP vap_element.bss = reply["bss[" + std::to_string(vap_id) + "]"]; vap_element.mac = reply["bssid[" + std::to_string(vap_id) + "]"]; vap_element.ssid = reply["ssid[" + std::to_string(vap_id) + "]"]; @@ -789,7 +789,7 @@ bool base_wlan_hal_nl80211::refresh_vaps_info(int id) VAPElement vap_element; - // Try reading the BSSID and SSID of the requested VAP + // Try reading values of the requested VAP vap_element.bss = reply["bss[" + std::to_string(id) + "]"]; vap_element.mac = reply["bssid[" + std::to_string(id) + "]"]; vap_element.ssid = reply["ssid[" + std::to_string(id) + "]"];