Enable ht and vht support in probe req

This commit is contained in:
PolynomialDivision 2017-08-24 15:49:25 +02:00
parent 6241350ba5
commit 086e491516
4 changed files with 13 additions and 37 deletions

View file

@ -34,8 +34,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;
uint8_t ht_support;
uint8_t vht_support;
time_t time;
int counter;
} probe_entry;

View file

@ -22,18 +22,4 @@ void *kick_clients_thread(void *arg);
char *hostapd_dir_glob;
/* Metrik
* RSSI : >= Threshold
* FREQ : >= 5GHZ
*/
/*
* if(client >=)
*
*/
#endif

View file

@ -35,33 +35,23 @@ int client_entry_last = -1;
int eval_probe_metric(struct client_s client_entry, struct probe_entry_s probe_entry) {
/*struct probe_metric_s metric = {
.ht_support = 0,
.vht_support = 0,
.n_ht_support = 0,
.n_ht_support = 0,
.rssi = 0,
.freq = 100}; // this is for testing
*/
int score = 0;
uint8_t client_supports_ht;
uint8_t client_supports_vht;
/*
uint8_t ap_supports_ht;
uint8_t ap_supports_vht;
ap_supports_ht = client_entry.ht_supported;
ap_supports_vht = client_entry.vht_supported;
printf("AP Supports HT: %d\n", ap_supports_ht);
printf("AP Supports VHT: %d\n", ap_supports_vht);
//printf("AP Supports HT: %d\n", ap_supports_ht);
//printf("AP Supports VHT: %d\n", ap_supports_vht);
*/
client_supports_ht = client_entry.ht;
client_supports_vht = client_entry.vht;
/*
printf("Clients Supports HT: %d\n", client_supports_ht);
printf("Clients Supports VHT: %d\n", client_supports_vht);
@ -69,7 +59,7 @@ int eval_probe_metric(struct client_s client_entry, struct probe_entry_s probe_e
printf("Checking if client supports: AP_VHT: %d, CL_VHT: %d\n", ap_supports_vht, client_supports_vht);
if (ap_supports_vht && client_supports_vht) {
printf("AAAHHHHHHHHHHH IDEAL!!!\n");
}
}*/
score += client_supports_vht ? dawn_metric.vht_support : dawn_metric.n_vht_support;
score += client_supports_ht ? dawn_metric.ht_support : dawn_metric.n_ht_support;
@ -89,7 +79,7 @@ int eval_probe_metric(struct client_s client_entry, struct probe_entry_s probe_e
//int kick_client(uint8_t bssid[], uint8_t client[]) {
int kick_client(struct client_s client_entry) {
print_array();
//print_array();
int own_score = 0;

View file

@ -36,8 +36,8 @@ static const struct blobmsg_policy prob_policy[__PROB_MAX] = {
[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},
[PROB_HT_SUPPORT] = {.name = "ht_support", .type = BLOBMSG_TYPE_INT8},
[PROB_VHT_SUPPORT] = {.name = "vht_support", .type = BLOBMSG_TYPE_INT8},
};
enum {
@ -160,7 +160,7 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) {
if (tb[PROB_FREQ]) {
prob_req->freq = blobmsg_get_u32(tb[PROB_FREQ]);
}
/*
if (tb[PROB_HT_SUPPORT]) {
prob_req->ht_support = blobmsg_get_u8(tb[PROB_HT_SUPPORT]);
}
@ -168,7 +168,7 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) {
if (tb[PROB_VHT_SUPPORT]) {
prob_req->vht_support = blobmsg_get_u8(tb[PROB_VHT_SUPPORT]);
}
*/
return 0;
}