From 8af7b6cb06e70e2dd077e22be7cee87c0706ca7a Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 21 Sep 2021 16:02:16 +0200 Subject: [PATCH] usteer: add BSSID to node struct Add the node BSSID to the usteer_node struct. This will be helpful in the future when evaluating beacon reports from STAs. Signed-off-by: David Bauer --- nl80211.c | 5 +++++ ubus.c | 1 + usteer.h | 1 + 3 files changed, 7 insertions(+) diff --git a/nl80211.c b/nl80211.c index fc3add9..f0ac137 100644 --- a/nl80211.c +++ b/nl80211.c @@ -200,8 +200,13 @@ static void nl80211_init_node(struct usteer_node *node) if (!tb[NL80211_ATTR_WIPHY]) goto nla_put_failure; + if (!tb[NL80211_ATTR_MAC]) + goto nla_put_failure; + ln->wiphy = nla_get_u32(tb[NL80211_ATTR_WIPHY]); + memcpy(node->bssid, nla_data(tb[NL80211_ATTR_MAC]), ETH_ALEN); + if (tb[NL80211_ATTR_SSID]) { int len = nla_len(tb[NL80211_ATTR_SSID]); diff --git a/ubus.c b/ubus.c index 00843ef..5e285d8 100644 --- a/ubus.c +++ b/ubus.c @@ -275,6 +275,7 @@ void usteer_dump_node(struct blob_buf *buf, struct usteer_node *node) void *c; c = blobmsg_open_table(buf, usteer_node_name(node)); + blobmsg_printf(buf, "bssid", MAC_ADDR_FMT, MAC_ADDR_DATA(node->bssid)); blobmsg_add_u32(buf, "freq", node->freq); blobmsg_add_u32(buf, "n_assoc", node->n_assoc); blobmsg_add_u32(buf, "noise", node->noise); diff --git a/usteer.h b/usteer.h index 81d1c5a..20a4432 100644 --- a/usteer.h +++ b/usteer.h @@ -67,6 +67,7 @@ struct usteer_node { struct blob_attr *rrm_nr; struct blob_attr *node_info; char ssid[33]; + uint8_t bssid[6]; bool disabled; int freq; -- 2.30.2