Merge pull request #26 from berlin-open-wireless-lab/feature/deny_probe_requests

Feature/deny probe requests
This commit is contained in:
Polynomdivision 2017-12-20 10:43:21 +01:00 committed by GitHub
commit 79b2b029d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 4 deletions

View file

@ -35,3 +35,4 @@ config settings metric
option min_probe_count '4'
option bandwith_threshold '6'
option use_station_count '1'
option eval_probe_req '1'

View file

@ -34,6 +34,7 @@ struct probe_metric_s {
int min_probe_count;
int bandwith_threshold;
int use_station_count;
int eval_probe_req;
};
struct time_config_s {

View file

@ -217,6 +217,14 @@ struct probe_metric_s uci_get_dawn_metric() {
if (ptr.o->type == UCI_TYPE_STRING)
ret.use_station_count = atoi(ptr.o->v.string);
char tmp_eval_probe_req[] = "dawn.metric.eval_probe_req";
if (uci_lookup_ptr(c, &ptr, tmp_eval_probe_req, 1) != UCI_OK) {
uci_perror(c, "uci_get_daw_metric Error");
return ret;
}
if (ptr.o->type == UCI_TYPE_STRING)
ret.eval_probe_req = atoi(ptr.o->v.string);
printf("Loaded metric: %d\n", ret.min_probe_count);
uci_free_context(c);

View file

@ -337,7 +337,7 @@ static int handle_probe_req(struct blob_attr *msg) {
parse_to_probe_req(msg, &prob_req);
//insert_to_list(prob_req, 1);
//probe_entry tmp_probe =
insert_to_array(prob_req, 1);
probe_entry tmp_prob_req = insert_to_array(prob_req, 1);
// send probe via network
@ -348,12 +348,18 @@ static int handle_probe_req(struct blob_attr *msg) {
printf("[WC] Hostapd-Probe: %s : %s\n", "probe", str);
//print_probe_array();
/*
// deny access
if (!decide_function(&tmp_probe)) {
if(!dawn_metric.eval_probe_req)
{
return 0;
}
if (!decide_function(&tmp_prob_req)) {
//printf("MAC WILL BE DECLINED!!!\n");
return UBUS_STATUS_UNKNOWN_ERROR;
}*/
}
//printf("MAC WILL BE ACCEPDTED!!!\n");
return 0;
}