aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Shvedov <yshvedov@wimarksystems.com>2018-07-16 15:15:10 +0300
committerFelix Fietkau <nbd@nbd.name>2018-08-20 09:24:43 +0200
commitcad9519ebaf88cb4f3669ca1a04f04eb5d096311 (patch)
tree08242cd2a2df922a08a7935f9fe5b5d720ad284b
parent2fb95f71425cc1b3cc9424bb2922fd296e4e05bf (diff)
downloadupstream-cad9519ebaf88cb4f3669ca1a04f04eb5d096311.tar.gz
upstream-cad9519ebaf88cb4f3669ca1a04f04eb5d096311.tar.bz2
upstream-cad9519ebaf88cb4f3669ca1a04f04eb5d096311.zip
hostapd: process all CSA parameters
This adds processing of all CSA arguments from ubus switch_chan request in the same manner as in the control interface API. Signed-off-by: Yury Shvedov <yshvedov@wimarksystems.com>
-rw-r--r--package/network/services/hostapd/src/src/ap/ubus.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index 2024d455ba..3375ac49f7 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -382,16 +382,26 @@ hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj,
enum {
CSA_FREQ,
CSA_BCN_COUNT,
+ CSA_CENTER_FREQ1,
+ CSA_CENTER_FREQ2,
+ CSA_BANDWIDTH,
+ CSA_SEC_CHANNEL_OFFSET,
+ CSA_HT,
+ CSA_VHT,
+ CSA_BLOCK_TX,
__CSA_MAX
};
static const struct blobmsg_policy csa_policy[__CSA_MAX] = {
- /*
- * for now, frequency and beacon count are enough, add more
- * parameters on demand
- */
[CSA_FREQ] = { "freq", BLOBMSG_TYPE_INT32 },
[CSA_BCN_COUNT] = { "bcn_count", BLOBMSG_TYPE_INT32 },
+ [CSA_CENTER_FREQ1] = { "center_freq1", BLOBMSG_TYPE_INT32 },
+ [CSA_CENTER_FREQ2] = { "center_freq2", BLOBMSG_TYPE_INT32 },
+ [CSA_BANDWIDTH] = { "bandwidth", BLOBMSG_TYPE_INT32 },
+ [CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 },
+ [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL },
+ [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL },
+ [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL },
};
#ifdef NEED_AP_MLME
@@ -411,12 +421,27 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
memset(&css, 0, sizeof(css));
css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]);
- if (tb[CSA_BCN_COUNT])
- css.cs_count = blobmsg_get_u32(tb[CSA_BCN_COUNT]);
+
+#define SET_CSA_SETTING(name, field, type) \
+ do { \
+ if (tb[name]) \
+ css.field = blobmsg_get_ ## type(tb[name]); \
+ } while(0)
+
+ SET_CSA_SETTING(CSA_BCN_COUNT, cs_count, u32);
+ SET_CSA_SETTING(CSA_CENTER_FREQ1, freq_params.center_freq1, u32);
+ SET_CSA_SETTING(CSA_CENTER_FREQ2, freq_params.center_freq2, u32);
+ SET_CSA_SETTING(CSA_BANDWIDTH, freq_params.bandwidth, u32);
+ SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32);
+ SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool);
+ SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool);
+ SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
+
if (hostapd_switch_channel(hapd, &css) != 0)
return UBUS_STATUS_NOT_SUPPORTED;
return UBUS_STATUS_OK;
+#undef SET_CSA_SETTING
}
#endif