mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-12 06:57:57 +04:00
hostapd: ubus notifies a change of the BSS Color fields
A subscriber that reports the BSS Color and the OBSS colours of a radio
must know when they change without a configuration change. The kernel announces a colour change that the
driver starts, aborts or completes, but hostapd takes the new colour,
or leaves BSS Color disabled, only when it handles that event. Some
changes have no event at all:
- with no free colour left, the collision timeout disables BSS Color
and picks a new colour itself;
- a collision timeout whose colour change the driver does not start
leaves BSS Color disabled;
- the OBSS colours of the radio change.
606-ap-notify-ubus-of-a-bss-color-change calls the new
hostapd_ubus_notify_bss_color():
- in the no free colour branch of the collision timeout;
- after the colour change loop of the collision timeout. This call
fires in every case, whether the driver started the change or not;
- at the end of hostapd_event_color_change(), after hostapd took the
new colour at a completion, or left BSS Color disabled at an abort;
- when the aged set of OBSS colours of the radio changes, as a colour
is added or leaves it (174), and not at each repeated collision
event.
It sends the bss-color-change notification, { ifname, bssid, link_id }
(link_id for an affiliated AP of an AP MLD), on the object of the BSS.
get_status carries the new values.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
1 parent
5fe8fade02
commit
ae3fabae25
3 files changed
+91
No files matched your search
+67
@@ -0,0 +1,67 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sat, 3 Oct 2026 22:00:00 +0200
|
||||
Subject: [PATCH] AP: notify ubus of a BSS Color change
|
||||
|
||||
A ubus subscriber that reports the BSS Color of a radio and the colours
|
||||
of the OBSSs around it needs to know when either changes. The kernel
|
||||
announces a colour change that the driver starts, aborts or completes,
|
||||
but hostapd takes the new colour, or leaves BSS Color disabled, only
|
||||
when it handles that event, and some changes have no event at all:
|
||||
- with no free colour left, the collision timeout disables BSS Color
|
||||
and picks a new colour itself;
|
||||
- a collision timeout whose colour change the driver does not start
|
||||
leaves BSS Color disabled;
|
||||
- the OBSS colours of the radio change.
|
||||
|
||||
Send the bss-color-change ubus notification:
|
||||
- in the no free colour branch of the collision timeout;
|
||||
- after the colour change loop of the collision timeout, in every case,
|
||||
whether the driver started the change or not;
|
||||
- at the end of hostapd_event_color_change(), after hostapd took the
|
||||
new colour at a completion, or left BSS Color disabled at an abort;
|
||||
- when the aged set of OBSS colours of the radio changes, as a colour
|
||||
is added or leaves it, and not at each repeated collision event.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
--- a/src/ap/drv_callbacks.c
|
||||
+++ b/src/ap/drv_callbacks.c
|
||||
@@ -2537,6 +2537,7 @@ static void hostapd_event_color_change(s
|
||||
}
|
||||
|
||||
hostapd_bss_colors_in_use_update(hapd->iface);
|
||||
+ hostapd_ubus_notify_bss_color(hapd);
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211AX */
|
||||
|
||||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -5441,6 +5441,7 @@ void hostapd_switch_color_timeout_handle
|
||||
hapd->iface->conf->he_op.he_bss_color = os_random() % 63 + 1;
|
||||
for (b = 0; b < hapd->iface->num_bss; b++)
|
||||
ieee802_11_set_beacon(hapd->iface->bss[b]);
|
||||
+ hostapd_ubus_notify_bss_color(hapd);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5467,6 +5468,8 @@ void hostapd_switch_color_timeout_handle
|
||||
free_beacon_data(&settings.beacon_after);
|
||||
os_free(settings.ubpr.unsol_bcast_probe_resp_tmpl);
|
||||
}
|
||||
+
|
||||
+ hostapd_ubus_notify_bss_color(hapd);
|
||||
}
|
||||
|
||||
|
||||
@@ -5527,7 +5530,11 @@ static void hostapd_bss_colors_in_use_ag
|
||||
hostapd_bss_colors_in_use_timeout,
|
||||
iface, NULL);
|
||||
|
||||
+ if (in_use == iface->bss_colors_in_use)
|
||||
+ return;
|
||||
+
|
||||
iface->bss_colors_in_use = in_use;
|
||||
+ hostapd_ubus_notify_bss_color(iface->bss[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2892,3 +2892,21 @@ void hostapd_ubus_notify_csa(struct hostapd_data *hapd, int freq)
|
||||
|
||||
ubus_notify(ctx, obj, "channel-switch", b.head, -1);
|
||||
}
|
||||
|
||||
void hostapd_ubus_notify_bss_color(struct hostapd_data *hapd)
|
||||
{
|
||||
struct ubus_object *obj = hostapd_ubus_notify_obj(hapd);
|
||||
|
||||
if (!obj->has_subscribers)
|
||||
return;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
blobmsg_add_string(&b, "ifname", hapd->conf->iface);
|
||||
blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->own_addr));
|
||||
#ifdef CONFIG_IEEE80211BE
|
||||
if (hapd->conf->mld_ap)
|
||||
blobmsg_add_u32(&b, "link_id", hapd->mld_link_id);
|
||||
#endif /* CONFIG_IEEE80211BE */
|
||||
|
||||
ubus_notify(ctx, obj, "bss-color-change", b.head, -1);
|
||||
}
|
||||
@@ -90,6 +90,7 @@ void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *
|
||||
const char *auth_alg);
|
||||
void hostapd_ubus_notify_sta_links(struct hostapd_data *hapd, struct sta_info *sta);
|
||||
void hostapd_ubus_notify_csa(struct hostapd_data *hapd, int freq);
|
||||
void hostapd_ubus_notify_bss_color(struct hostapd_data *hapd);
|
||||
void hostapd_ubus_notify_action_frame(struct hostapd_data *hapd,
|
||||
const char *type, const u8 *addr,
|
||||
const u8 *body, size_t body_len);
|
||||
@@ -197,6 +198,11 @@ hostapd_ubus_notify_csa(struct hostapd_data *hapd, int freq)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
hostapd_ubus_notify_bss_color(struct hostapd_data *hapd)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
hostapd_ubus_notify_action_frame(struct hostapd_data *hapd, const char *type,
|
||||
const u8 *addr, const u8 *body,
|
||||
|
||||
Reference in new issue
Block a user