node: add methods to access nodes by bssid

Add methods which returns a given node for a provided BSSID. This is
required to retrieve the node object from information available with
a neighbor report.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer
2021-12-29 21:14:25 +01:00
parent 3b51bfbaf6
commit 76ccae62df
3 changed files with 43 additions and 0 deletions

View File

@@ -79,6 +79,19 @@ usteer_free_node(struct ubus_context *ctx, struct usteer_local_node *ln)
free(ln);
}
struct usteer_local_node *usteer_local_node_by_bssid(uint8_t *bssid) {
struct usteer_local_node *ln;
struct usteer_node *n;
for_each_local_node(n) {
ln = container_of(n, struct usteer_local_node, node);
if (!memcmp(n->bssid, bssid, 6))
return ln;
}
return NULL;
}
static void
usteer_handle_remove(struct ubus_context *ctx, struct ubus_subscriber *s,
uint32_t id)