local-node: convert kick-dely to absolute time
Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
21
local_node.c
21
local_node.c
@@ -457,12 +457,14 @@ usteer_local_node_status_cb(struct ubus_request *req, int type, struct blob_attr
|
|||||||
MSG_FREQ,
|
MSG_FREQ,
|
||||||
MSG_CHANNEL,
|
MSG_CHANNEL,
|
||||||
MSG_OP_CLASS,
|
MSG_OP_CLASS,
|
||||||
|
MSG_BEACON_INTERVAL,
|
||||||
__MSG_MAX,
|
__MSG_MAX,
|
||||||
};
|
};
|
||||||
static struct blobmsg_policy policy[__MSG_MAX] = {
|
static struct blobmsg_policy policy[__MSG_MAX] = {
|
||||||
[MSG_FREQ] = { "freq", BLOBMSG_TYPE_INT32 },
|
[MSG_FREQ] = { "freq", BLOBMSG_TYPE_INT32 },
|
||||||
[MSG_CHANNEL] = { "channel", BLOBMSG_TYPE_INT32 },
|
[MSG_CHANNEL] = { "channel", BLOBMSG_TYPE_INT32 },
|
||||||
[MSG_OP_CLASS] = { "op_class", BLOBMSG_TYPE_INT32 },
|
[MSG_OP_CLASS] = { "op_class", BLOBMSG_TYPE_INT32 },
|
||||||
|
[MSG_BEACON_INTERVAL] = { "beacon_interval", BLOBMSG_TYPE_INT32 },
|
||||||
};
|
};
|
||||||
struct blob_attr *tb[__MSG_MAX];
|
struct blob_attr *tb[__MSG_MAX];
|
||||||
struct usteer_local_node *ln;
|
struct usteer_local_node *ln;
|
||||||
@@ -478,6 +480,10 @@ usteer_local_node_status_cb(struct ubus_request *req, int type, struct blob_attr
|
|||||||
node->channel = blobmsg_get_u32(tb[MSG_CHANNEL]);
|
node->channel = blobmsg_get_u32(tb[MSG_CHANNEL]);
|
||||||
if (tb[MSG_OP_CLASS])
|
if (tb[MSG_OP_CLASS])
|
||||||
node->op_class = blobmsg_get_u32(tb[MSG_OP_CLASS]);
|
node->op_class = blobmsg_get_u32(tb[MSG_OP_CLASS]);
|
||||||
|
|
||||||
|
/* Local-Node */
|
||||||
|
if (tb[MSG_BEACON_INTERVAL])
|
||||||
|
ln->beacon_interval = blobmsg_get_u32(tb[MSG_BEACON_INTERVAL]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -627,12 +633,13 @@ usteer_local_node_process_bss_tm_queries(struct uloop_timeout *timeout)
|
|||||||
struct usteer_node *node;
|
struct usteer_node *node;
|
||||||
struct sta_info *si;
|
struct sta_info *si;
|
||||||
struct sta *sta;
|
struct sta *sta;
|
||||||
|
uint8_t validity_period;
|
||||||
uint8_t validity_period = 100; /* ~ 10 seconds */
|
|
||||||
|
|
||||||
ln = container_of(timeout, struct usteer_local_node, bss_tm_queries_timeout);
|
ln = container_of(timeout, struct usteer_local_node, bss_tm_queries_timeout);
|
||||||
node = &ln->node;
|
node = &ln->node;
|
||||||
|
|
||||||
|
validity_period = 10000 / usteer_local_node_get_beacon_interval(ln); /* ~ 10 seconds */
|
||||||
|
|
||||||
list_for_each_entry_safe(query, tmp, &ln->bss_tm_queries, list) {
|
list_for_each_entry_safe(query, tmp, &ln->bss_tm_queries, list) {
|
||||||
sta = usteer_sta_get(query->sta_addr, false);
|
sta = usteer_sta_get(query->sta_addr, false);
|
||||||
if (!sta)
|
if (!sta)
|
||||||
@@ -806,6 +813,16 @@ node_list_cb(struct ubus_context *ctx, struct ubus_object_data *obj, void *priv)
|
|||||||
usteer_register_node(ctx, obj->path, obj->id);
|
usteer_register_node(ctx, obj->path, obj->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
usteer_local_node_get_beacon_interval(struct usteer_local_node *ln)
|
||||||
|
{
|
||||||
|
/* Check if beacon-interval is not available (pre-21.02+) */
|
||||||
|
if (ln->beacon_interval < 1)
|
||||||
|
return 100;
|
||||||
|
|
||||||
|
return ln->beacon_interval;
|
||||||
|
}
|
||||||
|
|
||||||
void config_set_node_up_script(struct blob_attr *data)
|
void config_set_node_up_script(struct blob_attr *data)
|
||||||
{
|
{
|
||||||
const char *val;
|
const char *val;
|
||||||
|
2
main.c
2
main.c
@@ -97,7 +97,7 @@ void usteer_init_defaults(void)
|
|||||||
config.initial_connect_delay = 0;
|
config.initial_connect_delay = 0;
|
||||||
config.remote_node_timeout = 10;
|
config.remote_node_timeout = 10;
|
||||||
|
|
||||||
config.roam_kick_delay = 100;
|
config.roam_kick_delay = 10000;
|
||||||
config.roam_process_timeout = 5 * 1000;
|
config.roam_process_timeout = 5 * 1000;
|
||||||
config.roam_scan_tries = 3;
|
config.roam_scan_tries = 3;
|
||||||
config.roam_scan_timeout = 0;
|
config.roam_scan_timeout = 0;
|
||||||
|
2
node.h
2
node.h
@@ -57,6 +57,8 @@ struct usteer_local_node {
|
|||||||
struct uloop_timeout bss_tm_queries_timeout;
|
struct uloop_timeout bss_tm_queries_timeout;
|
||||||
struct list_head bss_tm_queries;
|
struct list_head bss_tm_queries;
|
||||||
|
|
||||||
|
int beacon_interval;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool present;
|
bool present;
|
||||||
struct uloop_timeout update;
|
struct uloop_timeout update;
|
||||||
|
@@ -87,8 +87,8 @@ config usteer
|
|||||||
# Minimum time (ms) between client roaming trigger attempts
|
# Minimum time (ms) between client roaming trigger attempts
|
||||||
#option roam_trigger_interval 60000
|
#option roam_trigger_interval 60000
|
||||||
|
|
||||||
# Timeout (in 100ms beacon intervals) for client roam requests
|
# Timeout (ms) for client roam requests. usteer will kick the client after this times out.
|
||||||
#option roam_kick_delay 100
|
#option roam_kick_delay 10000
|
||||||
|
|
||||||
# Minimum signal strength difference until AP steering policy is active
|
# Minimum signal strength difference until AP steering policy is active
|
||||||
#option signal_diff_threshold 0
|
#option signal_diff_threshold 0
|
||||||
|
2
ubus.c
2
ubus.c
@@ -642,7 +642,7 @@ int usteer_ubus_notify_client_disassoc(struct sta_info *si)
|
|||||||
|
|
||||||
blob_buf_init(&b, 0);
|
blob_buf_init(&b, 0);
|
||||||
blobmsg_printf(&b, "addr", MAC_ADDR_FMT, MAC_ADDR_DATA(si->sta->addr));
|
blobmsg_printf(&b, "addr", MAC_ADDR_FMT, MAC_ADDR_DATA(si->sta->addr));
|
||||||
blobmsg_add_u32(&b, "duration", config.roam_kick_delay);
|
blobmsg_add_u32(&b, "duration", config.roam_kick_delay / usteer_local_node_get_beacon_interval(ln));
|
||||||
usteer_ubus_disassoc_add_neighbors(si);
|
usteer_ubus_disassoc_add_neighbors(si);
|
||||||
return ubus_invoke(ubus_ctx, ln->obj_id, "wnm_disassoc_imminent", b.head, NULL, 0, 100);
|
return ubus_invoke(ubus_ctx, ln->obj_id, "wnm_disassoc_imminent", b.head, NULL, 0, 100);
|
||||||
}
|
}
|
||||||
|
2
usteer.h
2
usteer.h
@@ -311,6 +311,8 @@ int usteer_snr_to_signal(struct usteer_node *node, int snr);
|
|||||||
void usteer_local_nodes_init(struct ubus_context *ctx);
|
void usteer_local_nodes_init(struct ubus_context *ctx);
|
||||||
void usteer_local_node_kick(struct usteer_local_node *ln);
|
void usteer_local_node_kick(struct usteer_local_node *ln);
|
||||||
|
|
||||||
|
int usteer_local_node_get_beacon_interval(struct usteer_local_node *ln);
|
||||||
|
|
||||||
void usteer_ubus_init(struct ubus_context *ctx);
|
void usteer_ubus_init(struct ubus_context *ctx);
|
||||||
void usteer_ubus_kick_client(struct sta_info *si);
|
void usteer_ubus_kick_client(struct sta_info *si);
|
||||||
int usteer_ubus_trigger_client_scan(struct sta_info *si);
|
int usteer_ubus_trigger_client_scan(struct sta_info *si);
|
||||||
|
Reference in New Issue
Block a user