aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-07-07 17:40:41 +0200
committerFelix Fietkau <nbd@nbd.name>2021-07-12 13:33:56 +0200
commitda2c244e8c9f30e4fc5bf77f0800d685e35d1888 (patch)
tree454dea57bf57d780e959e60ca4e2c160a128a840 /package/network
parent1ec4af41511f6d95ff7a370898a0be3ee43c0f00 (diff)
downloadupstream-da2c244e8c9f30e4fc5bf77f0800d685e35d1888.tar.gz
upstream-da2c244e8c9f30e4fc5bf77f0800d685e35d1888.tar.bz2
upstream-da2c244e8c9f30e4fc5bf77f0800d685e35d1888.zip
hostapd: initialize ht/vht/he mode on channel switch by default
Use the current mode, but allow overwriting via ubus command parameters Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/network')
-rw-r--r--package/network/services/hostapd/src/src/ap/ubus.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index 49901fc4c3..9918f17d67 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -768,7 +768,15 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
{
struct blob_attr *tb[__CSA_MAX];
struct hostapd_data *hapd = get_hapd_from_object(obj);
- struct csa_settings css;
+ struct hostapd_config *iconf = hapd->iface->conf;
+ struct csa_settings css = {
+ .freq_params = {
+ .ht_enabled = iconf->ieee80211n,
+ .vht_enabled = iconf->ieee80211ac,
+ .he_enabled = iconf->ieee80211ax,
+ .sec_channel_offset = iconf->secondary_channel,
+ }
+ };
int ret = UBUS_STATUS_OK;
int i;
@@ -777,7 +785,21 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
if (!tb[CSA_FREQ])
return UBUS_STATUS_INVALID_ARGUMENT;
- memset(&css, 0, sizeof(css));
+ switch (iconf->vht_oper_chwidth) {
+ case CHANWIDTH_USE_HT:
+ if (iconf->secondary_channel)
+ css.freq_params.bandwidth = 40;
+ else
+ css.freq_params.bandwidth = 20;
+ break;
+ case CHANWIDTH_160MHZ:
+ css.freq_params.bandwidth = 160;
+ break;
+ default:
+ css.freq_params.bandwidth = 80;
+ break;
+ }
+
css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]);
#define SET_CSA_SETTING(name, field, type) \