mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 10:02:53 +00:00
ucentral: development update
* add uchannel fixes to hapd * update usteer * update ucentral-schema * update mac80211 * update mt76 * make sure webui is properly started in maverick mode Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
From 9823f41c1d99446cfd3285553fbba0cf61e86ac4 Mon Sep 17 00:00:00 2001
|
||||
From a29e75fbbb4517aa362d3f1074f13c1adf5f788e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 27 May 2021 13:25:19 +0200
|
||||
Subject: [PATCH 01/42] hostapd: upsate to latest HEAD
|
||||
Subject: [PATCH 03/44] hostapd: upsate to latest HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/network/services/hostapd/Makefile | 9 +-
|
||||
package/network/services/hostapd/Makefile | 15 +-
|
||||
.../hostapd/files/hostapd-basic.config | 2 +-
|
||||
.../hostapd/files/hostapd-full.config | 4 +-
|
||||
.../network/services/hostapd/files/hostapd.sh | 155 +++++++++--
|
||||
@@ -32,6 +32,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
...020-ignore-4addr-mode-enabling-error.patch | 78 ------
|
||||
...0-mesh-make-forwarding-configurable.patch} | 28 +-
|
||||
...ix-sta-add-after-previous-connection.patch | 26 ++
|
||||
...use-of-uninitialized-stack-variables.patch | 25 ++
|
||||
...-case-in-peer-addition-based-on-PD-R.patch | 45 ---
|
||||
.../patches/110-notify-mgmt-frames.patch | 116 --------
|
||||
.../patches/110-wolfssl-compile-fix.patch | 10 -
|
||||
@@ -57,7 +58,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
.../patches/464-fix-mesh-obss-check.patch | 2 +-
|
||||
.../patches/470-survey_data_fallback.patch | 2 +-
|
||||
.../patches/500-lto-jobserver-support.patch | 19 +-
|
||||
.../hostapd/patches/600-ubus_support.patch | 125 ++++++---
|
||||
.../hostapd/patches/600-ubus_support.patch | 166 ++++++++---
|
||||
.../hostapd/patches/700-wifi-reload.patch | 51 ++--
|
||||
.../hostapd/patches/710-vlan_no_bridge.patch | 41 +++
|
||||
.../720-ACS-fix-channel-100-frequency.patch | 30 ++
|
||||
@@ -65,9 +66,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
.../hostapd/patches/730-ft_iface.patch | 38 +++
|
||||
...ate-if-no-available-channel-is-found.patch | 37 ---
|
||||
...of-secondary-device-types-for-P2P-gr.patch | 33 ---
|
||||
.../services/hostapd/src/src/ap/ubus.c | 70 ++++-
|
||||
.../services/hostapd/src/src/ap/ubus.c | 217 ++++++++++++++-
|
||||
.../services/hostapd/src/src/ap/ubus.h | 16 ++
|
||||
62 files changed, 758 insertions(+), 2321 deletions(-)
|
||||
.../hostapd/src/src/utils/build_features.h | 2 -
|
||||
64 files changed, 970 insertions(+), 2330 deletions(-)
|
||||
delete mode 100644 package/network/services/hostapd/patches/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch
|
||||
create mode 100644 package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch
|
||||
delete mode 100644 package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch
|
||||
@@ -90,6 +92,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
delete mode 100644 package/network/services/hostapd/patches/020-ignore-4addr-mode-enabling-error.patch
|
||||
rename package/network/services/hostapd/patches/{050-mesh-make-forwarding-configurable.patch => 020-mesh-make-forwarding-configurable.patch} (89%)
|
||||
create mode 100644 package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch
|
||||
create mode 100644 package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch
|
||||
delete mode 100644 package/network/services/hostapd/patches/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch
|
||||
delete mode 100644 package/network/services/hostapd/patches/110-notify-mgmt-frames.patch
|
||||
delete mode 100644 package/network/services/hostapd/patches/110-wolfssl-compile-fix.patch
|
||||
@@ -102,28 +105,36 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
delete mode 100644 package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch
|
||||
|
||||
diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
|
||||
index bd2a7c96ad..e0e55ab99e 100644
|
||||
index bd2a7c96ad..fee6889b40 100644
|
||||
--- a/package/network/services/hostapd/Makefile
|
||||
+++ b/package/network/services/hostapd/Makefile
|
||||
@@ -7,13 +7,13 @@
|
||||
@@ -1,19 +1,17 @@
|
||||
-# Copyright (C) 2006-2014 OpenWrt.org
|
||||
-#
|
||||
-# This is free software, licensed under the GNU General Public License v2.
|
||||
-# See /LICENSE for more information.
|
||||
+# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
+# Copyright (C) 2006-2021 OpenWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostapd
|
||||
-PKG_RELEASE:=32
|
||||
+PKG_RELEASE:=34
|
||||
+PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_URL:=http://w1.fi/hostap.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
-PKG_SOURCE_DATE:=2020-06-08
|
||||
-PKG_SOURCE_VERSION:=5a8b366233f5585e68a4ffbb604fbb4a848eb325
|
||||
-PKG_MIRROR_HASH:=1b2a4947034142587a3f81eac2ea27dd64650e77f8943d973623b47533be2393
|
||||
+PKG_SOURCE_DATE:=2021-05-21
|
||||
+PKG_SOURCE_VERSION:=d98f4c46600d9449fa97186bd5263b76bedaf06e
|
||||
+PKG_MIRROR_HASH:=62ddbd570c0a86391c617b0cd7b337cdb49f6ae9dfbd227d58c0e1e9b43fef81
|
||||
+PKG_SOURCE_DATE:=2021-05-22
|
||||
+PKG_SOURCE_VERSION:=b102f19bcc53c7f7db3951424d4d46709b4f1986
|
||||
+PKG_MIRROR_HASH:=cb3cb968883042fc582752be1607586696c18e6ecf9808c9a8ac50e204584367
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -524,6 +524,7 @@ define Build/RunMake
|
||||
@@ -524,6 +522,7 @@ define Build/RunMake
|
||||
LIBS_c="$(TARGET_LDFLAGS_C)" \
|
||||
AR="$(TARGET_CROSS)gcc-ar" \
|
||||
BCHECK= \
|
||||
@@ -2637,6 +2648,37 @@ index 0000000000..124fd8bdf1
|
||||
+ hostapd_drv_sta_remove(hapd, sta->addr);
|
||||
+ wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED);
|
||||
+ set = 0;
|
||||
diff --git a/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch
|
||||
new file mode 100644
|
||||
index 0000000000..c7da33f029
|
||||
--- /dev/null
|
||||
+++ b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch
|
||||
@@ -0,0 +1,25 @@
|
||||
+From: Felix Fietkau <nbd@nbd.name>
|
||||
+Date: Thu, 8 Jul 2021 16:33:03 +0200
|
||||
+Subject: [PATCH] hostapd: fix use of uninitialized stack variables
|
||||
+
|
||||
+When a CSA is performed on an 80 MHz channel, hostapd_change_config_freq
|
||||
+unconditionally calls hostapd_set_oper_centr_freq_seg0/1_idx with seg0/1
|
||||
+filled by ieee80211_freq_to_chan.
|
||||
+However, if ieee80211_freq_to_chan fails (because the freq is 0 or invalid),
|
||||
+seg0/1 remains uninitialized and filled with stack garbage, causing errors
|
||||
+such as "hostapd: 80 MHz: center segment 1 configured"
|
||||
+
|
||||
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+---
|
||||
+
|
||||
+--- a/src/ap/hostapd.c
|
||||
++++ b/src/ap/hostapd.c
|
||||
+@@ -3431,7 +3431,7 @@ static int hostapd_change_config_freq(st
|
||||
+ struct hostapd_freq_params *old_params)
|
||||
+ {
|
||||
+ int channel;
|
||||
+- u8 seg0, seg1;
|
||||
++ u8 seg0 = 0, seg1 = 0;
|
||||
+ struct hostapd_hw_modes *mode;
|
||||
+
|
||||
+ if (!params->channel) {
|
||||
diff --git a/package/network/services/hostapd/patches/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch b/package/network/services/hostapd/patches/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch
|
||||
deleted file mode 100644
|
||||
index 1202ff3725..0000000000
|
||||
@@ -4191,7 +4233,7 @@ index 46030859de..1475590d06 100644
|
||||
- $(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c)
|
||||
+ +$(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c)
|
||||
diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
|
||||
index 938840755a..71537c9ec6 100644
|
||||
index 938840755a..005ed54e0c 100644
|
||||
--- a/package/network/services/hostapd/patches/600-ubus_support.patch
|
||||
+++ b/package/network/services/hostapd/patches/600-ubus_support.patch
|
||||
@@ -1,6 +1,6 @@
|
||||
@@ -4494,7 +4536,7 @@ index 938840755a..71537c9ec6 100644
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
@@ -424,3 +424,52 @@
|
||||
@@ -424,3 +424,93 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -4547,6 +4589,47 @@ index 938840755a..71537c9ec6 100644
|
||||
+ /* Proceed only if DFS is not offloaded to the driver */
|
||||
+ if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
|
||||
+ return 0;
|
||||
+--- a/src/ap/airtime_policy.c
|
||||
++++ b/src/ap/airtime_policy.c
|
||||
+@@ -112,8 +112,14 @@ static void set_sta_weights(struct hosta
|
||||
+ {
|
||||
+ struct sta_info *sta;
|
||||
+
|
||||
+- for (sta = hapd->sta_list; sta; sta = sta->next)
|
||||
+- sta_set_airtime_weight(hapd, sta, weight);
|
||||
++ for (sta = hapd->sta_list; sta; sta = sta->next) {
|
||||
++ unsigned int sta_weight = weight;
|
||||
++
|
||||
++ if (sta->dyn_airtime_weight)
|
||||
++ sta_weight = (weight * sta->dyn_airtime_weight) / 256;
|
||||
++
|
||||
++ sta_set_airtime_weight(hapd, sta, sta_weight);
|
||||
++ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+@@ -244,7 +250,10 @@ int airtime_policy_new_sta(struct hostap
|
||||
+ unsigned int weight;
|
||||
+
|
||||
+ if (hapd->iconf->airtime_mode == AIRTIME_MODE_STATIC) {
|
||||
+- weight = get_weight_for_sta(hapd, sta->addr);
|
||||
++ if (sta->dyn_airtime_weight)
|
||||
++ weight = sta->dyn_airtime_weight;
|
||||
++ else
|
||||
++ weight = get_weight_for_sta(hapd, sta->addr);
|
||||
+ if (weight)
|
||||
+ return sta_set_airtime_weight(hapd, sta, weight);
|
||||
+ }
|
||||
+--- a/src/ap/sta_info.h
|
||||
++++ b/src/ap/sta_info.h
|
||||
+@@ -324,6 +324,7 @@ struct sta_info {
|
||||
+ #endif /* CONFIG_TESTING_OPTIONS */
|
||||
+ #ifdef CONFIG_AIRTIME_POLICY
|
||||
+ unsigned int airtime_weight;
|
||||
++ unsigned int dyn_airtime_weight;
|
||||
+ struct os_reltime backlogged_until;
|
||||
+ #endif /* CONFIG_AIRTIME_POLICY */
|
||||
+
|
||||
diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch
|
||||
index d5520d0b77..5993b0d445 100644
|
||||
--- a/package/network/services/hostapd/patches/700-wifi-reload.patch
|
||||
@@ -4996,20 +5079,161 @@ index 944f7d71c9..0000000000
|
||||
- dev->info.wps_sec_dev_type_list_len);
|
||||
- }
|
||||
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
|
||||
index d03b848f94..7cc2059fc1 100644
|
||||
index d03b848f94..07c366508c 100644
|
||||
--- a/package/network/services/hostapd/src/src/ap/ubus.c
|
||||
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
|
||||
@@ -728,6 +728,8 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "rrm.h"
|
||||
#include "wnm_ap.h"
|
||||
#include "taxonomy.h"
|
||||
+#include "airtime_policy.h"
|
||||
|
||||
static struct ubus_context *ctx;
|
||||
static struct blob_buf b;
|
||||
@@ -297,6 +298,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
{ "wmm", WLAN_STA_WMM },
|
||||
{ "ht", WLAN_STA_HT },
|
||||
{ "vht", WLAN_STA_VHT },
|
||||
+ { "he", WLAN_STA_HE },
|
||||
{ "wps", WLAN_STA_WPS },
|
||||
{ "mfp", WLAN_STA_MFP },
|
||||
};
|
||||
@@ -372,6 +374,32 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* Imported from iw/util.c
|
||||
+ * https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/tree/util.c?id=4b25ae3537af48dbf9d0abf94132e5ba01b32c18#n200
|
||||
+ */
|
||||
+int ieee80211_frequency_to_channel(int freq)
|
||||
+{
|
||||
+ /* see 802.11-2007 17.3.8.3.2 and Annex J */
|
||||
+ if (freq == 2484)
|
||||
+ return 14;
|
||||
+ /* see 802.11ax D6.1 27.3.23.2 and Annex E */
|
||||
+ else if (freq == 5935)
|
||||
+ return 2;
|
||||
+ else if (freq < 2484)
|
||||
+ return (freq - 2407) / 5;
|
||||
+ else if (freq >= 4910 && freq <= 4980)
|
||||
+ return (freq - 4000) / 5;
|
||||
+ else if (freq < 5950)
|
||||
+ return (freq - 5000) / 5;
|
||||
+ else if (freq <= 45000) /* DMG band lower limit */
|
||||
+ /* see 802.11ax D6.1 27.3.23.2 */
|
||||
+ return (freq - 5950) / 5;
|
||||
+ else if (freq >= 58320 && freq <= 70200)
|
||||
+ return (freq - 56160) / 2160;
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
@@ -380,12 +408,23 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
||||
void *airtime_table, *dfs_table;
|
||||
struct os_reltime now;
|
||||
+ char ssid[SSID_MAX_LEN + 1];
|
||||
char phy_name[17];
|
||||
- char mac_buf[20];
|
||||
+ size_t ssid_len = SSID_MAX_LEN;
|
||||
+
|
||||
+ if (hapd->conf->ssid.ssid_len < SSID_MAX_LEN)
|
||||
+ ssid_len = hapd->conf->ssid.ssid_len;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state));
|
||||
+ blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->conf->bssid));
|
||||
+
|
||||
+ memset(ssid, 0, SSID_MAX_LEN + 1);
|
||||
+ memcpy(ssid, hapd->conf->ssid.ssid, ssid_len);
|
||||
+ blobmsg_add_string(&b, "ssid", ssid);
|
||||
+
|
||||
blobmsg_add_u32(&b, "freq", hapd->iface->freq);
|
||||
+ blobmsg_add_u32(&b, "channel", ieee80211_frequency_to_channel(hapd->iface->freq));
|
||||
|
||||
snprintf(phy_name, 17, "%s", hapd->iface->phy);
|
||||
blobmsg_add_string(&b, "phy", phy_name);
|
||||
@@ -703,7 +742,9 @@ enum {
|
||||
CSA_SEC_CHANNEL_OFFSET,
|
||||
CSA_HT,
|
||||
CSA_VHT,
|
||||
+ CSA_HE,
|
||||
CSA_BLOCK_TX,
|
||||
+ CSA_FORCE,
|
||||
__CSA_MAX
|
||||
};
|
||||
|
||||
@@ -716,9 +757,20 @@ static const struct blobmsg_policy csa_policy[__CSA_MAX] = {
|
||||
[CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 },
|
||||
[CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL },
|
||||
[CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL },
|
||||
+ [CSA_HE] = { "he", BLOBMSG_TYPE_BOOL },
|
||||
[CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL },
|
||||
+ [CSA_FORCE] = { "force", BLOBMSG_TYPE_BOOL },
|
||||
};
|
||||
|
||||
+
|
||||
+static void switch_chan_fallback_cb(void *eloop_data, void *user_ctx)
|
||||
+{
|
||||
+ struct hostapd_iface *iface = eloop_data;
|
||||
+ struct hostapd_freq_params *freq_params = user_ctx;
|
||||
+
|
||||
+ hostapd_switch_channel_fallback(iface, freq_params);
|
||||
+}
|
||||
+
|
||||
#ifdef NEED_AP_MLME
|
||||
static int
|
||||
hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
@@ -727,14 +779,39 @@ 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 csa_settings css;
|
||||
+ struct hostapd_config *iconf = hapd->iface->conf;
|
||||
+ struct hostapd_freq_params *freq_params;
|
||||
+ 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;
|
||||
|
||||
blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
@@ -752,10 +754,14 @@ 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) \
|
||||
@@ -750,12 +827,25 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
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_HE, freq_params.he_enabled, bool);
|
||||
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
|
||||
|
||||
+ for (i = 0; i < hapd->iface->num_bss; i++) {
|
||||
@@ -5022,11 +5246,88 @@ index d03b848f94..7cc2059fc1 100644
|
||||
+ ret = UBUS_STATUS_NOT_SUPPORTED;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+ if (!ret || !tb[CSA_FORCE] || !blobmsg_get_bool(tb[CSA_FORCE]))
|
||||
+ return ret;
|
||||
+
|
||||
+ freq_params = malloc(sizeof(*freq_params));
|
||||
+ memcpy(freq_params, &css.freq_params, sizeof(*freq_params));
|
||||
+ eloop_register_timeout(0, 1, switch_chan_fallback_cb,
|
||||
+ hapd->iface, freq_params);
|
||||
+
|
||||
+ return 0;
|
||||
#undef SET_CSA_SETTING
|
||||
}
|
||||
#endif
|
||||
@@ -1364,6 +1370,43 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd)
|
||||
@@ -1282,11 +1372,68 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_AIRTIME_POLICY
|
||||
+enum {
|
||||
+ UPDATE_AIRTIME_STA,
|
||||
+ UPDATE_AIRTIME_WEIGHT,
|
||||
+ __UPDATE_AIRTIME_MAX,
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static const struct blobmsg_policy airtime_policy[__UPDATE_AIRTIME_MAX] = {
|
||||
+ [UPDATE_AIRTIME_STA] = { "sta", BLOBMSG_TYPE_STRING },
|
||||
+ [UPDATE_AIRTIME_WEIGHT] = { "weight", BLOBMSG_TYPE_INT32 },
|
||||
+};
|
||||
+
|
||||
+static int
|
||||
+hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
+ struct ubus_request_data *ureq, const char *method,
|
||||
+ struct blob_attr *msg)
|
||||
+{
|
||||
+ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
||||
+ struct blob_attr *tb[__UPDATE_AIRTIME_MAX];
|
||||
+ struct sta_info *sta = NULL;
|
||||
+ u8 addr[ETH_ALEN];
|
||||
+ int weight;
|
||||
+
|
||||
+ blobmsg_parse(airtime_policy, __UPDATE_AIRTIME_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
+
|
||||
+ if (!tb[UPDATE_AIRTIME_WEIGHT])
|
||||
+ return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
+
|
||||
+ weight = blobmsg_get_u32(tb[UPDATE_AIRTIME_WEIGHT]);
|
||||
+
|
||||
+ if (!tb[UPDATE_AIRTIME_STA]) {
|
||||
+ if (!weight)
|
||||
+ return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
+
|
||||
+ hapd->conf->airtime_weight = weight;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (hwaddr_aton(blobmsg_data(tb[UPDATE_AIRTIME_STA]), addr))
|
||||
+ return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
+
|
||||
+ sta = ap_get_sta(hapd, addr);
|
||||
+ if (!sta)
|
||||
+ return UBUS_STATUS_NOT_FOUND;
|
||||
+
|
||||
+ sta->dyn_airtime_weight = weight;
|
||||
+ airtime_policy_new_sta(hapd, sta);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
static const struct ubus_method bss_methods[] = {
|
||||
UBUS_METHOD_NOARG("reload", hostapd_bss_reload),
|
||||
UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients),
|
||||
UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status),
|
||||
UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy),
|
||||
+#ifdef CONFIG_AIRTIME_POLICY
|
||||
+ UBUS_METHOD("update_airtime", hostapd_bss_update_airtime, airtime_policy),
|
||||
+#endif
|
||||
UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans),
|
||||
#ifdef CONFIG_WPS
|
||||
UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start),
|
||||
@@ -1364,6 +1511,43 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd)
|
||||
free(name);
|
||||
}
|
||||
|
||||
@@ -5070,7 +5371,7 @@ index d03b848f94..7cc2059fc1 100644
|
||||
static const struct ubus_method daemon_methods[] = {
|
||||
UBUS_METHOD("config_add", hostapd_config_add, config_add_policy),
|
||||
UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy),
|
||||
@@ -1550,3 +1593,24 @@ void hostapd_ubus_notify_beacon_report(
|
||||
@@ -1550,3 +1734,24 @@ void hostapd_ubus_notify_beacon_report(
|
||||
|
||||
ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1);
|
||||
}
|
||||
@@ -5143,6 +5444,19 @@ index e16017394f..acdac74360 100644
|
||||
|
||||
static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces)
|
||||
{
|
||||
diff --git a/package/network/services/hostapd/src/src/utils/build_features.h b/package/network/services/hostapd/src/src/utils/build_features.h
|
||||
index c7fccad413..3ab5246c78 100644
|
||||
--- a/package/network/services/hostapd/src/src/utils/build_features.h
|
||||
+++ b/package/network/services/hostapd/src/src/utils/build_features.h
|
||||
@@ -23,8 +23,6 @@ static inline int has_feature(const char *feat)
|
||||
if (!strcmp(feat, "11r"))
|
||||
return 1;
|
||||
#endif
|
||||
- if (!strcmp(feat, "11w"))
|
||||
- return 1;
|
||||
#ifdef CONFIG_ACS
|
||||
if (!strcmp(feat, "acs"))
|
||||
return 1;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 5ce6dfad7cb15bc24b5b129962bfb1659ad5582a Mon Sep 17 00:00:00 2001
|
||||
From e01de214b2492e1b8001d6057211017b5f0f6f49 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 27 May 2021 13:25:41 +0200
|
||||
Subject: [PATCH 06/38] mt76: update to latest HEAD
|
||||
Subject: [PATCH 04/44] mt76: update to latest HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
|
||||
index e9e95fa9b3..74d5950545 100644
|
||||
index e9e95fa9b3..431c57a240 100644
|
||||
--- a/package/kernel/mt76/Makefile
|
||||
+++ b/package/kernel/mt76/Makefile
|
||||
@@ -8,11 +8,12 @@ PKG_LICENSE_FILES:=
|
||||
@@ -19,9 +19,9 @@ index e9e95fa9b3..74d5950545 100644
|
||||
-PKG_SOURCE_DATE:=2021-04-11
|
||||
-PKG_SOURCE_VERSION:=bf45b30d891961dd7c4139dddb58b909ea2c2b5a
|
||||
-PKG_MIRROR_HASH:=431cecf80dafa986e805f809522721c2bb26289867d6770695d49baf8b471bea
|
||||
+PKG_SOURCE_DATE:=2021-06-06
|
||||
+PKG_SOURCE_VERSION:=22b690334c0f49b11534cc2e331c9d5e17c4a0bc
|
||||
+PKG_MIRROR_HASH:=ff5e563935919d2e40c1e7254ef3bc06f7ecc5e69f8ddd12903e8f5de942d630
|
||||
+PKG_SOURCE_DATE:=2021-07-15
|
||||
+PKG_SOURCE_VERSION:=bbebea7d6dc64313132226adc3f7369d36e9359d
|
||||
+PKG_MIRROR_HASH:=17cd74e72c1f6c8742b698bf6772afacc6fba71b233af8c4d59530600cf44d5b
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
+PKG_USE_NINJA:=0
|
||||
|
||||
@@ -30,6 +30,7 @@ config_foreach ssid_set wifi-iface
|
||||
uci commit
|
||||
|
||||
/etc/init.d/uhttpd enable
|
||||
/etc/init.d/uhttpd start
|
||||
/etc/init.d/ucentral stop
|
||||
|
||||
reload_config
|
||||
|
||||
@@ -6,7 +6,7 @@ PKG_RELEASE:=1
|
||||
PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2021-02-15
|
||||
PKG_SOURCE_VERSION:=f9eae1b43f470814e11c1264821eeec7e512bf5b
|
||||
PKG_SOURCE_VERSION:=4e603b16b38c099d3c4827996ecb1c4f4262ced8
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
@@ -6,7 +6,7 @@ PKG_RELEASE:=1
|
||||
PKG_SOURCE_URL=https://git.openwrt.org/project/usteer.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2021-04-19
|
||||
PKG_SOURCE_VERSION:=07a2f767e5a72ac9677ca91195d8a7d2d3c687b7
|
||||
PKG_SOURCE_VERSION:=ab4d89e7429df19fb7af862213bc5f09ca964948
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
|
||||
@@ -9,12 +9,9 @@ let block_list = {
|
||||
"5G": {}
|
||||
};
|
||||
let channel_masks = {
|
||||
/* DFS "40": [ 5180, 5220, 5260, 5300, 5500, 5540, 5580, 5620, 5660, 5700, 5745, 5785, 5825 ],
|
||||
"40": [ 5180, 5220, 5260, 5300, 5500, 5540, 5580, 5620, 5660, 5700, 5745, 5785, 5825 ],
|
||||
"80": [ 5180, 5260, 5500, 5580, 5660, 5745 ],
|
||||
"160": [ 5180, 5500, ],
|
||||
*/
|
||||
"40": [ 5180, 5220, 5745, 5785, 5825 ],
|
||||
"80": [ 5180, 5745 ],
|
||||
};
|
||||
|
||||
function uptime_get() {
|
||||
@@ -324,6 +321,7 @@ for (let freq, obj in overlap) {
|
||||
freq: +new.freq,
|
||||
center_freq1: center_freq(new.freq, phy.bandwidth),
|
||||
bcn_count: 10,
|
||||
force: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Thu, 8 Jul 2021 16:33:03 +0200
|
||||
Subject: [PATCH] hostapd: fix use of uninitialized stack variables
|
||||
|
||||
When a CSA is performed on an 80 MHz channel, hostapd_change_config_freq
|
||||
unconditionally calls hostapd_set_oper_centr_freq_seg0/1_idx with seg0/1
|
||||
filled by ieee80211_freq_to_chan.
|
||||
However, if ieee80211_freq_to_chan fails (because the freq is 0 or invalid),
|
||||
seg0/1 remains uninitialized and filled with stack garbage, causing errors
|
||||
such as "hostapd: 80 MHz: center segment 1 configured"
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -3431,7 +3431,7 @@ static int hostapd_change_config_freq(st
|
||||
struct hostapd_freq_params *old_params)
|
||||
{
|
||||
int channel;
|
||||
- u8 seg0, seg1;
|
||||
+ u8 seg0 = 0, seg1 = 0;
|
||||
struct hostapd_hw_modes *mode;
|
||||
|
||||
if (!params->channel) {
|
||||
@@ -473,3 +473,44 @@
|
||||
/* Proceed only if DFS is not offloaded to the driver */
|
||||
if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
|
||||
return 0;
|
||||
--- a/src/ap/airtime_policy.c
|
||||
+++ b/src/ap/airtime_policy.c
|
||||
@@ -112,8 +112,14 @@ static void set_sta_weights(struct hosta
|
||||
{
|
||||
struct sta_info *sta;
|
||||
|
||||
- for (sta = hapd->sta_list; sta; sta = sta->next)
|
||||
- sta_set_airtime_weight(hapd, sta, weight);
|
||||
+ for (sta = hapd->sta_list; sta; sta = sta->next) {
|
||||
+ unsigned int sta_weight = weight;
|
||||
+
|
||||
+ if (sta->dyn_airtime_weight)
|
||||
+ sta_weight = (weight * sta->dyn_airtime_weight) / 256;
|
||||
+
|
||||
+ sta_set_airtime_weight(hapd, sta, sta_weight);
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +250,10 @@ int airtime_policy_new_sta(struct hostap
|
||||
unsigned int weight;
|
||||
|
||||
if (hapd->iconf->airtime_mode == AIRTIME_MODE_STATIC) {
|
||||
- weight = get_weight_for_sta(hapd, sta->addr);
|
||||
+ if (sta->dyn_airtime_weight)
|
||||
+ weight = sta->dyn_airtime_weight;
|
||||
+ else
|
||||
+ weight = get_weight_for_sta(hapd, sta->addr);
|
||||
if (weight)
|
||||
return sta_set_airtime_weight(hapd, sta, weight);
|
||||
}
|
||||
--- a/src/ap/sta_info.h
|
||||
+++ b/src/ap/sta_info.h
|
||||
@@ -324,6 +324,7 @@ struct sta_info {
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
#ifdef CONFIG_AIRTIME_POLICY
|
||||
unsigned int airtime_weight;
|
||||
+ unsigned int dyn_airtime_weight;
|
||||
struct os_reltime backlogged_until;
|
||||
#endif /* CONFIG_AIRTIME_POLICY */
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "rrm.h"
|
||||
#include "wnm_ap.h"
|
||||
#include "taxonomy.h"
|
||||
#include "airtime_policy.h"
|
||||
|
||||
static struct ubus_context *ctx;
|
||||
static struct blob_buf b;
|
||||
@@ -297,6 +298,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
{ "wmm", WLAN_STA_WMM },
|
||||
{ "ht", WLAN_STA_HT },
|
||||
{ "vht", WLAN_STA_VHT },
|
||||
{ "he", WLAN_STA_HE },
|
||||
{ "wps", WLAN_STA_WPS },
|
||||
{ "mfp", WLAN_STA_MFP },
|
||||
};
|
||||
@@ -372,6 +374,32 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Imported from iw/util.c
|
||||
* https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/tree/util.c?id=4b25ae3537af48dbf9d0abf94132e5ba01b32c18#n200
|
||||
*/
|
||||
int ieee80211_frequency_to_channel(int freq)
|
||||
{
|
||||
/* see 802.11-2007 17.3.8.3.2 and Annex J */
|
||||
if (freq == 2484)
|
||||
return 14;
|
||||
/* see 802.11ax D6.1 27.3.23.2 and Annex E */
|
||||
else if (freq == 5935)
|
||||
return 2;
|
||||
else if (freq < 2484)
|
||||
return (freq - 2407) / 5;
|
||||
else if (freq >= 4910 && freq <= 4980)
|
||||
return (freq - 4000) / 5;
|
||||
else if (freq < 5950)
|
||||
return (freq - 5000) / 5;
|
||||
else if (freq <= 45000) /* DMG band lower limit */
|
||||
/* see 802.11ax D6.1 27.3.23.2 */
|
||||
return (freq - 5950) / 5;
|
||||
else if (freq >= 58320 && freq <= 70200)
|
||||
return (freq - 56160) / 2160;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
@@ -380,12 +408,23 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
||||
void *airtime_table, *dfs_table;
|
||||
struct os_reltime now;
|
||||
char ssid[SSID_MAX_LEN + 1];
|
||||
char phy_name[17];
|
||||
char mac_buf[20];
|
||||
size_t ssid_len = SSID_MAX_LEN;
|
||||
|
||||
if (hapd->conf->ssid.ssid_len < SSID_MAX_LEN)
|
||||
ssid_len = hapd->conf->ssid.ssid_len;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state));
|
||||
blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->conf->bssid));
|
||||
|
||||
memset(ssid, 0, SSID_MAX_LEN + 1);
|
||||
memcpy(ssid, hapd->conf->ssid.ssid, ssid_len);
|
||||
blobmsg_add_string(&b, "ssid", ssid);
|
||||
|
||||
blobmsg_add_u32(&b, "freq", hapd->iface->freq);
|
||||
blobmsg_add_u32(&b, "channel", ieee80211_frequency_to_channel(hapd->iface->freq));
|
||||
|
||||
snprintf(phy_name, 17, "%s", hapd->iface->phy);
|
||||
blobmsg_add_string(&b, "phy", phy_name);
|
||||
@@ -703,7 +742,9 @@ enum {
|
||||
CSA_SEC_CHANNEL_OFFSET,
|
||||
CSA_HT,
|
||||
CSA_VHT,
|
||||
CSA_HE,
|
||||
CSA_BLOCK_TX,
|
||||
CSA_FORCE,
|
||||
__CSA_MAX
|
||||
};
|
||||
|
||||
@@ -716,9 +757,20 @@ static const struct blobmsg_policy csa_policy[__CSA_MAX] = {
|
||||
[CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 },
|
||||
[CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL },
|
||||
[CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL },
|
||||
[CSA_HE] = { "he", BLOBMSG_TYPE_BOOL },
|
||||
[CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL },
|
||||
[CSA_FORCE] = { "force", BLOBMSG_TYPE_BOOL },
|
||||
};
|
||||
|
||||
|
||||
static void switch_chan_fallback_cb(void *eloop_data, void *user_ctx)
|
||||
{
|
||||
struct hostapd_iface *iface = eloop_data;
|
||||
struct hostapd_freq_params *freq_params = user_ctx;
|
||||
|
||||
hostapd_switch_channel_fallback(iface, freq_params);
|
||||
}
|
||||
|
||||
#ifdef NEED_AP_MLME
|
||||
static int
|
||||
hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
@@ -727,7 +779,16 @@ 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 hostapd_freq_params *freq_params;
|
||||
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;
|
||||
|
||||
@@ -736,7 +797,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) \
|
||||
@@ -752,6 +827,7 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
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_HE, freq_params.he_enabled, bool);
|
||||
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
|
||||
|
||||
for (i = 0; i < hapd->iface->num_bss; i++) {
|
||||
@@ -761,7 +837,15 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
ret = UBUS_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
if (!ret || !tb[CSA_FORCE] || !blobmsg_get_bool(tb[CSA_FORCE]))
|
||||
return ret;
|
||||
|
||||
freq_params = malloc(sizeof(*freq_params));
|
||||
memcpy(freq_params, &css.freq_params, sizeof(*freq_params));
|
||||
eloop_register_timeout(0, 1, switch_chan_fallback_cb,
|
||||
hapd->iface, freq_params);
|
||||
|
||||
return 0;
|
||||
#undef SET_CSA_SETTING
|
||||
}
|
||||
#endif
|
||||
@@ -1288,11 +1372,68 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AIRTIME_POLICY
|
||||
enum {
|
||||
UPDATE_AIRTIME_STA,
|
||||
UPDATE_AIRTIME_WEIGHT,
|
||||
__UPDATE_AIRTIME_MAX,
|
||||
};
|
||||
|
||||
|
||||
static const struct blobmsg_policy airtime_policy[__UPDATE_AIRTIME_MAX] = {
|
||||
[UPDATE_AIRTIME_STA] = { "sta", BLOBMSG_TYPE_STRING },
|
||||
[UPDATE_AIRTIME_WEIGHT] = { "weight", BLOBMSG_TYPE_INT32 },
|
||||
};
|
||||
|
||||
static int
|
||||
hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *ureq, const char *method,
|
||||
struct blob_attr *msg)
|
||||
{
|
||||
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
||||
struct blob_attr *tb[__UPDATE_AIRTIME_MAX];
|
||||
struct sta_info *sta = NULL;
|
||||
u8 addr[ETH_ALEN];
|
||||
int weight;
|
||||
|
||||
blobmsg_parse(airtime_policy, __UPDATE_AIRTIME_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
if (!tb[UPDATE_AIRTIME_WEIGHT])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
weight = blobmsg_get_u32(tb[UPDATE_AIRTIME_WEIGHT]);
|
||||
|
||||
if (!tb[UPDATE_AIRTIME_STA]) {
|
||||
if (!weight)
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
hapd->conf->airtime_weight = weight;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hwaddr_aton(blobmsg_data(tb[UPDATE_AIRTIME_STA]), addr))
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
sta = ap_get_sta(hapd, addr);
|
||||
if (!sta)
|
||||
return UBUS_STATUS_NOT_FOUND;
|
||||
|
||||
sta->dyn_airtime_weight = weight;
|
||||
airtime_policy_new_sta(hapd, sta);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static const struct ubus_method bss_methods[] = {
|
||||
UBUS_METHOD_NOARG("reload", hostapd_bss_reload),
|
||||
UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients),
|
||||
UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status),
|
||||
UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy),
|
||||
#ifdef CONFIG_AIRTIME_POLICY
|
||||
UBUS_METHOD("update_airtime", hostapd_bss_update_airtime, airtime_policy),
|
||||
#endif
|
||||
UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans),
|
||||
#ifdef CONFIG_WPS
|
||||
UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start),
|
||||
|
||||
Reference in New Issue
Block a user