Parse ht and vht information in probe

This commit is contained in:
PolynomialDivision 2017-07-24 00:43:58 +02:00
parent e9daee896c
commit f8c2b60249
3 changed files with 22 additions and 15 deletions

View file

@ -23,6 +23,8 @@ typedef struct probe_entry_s {
uint8_t target_addr[ETH_ALEN];
uint32_t signal;
uint32_t freq;
uint8_t ht_support;
uint8_t vht_support;
time_t time;
int counter;
} probe_entry;

View file

@ -661,8 +661,8 @@ void print_probe_entry(probe_entry entry) {
printf(
"bssid_addr: %s, client_addr: %s, target_addr: %s, signal: %d, freq: "
"%d, counter: %d\n",
mac_buf_ap, mac_buf_client, mac_buf_target, entry.signal, entry.freq,
"%d, ht: %d, vht: %d, counter: %d\n",
mac_buf_ap, mac_buf_client, mac_buf_target, entry.signal, entry.freq, entry.ht_support, entry.vht_support,
entry.counter);
}
@ -679,7 +679,7 @@ void print_client_entry(client entry) {
void print_client_array() {
printf("--------Clients------\n");
printf("Probe Entry Last: %d\n", client_entry_last);
printf("Client Entry Last: %d\n", client_entry_last);
for(int i = 0; i <= client_entry_last; i++)
{
print_client_entry(client_array[i]);

View file

@ -23,15 +23,19 @@ enum {
PROB_TARGET_ADDR,
PROB_SIGNAL,
PROB_FREQ,
PROB_HT_SUPPORT,
PROB_VHT_SUPPORT,
__PROB_MAX,
};
static const struct blobmsg_policy prob_policy[__PROB_MAX] = {
[PROB_BSSID_ADDR] = {.name = "bssid", .type = BLOBMSG_TYPE_STRING},
[PROB_CLIENT_ADDR] = {.name = "address", .type = BLOBMSG_TYPE_STRING},
[PROB_TARGET_ADDR] = {.name = "target", .type = BLOBMSG_TYPE_STRING},
[PROB_SIGNAL] = {.name = "signal", .type = BLOBMSG_TYPE_INT32},
[PROB_FREQ] = {.name = "freq", .type = BLOBMSG_TYPE_INT32},
[PROB_BSSID_ADDR] = {.name = "bssid", .type = BLOBMSG_TYPE_STRING},
[PROB_CLIENT_ADDR] = {.name = "address", .type = BLOBMSG_TYPE_STRING},
[PROB_TARGET_ADDR] = {.name = "target", .type = BLOBMSG_TYPE_STRING},
[PROB_SIGNAL] = {.name = "signal", .type = BLOBMSG_TYPE_INT32},
[PROB_FREQ] = {.name = "freq", .type = BLOBMSG_TYPE_INT32},
[PROB_HT_SUPPORT] = {.name = "ht_support", .type = BLOBMSG_TYPE_INT8},
[PROB_VHT_SUPPORT] = {.name = "vht_support", .type = BLOBMSG_TYPE_INT8},
};
enum {
@ -127,18 +131,18 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) {
if (tb[PROB_SIGNAL]) {
prob_req->signal = blobmsg_get_u32(tb[PROB_SIGNAL]);
}
else
{
return -1;
}
if (tb[PROB_FREQ]) {
prob_req->freq = blobmsg_get_u32(tb[PROB_FREQ]);
}
else
{
return -1;
if (tb[PROB_HT_SUPPORT]) {
prob_req->ht_support = blobmsg_get_u8(tb[PROB_HT_SUPPORT]);
}
if (tb[PROB_VHT_SUPPORT]) {
prob_req->vht_support = blobmsg_get_u8(tb[PROB_VHT_SUPPORT]);
}
return 0;
@ -265,6 +269,7 @@ dump_client(struct blob_attr **tb, uint8_t client_addr[], const char* bssid_addr
//sprintf(mac_buf_ap, "%x:%x:%x:%x:%x:%x", MAC2STR(client_entry.bssid_addr));
//sprintf(mac_buf_client, "%x:%x:%x:%x:%x:%x", MAC2STR(client_entry.client_addr));
//printf("Frequency is: %d\n",freq);
client_entry.freq = freq;
client_entry.ht_supported = ht_supported;