mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
uci: add neighbor list priority options
This adds config options to define MACSs of neighbors to be on top of each band's neighbor list. This is important, because some clients will limit the number of entries they use. iOS devices, for exmample, use only the top 6 APs. The neighbors_11g and neighbors_11a take a list or space-separated string of AP BSSIDs to keep at the top of each band's neighbor report. The list is used when the neighbor report is being assembled. Any listed AP that is not online will not be included in that report. When the next report is assembled, if the AP is back online, then they are restored to the indicated order. There's only one list for each band. In case of multiple SSIDs, you can include BSSIDs for all of them, and they will be filtered by SSID when assembling the reports. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
parent
2b1a53cddc
commit
97e5de157f
3 changed files with 105 additions and 19 deletions
|
|
@ -1617,36 +1617,61 @@ int build_network_overview(struct blob_buf *b) {
|
|||
}
|
||||
|
||||
|
||||
static void blobmsg_add_nr(struct blob_buf *b_local, ap *i) {
|
||||
void* nr_entry = blobmsg_open_array(b_local, NULL);
|
||||
char mac_buf[20];
|
||||
|
||||
sprintf(mac_buf, MACSTRLOWER, MAC2STR(i->bssid_addr.u8));
|
||||
blobmsg_add_string(b_local, NULL, mac_buf);
|
||||
|
||||
blobmsg_add_string(b_local, NULL, (char *) i->ssid);
|
||||
blobmsg_add_string(b_local, NULL, i->neighbor_report);
|
||||
blobmsg_close_array(b_local, nr_entry);
|
||||
}
|
||||
|
||||
static int mac_is_in_entry_list(const struct dawn_mac mac, const struct mac_entry_s *list) {
|
||||
for (const struct mac_entry_s *i = list; i; i = i->next_mac)
|
||||
if (mac_is_equal_bb(i->mac, mac))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 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?
|
||||
// Here, we let the user configure a list of preferred APs that clients can see, and then
|
||||
// add the rest of all APs. hostapd inserts this list backwards, so we must start with
|
||||
// the regular APs, then add the preferred ones, which are already ordered backwards.
|
||||
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;
|
||||
ap *i, *own_ap;
|
||||
struct mac_entry_s *preferred_list, *n;
|
||||
|
||||
void* nbs = blobmsg_open_array(b_local, "list");
|
||||
|
||||
own_ap = ap_array_get_ap(own_bssid_addr, (uint8_t*)ssid);
|
||||
if (!own_ap)
|
||||
return -1;
|
||||
for (int band = 0; band < __DAWN_BAND_MAX; band++) {
|
||||
preferred_list = dawn_metric.neighbors[band];
|
||||
if (own_ap->freq <= max_band_freq[band])
|
||||
break;
|
||||
}
|
||||
pthread_mutex_lock(&ap_array_mutex);
|
||||
for (i = ap_set; i != NULL; i = i->next_ap) {
|
||||
if (mac_is_equal_bb(own_bssid_addr, i->bssid_addr) ||
|
||||
strncmp((char *)i->ssid, ssid, SSID_MAX_LEN)) {
|
||||
continue;
|
||||
if (i != own_ap && !strncmp((char *)i->ssid, ssid, SSID_MAX_LEN) &&
|
||||
!mac_is_in_entry_list(i->bssid_addr, preferred_list))
|
||||
{
|
||||
blobmsg_add_nr(b_local, i);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&ap_array_mutex);
|
||||
|
||||
void* nr_entry = blobmsg_open_array(b_local, NULL);
|
||||
|
||||
char mac_buf[20];
|
||||
sprintf(mac_buf, MACSTRLOWER, MAC2STR(i->bssid_addr.u8));
|
||||
blobmsg_add_string(b_local, NULL, mac_buf);
|
||||
|
||||
blobmsg_add_string(b_local, NULL, (char *) i->ssid);
|
||||
blobmsg_add_string(b_local, NULL, i->neighbor_report);
|
||||
blobmsg_close_array(b_local, nr_entry);
|
||||
|
||||
for (n = preferred_list; n; n = n->next_mac) {
|
||||
if ((i = ap_array_get_ap(n->mac, (uint8_t*)ssid)))
|
||||
blobmsg_add_nr(b_local, i);
|
||||
}
|
||||
blobmsg_close_array(b_local, nbs);
|
||||
|
||||
pthread_mutex_unlock(&ap_array_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue