improve configuration - try by auth and probe

This commit is contained in:
Martin/Geno 2019-06-12 16:41:11 +02:00
parent e2c60e543e
commit b6605da3c9
7 changed files with 87 additions and 86 deletions

View File

@ -2,20 +2,22 @@
bool config_verbose = false; bool config_verbose = false;
int config_client_try_threashold = 3; int config_client_try_probe_threashold = 3;
int config_client_try_auth_threashold = 0;
int config_client_signal_threashold = -75; int config_client_signal_threashold = -75;
int config_client_clean_every = 600; //in ms = 10min int config_client_clean_every = 600; //in ms = 10min
int config_client_clean_older_then = 3600; //in sec = 1h int config_client_clean_older_then = 3600; //in sec = 1h
bool config_client_clean_authed = false; bool config_client_clean_authed = false;
bool config_client_force = false;
bool config_client_force_probe = false; bool config_client_force_probe = false;
bool config_client_probe_steering = false; bool config_client_force_auth = false;
// steering contains learning already // steering contains learning already
bool config_client_probe_learning = true; bool config_client_learning_probe = true;
#ifndef MINI #ifndef MINI
bool config_client_socket_learning = true; bool config_client_learning_socket = true;
bool config_socket_always_answer = false; bool config_socket_always_answer = false;
#endif #endif

View File

@ -7,28 +7,28 @@
extern bool config_verbose; extern bool config_verbose;
extern int config_client_try_threashold; extern int config_client_try_probe_threashold;
extern int config_client_try_auth_threashold;
extern int config_client_signal_threashold; extern int config_client_signal_threashold;
extern int config_client_clean_every; extern int config_client_clean_every;
extern int config_client_clean_older_then; extern int config_client_clean_older_then;
extern bool config_client_clean_authed; extern bool config_client_clean_authed;
// force (disable 2.4 Ghz) // force (disable 2.4 Ghz) for wifi probes/auth;
extern bool config_client_force;
// force (disable 2.4 Ghz) for wifi probes
extern bool config_client_force_probe; extern bool config_client_force_probe;
// use client_try_threashold for probes, too extern bool config_client_force_auth;
extern bool config_client_probe_steering;
/* /*
steering contains learning already: steering contains learning already:
when client_probe_steering is set, when client_probe_steering is set,
client_probe_learning is ignored client_probe_learning is ignored
*/ */
extern bool config_client_probe_learning; extern bool config_client_learning_probe;
#ifndef MINI #ifndef MINI
extern bool config_client_socket_learning; extern bool config_client_learning_socket;
extern bool config_socket_always_answer; extern bool config_socket_always_answer;
#endif #endif

View File

@ -17,12 +17,12 @@ struct option longopts[] = {
{"verbose", no_argument, 0, 'v'}, {"verbose", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
// Bandsteering options // Bandsteering options
{"try", required_argument, 0, 't'}, {"try-probe", required_argument, 0, 'p'},
{"try-auth", required_argument, 0, 'a'},
{"signal", required_argument, 0, 's'}, {"signal", required_argument, 0, 's'},
{"force", optional_argument, 0, 'f'}, {"force-auth", optional_argument, 0, 'f'},
{"force-probe", optional_argument, 0, 1}, {"force-probe", optional_argument, 0, 1},
{"probe", optional_argument, 0, 'p'}, {"learning-probe", optional_argument, 0, 2},
{"probe-learning", optional_argument, 0, 2},
// memory options // memory options
{"clean-every", required_argument, 0, 3}, {"clean-every", required_argument, 0, 3},
{"clean-older-then", required_argument, 0, 4}, {"clean-older-then", required_argument, 0, 4},
@ -35,7 +35,7 @@ struct option longopts[] = {
{"if", required_argument, 0, 9}, {"if", required_argument, 0, 9},
{"mif", required_argument, 0, 10}, {"mif", required_argument, 0, 10},
// other extended option // other extended option
{"socket-learning", optional_argument, 0, 11}, {"learning-socket", optional_argument, 0, 11},
{"socket-always-answer", optional_argument, 0, 12}, {"socket-always-answer", optional_argument, 0, 12},
#endif #endif
}; };
@ -49,12 +49,12 @@ void usage(int c) {
#endif #endif
printf(" -h|--help show this help text\n"); printf(" -h|--help show this help text\n");
printf("\nbandsteering options:\n"); printf("\nbandsteering options:\n");
printf(" -t|--try threashold till allow (current: %d)\n", config_client_try_threashold); printf(" -p|--try-probe threashold of wifi probe till allow (current: %d)\n", config_client_try_probe_threashold);
printf(" -a|--try-auth threashold of wifi auth till allow (current: %d)\n", config_client_try_auth_threashold);
printf(" -s|--signal threashold to allow (current: %d)\n", config_client_signal_threashold); printf(" -s|--signal threashold to allow (current: %d)\n", config_client_signal_threashold);
printf(" -f|--force force steering (current: %s)\n", BOOL2STR(config_client_force)); printf(" -f|--force-auth force steering (current: %s)\n", BOOL2STR(config_client_force_auth));
printf(" --force-probe force steering only for probes (current: %s)\n", BOOL2STR(config_client_force_probe)); printf(" --force-probe force steering only for probes (current: %s)\n", BOOL2STR(config_client_force_probe));
printf(" -p|--probe probe-steering (current: %s)\n", BOOL2STR(config_client_probe_steering)); printf(" --learning-probe probe-learing (current: %s)\n", BOOL2STR(config_client_learning_probe));
printf(" --probe-learning probe-learing (current: %s)\n", BOOL2STR(config_client_probe_learning));
printf(" (parameter ignored if probe-steering on)\n"); printf(" (parameter ignored if probe-steering on)\n");
printf("\nmemory cleanup options:\n"); printf("\nmemory cleanup options:\n");
printf(" --clean-every run cleaning every (current: %ds)\n", config_client_clean_every); printf(" --clean-every run cleaning every (current: %ds)\n", config_client_clean_every);
@ -68,7 +68,7 @@ void usage(int c) {
printf(" --if listen on interface (current: %s)\n", ifname); printf(" --if listen on interface (current: %s)\n", ifname);
printf(" --mif listen on interface for multicast (current: %s)\n", ifname); printf(" --mif listen on interface for multicast (current: %s)\n", ifname);
printf("\nother extended options:\n"); printf("\nother extended options:\n");
printf(" --socket-learning learn clients during listen on socket (current: %s)\n", BOOL2STR(config_client_socket_learning)); printf(" --learning-socket learn clients during listen on socket (current: %s)\n", BOOL2STR(config_client_learning_socket));
printf(" --socket-always-answer answer on socket only with useful information (current: %s)\n", BOOL2STR(config_socket_always_answer)); printf(" --socket-always-answer answer on socket only with useful information (current: %s)\n", BOOL2STR(config_socket_always_answer));
#endif #endif
printf("\nSome config could be changed by ubus, see `ubus -v list wifictld`\n"); printf("\nSome config could be changed by ubus, see `ubus -v list wifictld`\n");
@ -87,7 +87,7 @@ int main(int argc, char *argv[])
#endif #endif
int c = 0, indexptr = 0; int c = 0, indexptr = 0;
while ((c = getopt_long(argc, argv, "vht:s:fp",longopts, &indexptr)) != -1) { while ((c = getopt_long(argc, argv, "vh:pas:f",longopts, &indexptr)) != -1) {
switch (c) { switch (c) {
case 'v': case 'v':
config_verbose = !config_verbose; config_verbose = !config_verbose;
@ -96,9 +96,16 @@ int main(int argc, char *argv[])
usage(0); usage(0);
return 0; return 0;
// Bandsteering options // Bandsteering options
case 't': case 'p':
config_client_try_threashold = atoi(optarg); config_client_try_probe_threashold = atoi(optarg);
if (config_client_try_threashold < 0) { if (config_client_try_probe_threashold < 0) {
printf("negativ tries count not supported\n");
return 1;
}
break;
case 'a':
config_client_try_auth_threashold = atoi(optarg);
if (config_client_try_auth_threashold < 0) {
printf("negativ tries count not supported\n"); printf("negativ tries count not supported\n");
return 1; return 1;
} }
@ -112,9 +119,9 @@ int main(int argc, char *argv[])
break; break;
case 'f': case 'f':
if(optarg) if(optarg)
config_client_force = atoi(optarg); config_client_force_auth = atoi(optarg);
else else
config_client_force = !config_client_force; config_client_force_auth = !config_client_force_auth;
break; break;
case 1: case 1:
if(optarg) if(optarg)
@ -122,17 +129,11 @@ int main(int argc, char *argv[])
else else
config_client_force_probe = !config_client_force_probe; config_client_force_probe = !config_client_force_probe;
break; break;
case 'p':
if(optarg)
config_client_probe_steering = atoi(optarg);
else
config_client_probe_steering = !config_client_probe_steering;
break;
case 2: case 2:
if(optarg) if(optarg)
config_client_probe_learning = atoi(optarg); config_client_learning_probe = atoi(optarg);
else else
config_client_probe_learning = !config_client_probe_learning; config_client_learning_probe = !config_client_learning_probe;
break; break;
// memory options // memory options
case 3: case 3:
@ -175,9 +176,9 @@ int main(int argc, char *argv[])
// other extended option // other extended option
case 11: case 11:
if(optarg) if(optarg)
config_client_socket_learning = atoi(optarg); config_client_learning_socket = atoi(optarg);
else else
config_client_socket_learning = !config_client_socket_learning; config_client_learning_socket = !config_client_learning_socket;
break; break;
case 12: case 12:
if(optarg) if(optarg)
@ -222,7 +223,7 @@ int main(int argc, char *argv[])
} }
c = 0; c = 0;
indexptr = 0; indexptr = 0;
while ((c = getopt_long(argc, argv, "vht:s:fp",longopts, &indexptr)) != -1) { while ((c = getopt_long(argc, argv, "vh:pas:f",longopts, &indexptr)) != -1) {
switch (c) { switch (c) {
case 10: case 10:
socket_join_mcast(optarg); socket_join_mcast(optarg);

View File

@ -25,7 +25,7 @@ static int handle_client(struct socket_msg *msg, int response) {
} }
return response; return response;
} }
if(!config_client_socket_learning) if(!config_client_learning_socket)
return SOCKET_HANDLER_SILENCE; return SOCKET_HANDLER_SILENCE;
// learn client // learn client
msg->client->try_probe = 0; msg->client->try_probe = 0;

View File

@ -149,18 +149,12 @@ static int receive_notify(struct ubus_context *ctx, struct ubus_object *obj, str
} }
if (!strcmp(method, "probe")) { if (!strcmp(method, "probe")) {
if(config_client_probe_steering) { if (wifi_clients_try(&hclient)) {
if (wifi_clients_try(&hclient)) { log_verbose("%s["MACSTR"] freq: %d signal %d -> reject\n", method, MAC2STR(addr), hclient.freq, hclient.ssi_signal);
log_verbose("%s["MACSTR"] freq: %d signal %d -> reject\n", method, MAC2STR(addr), hclient.freq, hclient.ssi_signal); return WLAN_STATUS_UNSPECIFIED_FAILURE;
return WLAN_STATUS_UNSPECIFIED_FAILURE;
}
log_verbose("%s["MACSTR"] freq: %d signal %d -> accept\n", method, MAC2STR(addr), hclient.freq, hclient.ssi_signal);
return WLAN_STATUS_SUCCESS;
}
if(config_client_probe_learning) {
log_verbose("%s["MACSTR"] freq: %d signal %d -> learn\n", method, MAC2STR(addr), hclient.freq, hclient.ssi_signal);
wifi_clients_learn(&hclient);
} }
log_verbose("%s["MACSTR"] freq: %d signal %d -> accept\n", method, MAC2STR(addr), hclient.freq, hclient.ssi_signal);
return WLAN_STATUS_SUCCESS;
} else { } else {
wifi_clients_disconnect(&hclient); wifi_clients_disconnect(&hclient);
log_verbose("%s["MACSTR"] freq: %d signal %d -> disconnect\n", method, MAC2STR(addr), hclient.freq, hclient.ssi_signal); log_verbose("%s["MACSTR"] freq: %d signal %d -> disconnect\n", method, MAC2STR(addr), hclient.freq, hclient.ssi_signal);

View File

@ -78,17 +78,17 @@ static int ubus_get_config(struct ubus_context *ctx, struct ubus_object *obj,
void *list = blobmsg_open_table(&b, "config"); void *list = blobmsg_open_table(&b, "config");
blobmsg_add_bool(&b, "verbose", config_verbose); blobmsg_add_bool(&b, "verbose", config_verbose);
blobmsg_add_u32(&b, "client_try_threashold", config_client_try_threashold); blobmsg_add_u32(&b, "client_try_probe_threashold", config_client_try_probe_threashold);
blobmsg_add_u32(&b, "client_try_auth_threashold", config_client_try_auth_threashold);
blobmsg_add_u32(&b, "client_signal_threashold", config_client_signal_threashold); blobmsg_add_u32(&b, "client_signal_threashold", config_client_signal_threashold);
blobmsg_add_u32(&b, "client_clean_every", config_client_clean_every); blobmsg_add_u32(&b, "client_clean_every", config_client_clean_every);
blobmsg_add_u32(&b, "client_clean_older_then", config_client_clean_older_then); blobmsg_add_u32(&b, "client_clean_older_then", config_client_clean_older_then);
blobmsg_add_bool(&b, "client_clean_authed", config_client_clean_authed); blobmsg_add_bool(&b, "client_clean_authed", config_client_clean_authed);
blobmsg_add_bool(&b, "client_force", config_client_force);
blobmsg_add_bool(&b, "client_force_probe", config_client_force_probe); blobmsg_add_bool(&b, "client_force_probe", config_client_force_probe);
blobmsg_add_bool(&b, "client_probe_steering", config_client_probe_steering); blobmsg_add_bool(&b, "client_force_auth", config_client_force_auth);
blobmsg_add_bool(&b, "client_probe_learning", config_client_probe_learning); blobmsg_add_bool(&b, "client_learning_probe", config_client_learning_probe);
#ifndef MINI #ifndef MINI
blobmsg_add_bool(&b, "client_socket_learning", config_client_socket_learning); blobmsg_add_bool(&b, "client_learning_socket", config_client_learning_socket);
blobmsg_add_bool(&b, "socket_always_answer", config_socket_always_answer); blobmsg_add_bool(&b, "socket_always_answer", config_socket_always_answer);
#endif #endif
@ -102,17 +102,17 @@ static int ubus_get_config(struct ubus_context *ctx, struct ubus_object *obj,
enum { enum {
SET_CONFIG_VERBOSE, SET_CONFIG_VERBOSE,
SET_CONFIG_CLIENT_TRY_THREASHOLD, SET_CONFIG_CLIENT_TRY_PROBE_THREASHOLD,
SET_CONFIG_CLIENT_TRY_AUTH_THREASHOLD,
SET_CONFIG_CLIENT_SIGNAL_THREASHOLD, SET_CONFIG_CLIENT_SIGNAL_THREASHOLD,
SET_CONFIG_CLIENT_CLEAN_EVERY, SET_CONFIG_CLIENT_CLEAN_EVERY,
SET_CONFIG_CLIENT_CLEAN_OLDER_THEN, SET_CONFIG_CLIENT_CLEAN_OLDER_THEN,
SET_CONFIG_CLIENT_CLEAN_AUTHED, SET_CONFIG_CLIENT_CLEAN_AUTHED,
SET_CONFIG_CLIENT_FORCE,
SET_CONFIG_CLIENT_FORCE_PROBE, SET_CONFIG_CLIENT_FORCE_PROBE,
SET_CONFIG_CLIENT_PROBE_STEERING, SET_CONFIG_CLIENT_FORCE_AUTH,
SET_CONFIG_CLIENT_PROBE_LEARNING, SET_CONFIG_CLIENT_LEARNING_PROBE,
#ifndef MINI #ifndef MINI
SET_CONFIG_CLIENT_SOCKET_LEARNING, SET_CONFIG_CLIENT_LEARNING_SOCKET,
SET_CONFIG_SOCKET_ALWAYS_ANSWER, SET_CONFIG_SOCKET_ALWAYS_ANSWER,
#endif #endif
__SET_CONFIG_MAX __SET_CONFIG_MAX
@ -120,17 +120,17 @@ enum {
static const struct blobmsg_policy ubus_set_config_policy[__SET_CONFIG_MAX] = { static const struct blobmsg_policy ubus_set_config_policy[__SET_CONFIG_MAX] = {
[SET_CONFIG_VERBOSE] = { "verbose", BLOBMSG_TYPE_BOOL }, [SET_CONFIG_VERBOSE] = { "verbose", BLOBMSG_TYPE_BOOL },
[SET_CONFIG_CLIENT_TRY_THREASHOLD] = { "client_try_threashold", BLOBMSG_TYPE_INT32 }, [SET_CONFIG_CLIENT_TRY_PROBE_THREASHOLD] = { "client_try_probe_threashold", BLOBMSG_TYPE_INT32 },
[SET_CONFIG_CLIENT_TRY_AUTH_THREASHOLD] = { "client_try_auth_threashold", BLOBMSG_TYPE_INT32 },
[SET_CONFIG_CLIENT_SIGNAL_THREASHOLD] = { "client_signal_threashold", BLOBMSG_TYPE_INT32 }, [SET_CONFIG_CLIENT_SIGNAL_THREASHOLD] = { "client_signal_threashold", BLOBMSG_TYPE_INT32 },
[SET_CONFIG_CLIENT_CLEAN_EVERY] = { "client_clean_every", BLOBMSG_TYPE_INT32 }, [SET_CONFIG_CLIENT_CLEAN_EVERY] = { "client_clean_every", BLOBMSG_TYPE_INT32 },
[SET_CONFIG_CLIENT_CLEAN_OLDER_THEN] = { "client_clean_older_then", BLOBMSG_TYPE_INT32 }, [SET_CONFIG_CLIENT_CLEAN_OLDER_THEN] = { "client_clean_older_then", BLOBMSG_TYPE_INT32 },
[SET_CONFIG_CLIENT_CLEAN_AUTHED] = { "client_clean_authed", BLOBMSG_TYPE_BOOL }, [SET_CONFIG_CLIENT_CLEAN_AUTHED] = { "client_clean_authed", BLOBMSG_TYPE_BOOL },
[SET_CONFIG_CLIENT_FORCE] = { "client_force", BLOBMSG_TYPE_BOOL },
[SET_CONFIG_CLIENT_FORCE_PROBE] = { "client_force_probe", BLOBMSG_TYPE_BOOL }, [SET_CONFIG_CLIENT_FORCE_PROBE] = { "client_force_probe", BLOBMSG_TYPE_BOOL },
[SET_CONFIG_CLIENT_PROBE_STEERING] = { "client_probe_steering", BLOBMSG_TYPE_BOOL }, [SET_CONFIG_CLIENT_FORCE_AUTH] = { "client_force_auth", BLOBMSG_TYPE_BOOL },
[SET_CONFIG_CLIENT_PROBE_LEARNING] = { "client_probe_learning", BLOBMSG_TYPE_BOOL }, [SET_CONFIG_CLIENT_LEARNING_PROBE] = { "client_learning_probe", BLOBMSG_TYPE_BOOL },
#ifndef MINI #ifndef MINI
[SET_CONFIG_CLIENT_SOCKET_LEARNING] = { "client_socket_learning", BLOBMSG_TYPE_BOOL }, [SET_CONFIG_CLIENT_LEARNING_SOCKET] = { "client_learning_socket", BLOBMSG_TYPE_BOOL },
[SET_CONFIG_SOCKET_ALWAYS_ANSWER] = { "socket_always_answer", BLOBMSG_TYPE_BOOL }, [SET_CONFIG_SOCKET_ALWAYS_ANSWER] = { "socket_always_answer", BLOBMSG_TYPE_BOOL },
#endif #endif
}; };
@ -143,26 +143,28 @@ static int ubus_set_config(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_parse(ubus_set_config_policy, __SET_CONFIG_MAX, tb, blob_data(msg), blob_len(msg)); blobmsg_parse(ubus_set_config_policy, __SET_CONFIG_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[SET_CONFIG_VERBOSE] && if (!tb[SET_CONFIG_VERBOSE] &&
!tb[SET_CONFIG_CLIENT_TRY_THREASHOLD] && !tb[SET_CONFIG_CLIENT_TRY_PROBE_THREASHOLD] &&
!tb[SET_CONFIG_CLIENT_TRY_AUTH_THREASHOLD] &&
!tb[SET_CONFIG_CLIENT_SIGNAL_THREASHOLD] && !tb[SET_CONFIG_CLIENT_SIGNAL_THREASHOLD] &&
!tb[SET_CONFIG_CLIENT_CLEAN_EVERY] && !tb[SET_CONFIG_CLIENT_CLEAN_EVERY] &&
!tb[SET_CONFIG_CLIENT_CLEAN_OLDER_THEN] && !tb[SET_CONFIG_CLIENT_CLEAN_OLDER_THEN] &&
!tb[SET_CONFIG_CLIENT_CLEAN_AUTHED] && !tb[SET_CONFIG_CLIENT_CLEAN_AUTHED] &&
!tb[SET_CONFIG_CLIENT_FORCE] &&
!tb[SET_CONFIG_CLIENT_FORCE_PROBE] && !tb[SET_CONFIG_CLIENT_FORCE_PROBE] &&
!tb[SET_CONFIG_CLIENT_PROBE_STEERING] && !tb[SET_CONFIG_CLIENT_FORCE_AUTH] &&
!tb[SET_CONFIG_CLIENT_PROBE_LEARNING] !tb[SET_CONFIG_CLIENT_LEARNING_PROBE]
#ifndef MINI #ifndef MINI
&& &&
!tb[SET_CONFIG_CLIENT_SOCKET_LEARNING] && !tb[SET_CONFIG_CLIENT_LEARNING_SOCKET] &&
!tb[SET_CONFIG_SOCKET_ALWAYS_ANSWER] !tb[SET_CONFIG_SOCKET_ALWAYS_ANSWER]
#endif #endif
) )
return UBUS_STATUS_INVALID_ARGUMENT; return UBUS_STATUS_INVALID_ARGUMENT;
if (tb[SET_CONFIG_VERBOSE]) if (tb[SET_CONFIG_VERBOSE])
config_verbose = blobmsg_get_bool(tb[SET_CONFIG_VERBOSE]); config_verbose = blobmsg_get_bool(tb[SET_CONFIG_VERBOSE]);
if (tb[SET_CONFIG_CLIENT_TRY_THREASHOLD]) if (tb[SET_CONFIG_CLIENT_TRY_PROBE_THREASHOLD])
config_client_try_threashold = blobmsg_get_u32(tb[SET_CONFIG_CLIENT_TRY_THREASHOLD]); config_client_try_probe_threashold = blobmsg_get_u32(tb[SET_CONFIG_CLIENT_TRY_PROBE_THREASHOLD]);
if (tb[SET_CONFIG_CLIENT_TRY_AUTH_THREASHOLD])
config_client_try_auth_threashold = blobmsg_get_u32(tb[SET_CONFIG_CLIENT_TRY_AUTH_THREASHOLD]);
if (tb[SET_CONFIG_CLIENT_SIGNAL_THREASHOLD]) if (tb[SET_CONFIG_CLIENT_SIGNAL_THREASHOLD])
config_client_signal_threashold = blobmsg_get_u32(tb[SET_CONFIG_CLIENT_SIGNAL_THREASHOLD]); config_client_signal_threashold = blobmsg_get_u32(tb[SET_CONFIG_CLIENT_SIGNAL_THREASHOLD]);
if (tb[SET_CONFIG_CLIENT_CLEAN_EVERY]) if (tb[SET_CONFIG_CLIENT_CLEAN_EVERY])
@ -171,17 +173,15 @@ static int ubus_set_config(struct ubus_context *ctx, struct ubus_object *obj,
config_client_clean_older_then = blobmsg_get_u32(tb[SET_CONFIG_CLIENT_CLEAN_OLDER_THEN]); config_client_clean_older_then = blobmsg_get_u32(tb[SET_CONFIG_CLIENT_CLEAN_OLDER_THEN]);
if (tb[SET_CONFIG_CLIENT_CLEAN_AUTHED]) if (tb[SET_CONFIG_CLIENT_CLEAN_AUTHED])
config_client_clean_authed = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_CLEAN_AUTHED]); config_client_clean_authed = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_CLEAN_AUTHED]);
if (tb[SET_CONFIG_CLIENT_FORCE])
config_client_force = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_FORCE]);
if (tb[SET_CONFIG_CLIENT_FORCE_PROBE]) if (tb[SET_CONFIG_CLIENT_FORCE_PROBE])
config_client_force_probe = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_FORCE_PROBE]); config_client_force_probe = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_FORCE_PROBE]);
if (tb[SET_CONFIG_CLIENT_PROBE_STEERING]) if (tb[SET_CONFIG_CLIENT_FORCE_AUTH])
config_client_probe_steering = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_PROBE_STEERING]); config_client_force_auth = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_FORCE_AUTH]);
if (tb[SET_CONFIG_CLIENT_PROBE_LEARNING]) if (tb[SET_CONFIG_CLIENT_LEARNING_PROBE])
config_client_probe_learning = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_PROBE_LEARNING]); config_client_learning_probe = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_LEARNING_PROBE]);
#ifndef MINI #ifndef MINI
if (tb[SET_CONFIG_CLIENT_SOCKET_LEARNING]) if (tb[SET_CONFIG_CLIENT_LEARNING_SOCKET])
config_client_socket_learning = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_SOCKET_LEARNING]); config_client_learning_socket = blobmsg_get_bool(tb[SET_CONFIG_CLIENT_LEARNING_SOCKET]);
if (tb[SET_CONFIG_SOCKET_ALWAYS_ANSWER]) if (tb[SET_CONFIG_SOCKET_ALWAYS_ANSWER])
config_socket_always_answer = blobmsg_get_bool(tb[SET_CONFIG_SOCKET_ALWAYS_ANSWER]); config_socket_always_answer = blobmsg_get_bool(tb[SET_CONFIG_SOCKET_ALWAYS_ANSWER]);
#endif #endif

View File

@ -142,6 +142,10 @@ struct wifi_client *__get_client(struct hostapd_client *hclient){
} }
#endif #endif
if(!config_client_learning_probe && !hclient->auth) {
return client;
}
client->avl.key = client->addr; client->avl.key = client->addr;
log_debug("wifi_clients.__get_client("MACSTR"): add client to mem\n", MAC2STR(hclient->address)); log_debug("wifi_clients.__get_client("MACSTR"): add client to mem\n", MAC2STR(hclient->address));
avl_insert(&clients_by_addr, &client->avl); avl_insert(&clients_by_addr, &client->avl);
@ -163,7 +167,7 @@ int wifi_clients_try(struct hostapd_client *hclient) {
client->try_probe = 0; client->try_probe = 0;
}else{ }else{
if(config_client_force_probe){ if(config_client_force_probe){
log_verbose("probe(try=%d mac="MACSTR" freq=%d ssi=%d): ", client->try_auth, MAC2STR(hclient->address), hclient->freq, hclient->ssi_signal); log_verbose("probe(try_auth=%d mac="MACSTR" freq=%d ssi=%d): ", client->try_auth, MAC2STR(hclient->address), hclient->freq, hclient->ssi_signal);
}else{ }else{
log_verbose("probe(try=%d mac="MACSTR" freq=%d ssi=%d): ", client->try_probe, MAC2STR(hclient->address), hclient->freq, hclient->ssi_signal); log_verbose("probe(try=%d mac="MACSTR" freq=%d ssi=%d): ", client->try_probe, MAC2STR(hclient->address), hclient->freq, hclient->ssi_signal);
client->try_probe++; client->try_probe++;
@ -181,7 +185,7 @@ int wifi_clients_try(struct hostapd_client *hclient) {
return 0; return 0;
} }
if (client->freq_highest > WIFI_CLIENT_FREQ_THREASHOLD) { if (client->freq_highest > WIFI_CLIENT_FREQ_THREASHOLD) {
if (config_client_force && hclient->auth || config_client_force_probe && !hclient->auth) { if (config_client_force_auth && hclient->auth || config_client_force_probe && !hclient->auth) {
if(!hclient->auth){ if(!hclient->auth){
log_verbose("reject - force\n"); log_verbose("reject - force\n");
return -1; return -1;
@ -200,8 +204,8 @@ int wifi_clients_try(struct hostapd_client *hclient) {
} }
} }
if(hclient->auth && client->try_auth > config_client_try_threashold || if(hclient->auth && client->try_auth > config_client_try_auth_threashold ||
!hclient->auth && client->try_probe > config_client_try_threashold !hclient->auth && client->try_probe > config_client_try_probe_threashold
) { ) {
if(!hclient->auth){ if(!hclient->auth){
client->try_probe = 0; client->try_probe = 0;