diff --git a/src/include/datastorage.h b/src/include/datastorage.h index b2378d5..d6aff85 100644 --- a/src/include/datastorage.h +++ b/src/include/datastorage.h @@ -34,6 +34,8 @@ typedef struct { typedef struct client_s { uint8_t bssid_addr[ETH_ALEN]; uint8_t client_addr[ETH_ALEN]; + uint8_t ht_supported; + uint8_t vht_supported; uint32_t freq; uint8_t auth; uint8_t assoc; diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index ee84eaa..a6d9162 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -63,7 +63,7 @@ void kick_clients(uint8_t bssid[]) TODO: KICK ONLY FROM ONE BSSID? */ printf("KICKING CLIENT!!!!!!!!!!!!!\n"); - del_client(client_array[j].client_addr, 5, 1, 60000); + //del_client(client_array[j].client_addr, 5, 1, 60000); } else { printf("STAAAY CLIENT!!!!!!!!!!!!!\n"); @@ -673,8 +673,8 @@ void print_client_entry(client entry) { sprintf(mac_buf_ap, "%x:%x:%x:%x:%x:%x", MAC2STR(entry.bssid_addr)); sprintf(mac_buf_client, "%x:%x:%x:%x:%x:%x", MAC2STR(entry.client_addr)); - printf("bssid_addr: %s, client_addr: %s, freq: %d\n", - mac_buf_ap, mac_buf_client, entry.freq); + printf("bssid_addr: %s, client_addr: %s, freq: %d, ht_supported: %d, vht_supported: %d, ht: %d, vht: %d\n", + mac_buf_ap, mac_buf_client, entry.freq, entry.ht_supported, entry.vht_supported, entry.ht, entry.vht); } void print_client_array() { diff --git a/src/utils/ubus.c b/src/utils/ubus.c index bb68767..433d089 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -38,6 +38,8 @@ enum { CLIENT_TABLE, CLIENT_TABLE_BSSID, CLIENT_TABLE_FREQ, + CLIENT_TABLE_HT, + CLIENT_TABLE_VHT, __CLIENT_TABLE_MAX, }; @@ -45,6 +47,8 @@ static const struct blobmsg_policy client_table_policy[__CLIENT_TABLE_MAX] = { [CLIENT_TABLE] = {.name = "clients", .type = BLOBMSG_TYPE_TABLE}, [CLIENT_TABLE_BSSID] = {.name = "bssid", .type = BLOBMSG_TYPE_STRING}, [CLIENT_TABLE_FREQ] = {.name = "freq", .type = BLOBMSG_TYPE_INT32}, + [CLIENT_TABLE_HT] = {.name = "ht_supported", .type = BLOBMSG_TYPE_INT8}, + [CLIENT_TABLE_VHT] = {.name = "vht_supported", .type = BLOBMSG_TYPE_INT8}, }; enum { @@ -248,7 +252,7 @@ int dawn_init_ubus(const char *ubus_socket, char *hostapd_dir) { } static void -dump_client(struct blob_attr **tb, uint8_t client_addr[], const char* bssid_addr, uint32_t freq) +dump_client(struct blob_attr **tb, uint8_t client_addr[], const char* bssid_addr, uint32_t freq, uint8_t ht_supported, uint8_t vht_supported) { client client_entry; @@ -263,6 +267,9 @@ dump_client(struct blob_attr **tb, uint8_t client_addr[], const char* bssid_addr //sprintf(mac_buf_client, "%x:%x:%x:%x:%x:%x", MAC2STR(client_entry.client_addr)); client_entry.freq = freq; + client_entry.ht_supported = ht_supported; + client_entry.vht_supported = vht_supported; + if (tb[CLIENT_AUTH]) { client_entry.auth = blobmsg_get_u8(tb[CLIENT_AUTH]); } @@ -302,7 +309,7 @@ dump_client(struct blob_attr **tb, uint8_t client_addr[], const char* bssid_addr } static void -dump_client_table(struct blob_attr *head, int len, const char* bssid_addr, uint32_t freq) +dump_client_table(struct blob_attr *head, int len, const char* bssid_addr, uint32_t freq, uint8_t ht_supported, uint8_t vht_supported) { struct blob_attr *attr; struct blobmsg_hdr *hdr; @@ -320,7 +327,7 @@ dump_client_table(struct blob_attr *head, int len, const char* bssid_addr, uint3 for(int i = 0; i < ETH_ALEN; ++i ) tmp_mac[i] = (uint8_t) tmp_int_mac[i]; - dump_client(tb, tmp_mac, bssid_addr, freq); + dump_client(tb, tmp_mac, bssid_addr, freq, ht_supported, vht_supported); } } @@ -329,8 +336,8 @@ int parse_to_clients(struct blob_attr *msg) { blobmsg_parse(client_table_policy, __CLIENT_TABLE_MAX, tb, blob_data(msg), blob_len(msg)); - if (tb[CLIENT_TABLE] && tb[CLIENT_TABLE_BSSID] && tb[CLIENT_TABLE_FREQ]) { - dump_client_table(blobmsg_data(tb[CLIENT_TABLE]), blobmsg_data_len(tb[CLIENT_TABLE]), blobmsg_data(tb[CLIENT_TABLE_BSSID]), blobmsg_get_u32(tb[CLIENT_TABLE_FREQ])); + if (tb[CLIENT_TABLE] && tb[CLIENT_TABLE_BSSID] && tb[CLIENT_TABLE_FREQ] && tb[CLIENT_TABLE_HT] && tb[CLIENT_TABLE_VHT]) { + dump_client_table(blobmsg_data(tb[CLIENT_TABLE]), blobmsg_data_len(tb[CLIENT_TABLE]), blobmsg_data(tb[CLIENT_TABLE_BSSID]), blobmsg_get_u32(tb[CLIENT_TABLE_FREQ]), blobmsg_get_u8(tb[CLIENT_TABLE_HT]), blobmsg_get_u8(tb[CLIENT_TABLE_VHT])); /* BSSID */ /*