[PATCH usteer] local_node: read the SSID from hostapd
Patrick Hein
bagbag98 at googlemail.com
Tue Oct 27 06:14:23 PDT 2026
usteer reads a local node's SSID from nl80211 once, when hostapd's ubus
object for the BSS appears. With a STA on the same radio, OpenWrt starts
the APs with start_disabled and enables them once the STA is connected,
but hostapd registers their ubus objects right away. nl80211 reports no
SSID for a BSS that has not been started, so the node gets none. With
ssid_list set, the node then stays disabled; without it, it never
matches the other nodes of its SSID for roaming, band steering or
neighbor reports.
Read the SSID from hostapd's get_status instead; it reports the
configured SSID whether the BSS is started or not. Reading it once is
enough, as hostapd registers the object again when the BSS restarts,
e.g. after an SSID change.
Signed-off-by: Patrick Hein <bagbag98 at googlemail.com>
---
Tested on OpenWrt 25.12.6 with an AP whose 5 GHz radio also carries a
WDS uplink: before, its 5 GHz nodes were missing from local_info after
boot; with this patch, they are listed.
local_node.c | 24 ++++++++++++++++++++++++
nl80211.c | 10 ----------
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/local_node.c b/local_node.c
index d90e4a5..06accae 100644
--- a/local_node.c
+++ b/local_node.c
@@ -840,6 +840,22 @@ usteer_check_node_enabled(struct usteer_local_node *ln)
usteer_node_run_update_script(&ln->node);
}
+static void
+usteer_local_node_ssid_cb(struct ubus_request *req, int type, struct blob_attr *msg)
+{
+ static const struct blobmsg_policy policy = {
+ "ssid", BLOBMSG_TYPE_STRING
+ };
+ struct usteer_local_node *ln = req->priv;
+ struct blob_attr *tb;
+
+ blobmsg_parse(&policy, 1, &tb, blob_data(msg), blob_len(msg));
+ if (!tb)
+ return;
+
+ snprintf(ln->node.ssid, sizeof(ln->node.ssid), "%s", blobmsg_get_string(tb));
+}
+
static void
usteer_register_node(struct ubus_context *ctx, const char *name, uint32_t id)
{
@@ -869,6 +885,14 @@ usteer_register_node(struct ubus_context *ctx, const char *name, uint32_t id)
blobmsg_add_u8(&b, "bss_transition", 1);
ubus_invoke(ctx, id, "bss_mgmt_enable", b.head, NULL, NULL, 1000);
+ /*
+ * A BSS that starts disabled (e.g. on a radio shared with a STA) is
+ * registered before it is started, and nl80211 reports no SSID until
+ * then; hostapd has it from its configuration.
+ */
+ blob_buf_init(&b, 0);
+ ubus_invoke(ctx, id, "get_status", b.head, usteer_local_node_ssid_cb, ln, 1000);
+
list_for_each_entry(h, &node_handlers, list) {
if (!h->init_node)
continue;
diff --git a/nl80211.c b/nl80211.c
index a232505..7e79511 100644
--- a/nl80211.c
+++ b/nl80211.c
@@ -207,16 +207,6 @@ static void nl80211_init_node(struct usteer_node *node)
memcpy(node->bssid, nla_data(tb[NL80211_ATTR_MAC]), ETH_ALEN);
- if (tb[NL80211_ATTR_SSID]) {
- int len = nla_len(tb[NL80211_ATTR_SSID]);
-
- if (len >= sizeof(node->ssid))
- len = sizeof(node->ssid) - 1;
-
- memcpy(node->ssid, nla_data(tb[NL80211_ATTR_SSID]), len);
- node->ssid[len] = 0;
- }
-
MSG(INFO, "Found nl80211 phy on wdev %s, ssid=%s\n", usteer_node_name(node), node->ssid);
ln->load_ewma = -1;
ln->nl80211.present = true;
--
2.56.0
More information about the openwrt-devel
mailing list