remote: include node BSSID into messages
Add the node BSSID to messages exchanged between usteer hosts. This way, a foreign node can determine the node reported by a STA using beacon reports. Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
4
parse.c
4
parse.c
@@ -55,6 +55,7 @@ bool parse_apmsg_node(struct apmsg_node *msg, struct blob_attr *data)
|
|||||||
{
|
{
|
||||||
static const struct blob_attr_info policy[__APMSG_NODE_MAX] = {
|
static const struct blob_attr_info policy[__APMSG_NODE_MAX] = {
|
||||||
[APMSG_NODE_NAME] = { .type = BLOB_ATTR_STRING },
|
[APMSG_NODE_NAME] = { .type = BLOB_ATTR_STRING },
|
||||||
|
[APMSG_NODE_BSSID] = { .type = BLOB_ATTR_BINARY },
|
||||||
[APMSG_NODE_FREQ] = { .type = BLOB_ATTR_INT32 },
|
[APMSG_NODE_FREQ] = { .type = BLOB_ATTR_INT32 },
|
||||||
[APMSG_NODE_N_ASSOC] = { .type = BLOB_ATTR_INT32 },
|
[APMSG_NODE_N_ASSOC] = { .type = BLOB_ATTR_INT32 },
|
||||||
[APMSG_NODE_MAX_ASSOC] = { .type = BLOB_ATTR_INT32 },
|
[APMSG_NODE_MAX_ASSOC] = { .type = BLOB_ATTR_INT32 },
|
||||||
@@ -69,6 +70,8 @@ bool parse_apmsg_node(struct apmsg_node *msg, struct blob_attr *data)
|
|||||||
|
|
||||||
blob_parse(data, tb, policy, __APMSG_NODE_MAX);
|
blob_parse(data, tb, policy, __APMSG_NODE_MAX);
|
||||||
if (!tb[APMSG_NODE_NAME] ||
|
if (!tb[APMSG_NODE_NAME] ||
|
||||||
|
!tb[APMSG_NODE_BSSID] ||
|
||||||
|
blob_len(tb[APMSG_NODE_BSSID]) != 6 ||
|
||||||
!tb[APMSG_NODE_FREQ] ||
|
!tb[APMSG_NODE_FREQ] ||
|
||||||
!tb[APMSG_NODE_N_ASSOC] ||
|
!tb[APMSG_NODE_N_ASSOC] ||
|
||||||
!tb[APMSG_NODE_STATIONS] ||
|
!tb[APMSG_NODE_STATIONS] ||
|
||||||
@@ -80,6 +83,7 @@ bool parse_apmsg_node(struct apmsg_node *msg, struct blob_attr *data)
|
|||||||
msg->freq = blob_get_int32(tb[APMSG_NODE_FREQ]);
|
msg->freq = blob_get_int32(tb[APMSG_NODE_FREQ]);
|
||||||
msg->stations = tb[APMSG_NODE_STATIONS];
|
msg->stations = tb[APMSG_NODE_STATIONS];
|
||||||
msg->ssid = blob_data(tb[APMSG_NODE_SSID]);
|
msg->ssid = blob_data(tb[APMSG_NODE_SSID]);
|
||||||
|
msg->bssid = blob_data(tb[APMSG_NODE_BSSID]);
|
||||||
|
|
||||||
msg->noise = get_int32(tb[APMSG_NODE_NOISE]);
|
msg->noise = get_int32(tb[APMSG_NODE_NOISE]);
|
||||||
msg->load = get_int32(tb[APMSG_NODE_LOAD]);
|
msg->load = get_int32(tb[APMSG_NODE_LOAD]);
|
||||||
|
4
remote.c
4
remote.c
@@ -269,6 +269,9 @@ interface_add_node(struct usteer_remote_host *host, struct blob_attr *data)
|
|||||||
node->node.max_assoc = msg.max_assoc;
|
node->node.max_assoc = msg.max_assoc;
|
||||||
node->node.noise = msg.noise;
|
node->node.noise = msg.noise;
|
||||||
node->node.load = msg.load;
|
node->node.load = msg.load;
|
||||||
|
|
||||||
|
memcpy(node->node.bssid, msg.bssid, sizeof(node->node.bssid));
|
||||||
|
|
||||||
snprintf(node->node.ssid, sizeof(node->node.ssid), "%s", msg.ssid);
|
snprintf(node->node.ssid, sizeof(node->node.ssid), "%s", msg.ssid);
|
||||||
usteer_node_set_blob(&node->node.rrm_nr, msg.rrm_nr);
|
usteer_node_set_blob(&node->node.rrm_nr, msg.rrm_nr);
|
||||||
usteer_node_set_blob(&node->node.node_info, msg.node_info);
|
usteer_node_set_blob(&node->node.node_info, msg.node_info);
|
||||||
@@ -538,6 +541,7 @@ static void usteer_send_node(struct usteer_node *node, struct sta_info *sta)
|
|||||||
blob_put_int32(&buf, APMSG_NODE_LOAD, node->load);
|
blob_put_int32(&buf, APMSG_NODE_LOAD, node->load);
|
||||||
blob_put_int32(&buf, APMSG_NODE_N_ASSOC, node->n_assoc);
|
blob_put_int32(&buf, APMSG_NODE_N_ASSOC, node->n_assoc);
|
||||||
blob_put_int32(&buf, APMSG_NODE_MAX_ASSOC, node->max_assoc);
|
blob_put_int32(&buf, APMSG_NODE_MAX_ASSOC, node->max_assoc);
|
||||||
|
blob_put(&buf, APMSG_NODE_BSSID, node->bssid, sizeof(node->bssid));
|
||||||
if (node->rrm_nr) {
|
if (node->rrm_nr) {
|
||||||
r = blob_nest_start(&buf, APMSG_NODE_RRM_NR);
|
r = blob_nest_start(&buf, APMSG_NODE_RRM_NR);
|
||||||
blobmsg_add_field(&buf, BLOBMSG_TYPE_ARRAY, "",
|
blobmsg_add_field(&buf, BLOBMSG_TYPE_ARRAY, "",
|
||||||
|
2
remote.h
2
remote.h
@@ -48,12 +48,14 @@ enum {
|
|||||||
APMSG_NODE_MAX_ASSOC,
|
APMSG_NODE_MAX_ASSOC,
|
||||||
APMSG_NODE_RRM_NR,
|
APMSG_NODE_RRM_NR,
|
||||||
APMSG_NODE_NODE_INFO,
|
APMSG_NODE_NODE_INFO,
|
||||||
|
APMSG_NODE_BSSID,
|
||||||
__APMSG_NODE_MAX
|
__APMSG_NODE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
struct apmsg_node {
|
struct apmsg_node {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *ssid;
|
const char *ssid;
|
||||||
|
const char *bssid;
|
||||||
int freq;
|
int freq;
|
||||||
int n_assoc;
|
int n_assoc;
|
||||||
int max_assoc;
|
int max_assoc;
|
||||||
|
Reference in New Issue
Block a user