add option to deny on probe requests

This commit is contained in:
PolynomialDivision 2017-12-19 19:07:41 +01:00
parent 1375b7a736
commit bd1c38c0ea
4 changed files with 16 additions and 0 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

@ -350,6 +350,12 @@ static int handle_probe_req(struct blob_attr *msg) {
//print_probe_array();
// deny access
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;