local-node: obtain channel + op-class

In order to send passive beacon-requests, channel and op-class of nodes
are required. Obtain this information per local-node from hostapd.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer
2022-01-08 23:26:03 +01:00
parent c7830b5319
commit 3b51bfbaf6
6 changed files with 52 additions and 0 deletions

View File

@@ -342,6 +342,36 @@ usteer_local_node_list_cb(struct ubus_request *req, int type, struct blob_attr *
usteer_local_node_set_assoc(ln, tb[MSG_CLIENTS]);
}
static void
usteer_local_node_status_cb(struct ubus_request *req, int type, struct blob_attr *msg)
{
enum {
MSG_FREQ,
MSG_CHANNEL,
MSG_OP_CLASS,
__MSG_MAX,
};
static struct blobmsg_policy policy[__MSG_MAX] = {
[MSG_FREQ] = { "freq", BLOBMSG_TYPE_INT32 },
[MSG_CHANNEL] = { "channel", BLOBMSG_TYPE_INT32 },
[MSG_OP_CLASS] = { "op_class", BLOBMSG_TYPE_INT32 },
};
struct blob_attr *tb[__MSG_MAX];
struct usteer_local_node *ln;
struct usteer_node *node;
ln = container_of(req, struct usteer_local_node, req);
node = &ln->node;
blobmsg_parse(policy, __MSG_MAX, tb, blob_data(msg), blob_len(msg));
if (tb[MSG_FREQ])
node->freq = blobmsg_get_u32(tb[MSG_FREQ]);
if (tb[MSG_CHANNEL])
node->channel = blobmsg_get_u32(tb[MSG_CHANNEL]);
if (tb[MSG_FREQ])
node->op_class = blobmsg_get_u32(tb[MSG_OP_CLASS]);
}
static void
usteer_local_node_rrm_nr_cb(struct ubus_request *req, int type, struct blob_attr *msg)
{
@@ -438,6 +468,10 @@ usteer_local_node_state_next(struct uloop_timeout *timeout)
ubus_invoke_async(ubus_ctx, ln->obj_id, "get_clients", b.head, &ln->req);
ln->req.data_cb = usteer_local_node_list_cb;
break;
case REQ_STATUS:
ubus_invoke_async(ubus_ctx, ln->obj_id, "get_status", b.head, &ln->req);
ln->req.data_cb = usteer_local_node_status_cb;
break;
case REQ_RRM_SET_LIST:
usteer_local_node_prepare_rrm_set(ln);
ubus_invoke_async(ubus_ctx, ln->obj_id, "rrm_nr_set", b.head, &ln->req);