mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
fix maclist
This commit is contained in:
parent
389be8fca1
commit
590de3617f
2 changed files with 17 additions and 3 deletions
|
@ -94,6 +94,17 @@ int build_hearing_map_sort_client(struct blob_buf *b)
|
|||
blobmsg_add_u32(b, "freq", probe_array[k].freq);
|
||||
blobmsg_add_u8(b, "ht_support", probe_array[k].ht_support);
|
||||
blobmsg_add_u8(b, "vht_support", probe_array[k].vht_support);
|
||||
|
||||
ap ap_entry = ap_array_get_ap(probe_array[k].bssid_addr);
|
||||
|
||||
// check if ap entry is available
|
||||
if (mac_is_equal(ap_entry.bssid_addr, probe_array[k].bssid_addr)) {
|
||||
blobmsg_add_u32(b, "channel_utilization", ap_entry.channel_utilization);
|
||||
blobmsg_add_u32(b, "num_sta", ap_entry.station_count);
|
||||
blobmsg_add_u32(b, "ht", ap_entry.ht);
|
||||
blobmsg_add_u32(b, "vht", ap_entry.vht);
|
||||
}
|
||||
|
||||
blobmsg_add_u32(b, "score", eval_probe_metric(probe_array[k]));
|
||||
blobmsg_close_table(b, ap_list);
|
||||
}
|
||||
|
@ -747,13 +758,14 @@ int insert_to_maclist(uint8_t mac[])
|
|||
{
|
||||
if(mac_in_maclist(mac))
|
||||
{
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
mac_list_entry_last++;
|
||||
for (int i = 0; i < ETH_ALEN; ++i) {
|
||||
mac_list[mac_list_entry_last][i] = mac[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -749,8 +749,10 @@ static int add_mac(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
if (hwaddr_aton(blobmsg_data(tb[MAC_ADDR]), addr))
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
insert_to_maclist(addr);
|
||||
write_mac_to_file("/etc/dawn/mac_list", addr);
|
||||
if(insert_to_maclist(addr) == 0)
|
||||
{
|
||||
write_mac_to_file("/etc/dawn/mac_list", addr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue