ubus: filter neighbors by SSID when preparing nr

Only add neighbors with the same SSID to an interface's neighbor report.
While it is possible to offer roaming to a different SSID, it is often
not desired, while at least Apple devices limit the number of entries
they will use to 6.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
Eneas U de Queiroz 2021-07-06 18:09:19 -03:00 committed by Polynomdivision
parent 3db9607b14
commit 555268b91d
2 changed files with 6 additions and 5 deletions

View file

@ -78,7 +78,7 @@ int build_hearing_map_sort_client(struct blob_buf* b);
int build_network_overview(struct blob_buf* b);
int ap_get_nr(struct blob_buf* b, struct dawn_mac own_bssid_addr);
int ap_get_nr(struct blob_buf* b, struct dawn_mac own_bssid_addr, const char *ssid);
int parse_add_mac_to_file(struct blob_attr* msg);

View file

@ -867,7 +867,7 @@ void ubus_set_nr(){
if (sub->subscribed) {
int timeout = 1;
blob_buf_init(&b_nr, 0);
ap_get_nr(&b_nr, sub->bssid_addr);
ap_get_nr(&b_nr, sub->bssid_addr, sub->ssid);
ubus_invoke(ctx, sub->id, "rrm_nr_set", b_nr.head, NULL, NULL, timeout * 1000);
}
}
@ -1563,7 +1563,7 @@ int build_network_overview(struct blob_buf *b) {
// TODO: Does all APs constitute neighbor report? How about using list of AP connected
// clients can also see (from probe_set) to give more (physically) local set?
int ap_get_nr(struct blob_buf *b_local, struct dawn_mac own_bssid_addr) {
int ap_get_nr(struct blob_buf *b_local, struct dawn_mac own_bssid_addr, const char *ssid) {
pthread_mutex_lock(&ap_array_mutex);
ap *i;
@ -1571,8 +1571,9 @@ int ap_get_nr(struct blob_buf *b_local, struct dawn_mac own_bssid_addr) {
void* nbs = blobmsg_open_array(b_local, "list");
for (i = ap_set; i != NULL; i = i->next_ap) {
if (mac_is_equal_bb(own_bssid_addr, i->bssid_addr)) {
continue; //TODO: Skip own entry?!
if (mac_is_equal_bb(own_bssid_addr, i->bssid_addr) ||
strncmp((char *)i->ssid, ssid, SSID_MAX_LEN)) {
continue;
}
void* nr_entry = blobmsg_open_array(b_local, NULL);