mirror of
https://gitlab.com/prpl-foundation/prplmesh/prplMesh.git
synced 2025-12-20 01:21:22 +08:00
agent: channel scan task: Prevent duplicate neighbor entries caused by multiple and/or invalid neighbor results
- Fixed issue where valid neighbors were reported multiple times when scan requests included multiple opclasses sharing the same channel. - Duplicate entries occurred because each opclass result appended the same neighbor repeatedly. - Implemented a check during insertion to ensure each neighbor is added only once based on BSSID and spectrum_info_present flag. - Zero-initialized neighbors were reported because multiple spectrum entries existed for the same scan result, which is invalid. Once duplicate neighbor additions were prevented, this issue was resolved as w ell. Closes PPM-3698 Signed-off-by: Cem KOC <cem.koc@airties.com>
This commit is contained in:
@@ -845,8 +845,22 @@ bool ChannelScanTask::store_radio_scan_result(const std::shared_ptr<sScanRequest
|
||||
* the channel element's channel number.
|
||||
*/
|
||||
if (_20MHz_channels.find(results.channel) != _20MHz_channels.end()) {
|
||||
LOG(DEBUG) << "Setting result in channel " << ch_elem.channel_number;
|
||||
request->radio_scans->cached_results[ch_elem.channel_number].push_back(results);
|
||||
auto &results_vector = request->radio_scans->cached_results[ch_elem.channel_number];
|
||||
auto it = std::find_if(results_vector.begin(), results_vector.end(),
|
||||
[&](const beerocks_message::sChannelScanResults &rhs) {
|
||||
return rhs.bssid == results.bssid &&
|
||||
rhs.spectrum_info_present ==
|
||||
results.spectrum_info_present;
|
||||
});
|
||||
|
||||
if (it == results_vector.end()) {
|
||||
LOG(DEBUG) << "Setting result in channel " << ch_elem.channel_number;
|
||||
results_vector.push_back(results);
|
||||
} else {
|
||||
LOG(DEBUG) << "Ignoring duplicated result in channel "
|
||||
<< ch_elem.channel_number;
|
||||
}
|
||||
|
||||
// Move on to next operating class in radio scan
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user