ucentral: development update

* backport latest netifd, mac8021, hostapd, iw
* maverick and certificate fixes
* update ucentral-wifi
* update ucentral-client
* add qcom hk14 wifi 6e support (pine)
* add tplink ex228

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-05-27 13:20:13 +02:00
parent e0063c69c7
commit 30a078b90a
52 changed files with 10606 additions and 4851 deletions

View File

@@ -0,0 +1,167 @@
From 0ddce2498be815e098154867d0b18293fe613f12 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 27 May 2021 11:57:10 +0200
Subject: [PATCH 13/13] iw: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/utils/iw/Makefile | 11 +++----
.../utils/iw/patches/200-reduce_size.patch | 30 +++++++++----------
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
index 6db9aaf105..8e11046189 100644
--- a/package/network/utils/iw/Makefile
+++ b/package/network/utils/iw/Makefile
@@ -8,12 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=iw
-PKG_VERSION:=5.9
-PKG_RELEASE:=1
+PKG_VERSION:=5.9-8fab0c9e
+PKG_RELEASE:=$(AUTORELEASE)
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@KERNEL/software/network/iw
-PKG_HASH:=293a07109aeb7e36267cf59e3ce52857e9ffae3a6666eb8ac77894b1839fe1f2
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git
+PKG_SOURCE_VERSION:=8fab0c9ee9db217587a58efcc37421c86edcb638
+PKG_MIRROR_HASH:=797b322bc03952f3127ae0a7da476c14ada1bbe9a9ae234a56dd6f864c568e16
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0
diff --git a/package/network/utils/iw/patches/200-reduce_size.patch b/package/network/utils/iw/patches/200-reduce_size.patch
index af30876012..83e11405cb 100644
--- a/package/network/utils/iw/patches/200-reduce_size.patch
+++ b/package/network/utils/iw/patches/200-reduce_size.patch
@@ -1,6 +1,6 @@
--- a/event.c
+++ b/event.c
-@@ -944,6 +944,7 @@ static int print_event(struct nl_msg *ms
+@@ -956,6 +956,7 @@ static int print_event(struct nl_msg *ms
}
switch (gnlh->cmd) {
@@ -8,7 +8,7 @@
case NL80211_CMD_NEW_WIPHY:
printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
break;
-@@ -979,6 +980,7 @@ static int print_event(struct nl_msg *ms
+@@ -991,6 +992,7 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_SCHED_SCAN_RESULTS:
printf("got scheduled scan results\n");
break;
@@ -16,7 +16,7 @@
case NL80211_CMD_WIPHY_REG_CHANGE:
case NL80211_CMD_REG_CHANGE:
if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE)
-@@ -1061,6 +1063,7 @@ static int print_event(struct nl_msg *ms
+@@ -1073,6 +1075,7 @@ static int print_event(struct nl_msg *ms
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("del station %s\n", macbuf);
break;
@@ -24,7 +24,7 @@
case NL80211_CMD_JOIN_IBSS:
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("IBSS %s joined\n", macbuf);
-@@ -1254,9 +1257,9 @@ static int print_event(struct nl_msg *ms
+@@ -1271,9 +1274,9 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_CH_SWITCH_NOTIFY:
parse_ch_switch_notify(tb, gnlh->cmd);
break;
@@ -134,7 +134,7 @@
{
--- a/scan.c
+++ b/scan.c
-@@ -1297,6 +1297,9 @@ static void print_ht_op(const uint8_t ty
+@@ -1306,6 +1306,9 @@ static void print_ht_op(const uint8_t ty
printf("\t\t * secondary channel offset: %s\n",
ht_secondary_offset[data[1] & 0x3]);
printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
@@ -144,7 +144,7 @@
printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
-@@ -1707,6 +1710,14 @@ static void print_ie(const struct ie_pri
+@@ -1716,6 +1719,14 @@ static void print_ie(const struct ie_pri
static const struct ie_print ieprinters[] = {
[0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
@@ -159,7 +159,7 @@
[1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
[3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
[5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
-@@ -1716,26 +1727,20 @@ static const struct ie_print ieprinters[
+@@ -1725,26 +1736,20 @@ static const struct ie_print ieprinters[
[32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
[35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
[42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
@@ -187,15 +187,15 @@
};
static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
-@@ -2279,6 +2284,7 @@ void print_ies(unsigned char *ie, int ie
+@@ -2326,6 +2331,7 @@ void print_ies(unsigned char *ie, int ie
ieprinters[ie[0]].flags & BIT(ptype)) {
print_ie(&ieprinters[ie[0]],
ie[0], ie[1], ie + 2, &ie_buffer);
+#ifdef IW_FULL
} else if (ie[0] == 221 /* vendor */) {
print_vendor(ie[1], ie + 2, unknown, ptype);
- } else if (unknown) {
-@@ -2288,6 +2294,7 @@ void print_ies(unsigned char *ie, int ie
+ } else if (ie[0] == 255 /* extension */) {
+@@ -2337,6 +2343,7 @@ void print_ies(unsigned char *ie, int ie
for (i=0; i<ie[1]; i++)
printf(" %.2x", ie[2+i]);
printf("\n");
@@ -203,7 +203,7 @@
}
ielen -= ie[1] + 2;
ie += ie[1] + 2;
-@@ -2328,6 +2335,7 @@ static void print_capa_non_dmg(__u16 cap
+@@ -2377,6 +2384,7 @@ static void print_capa_non_dmg(__u16 cap
printf(" ESS");
if (capa & WLAN_CAPABILITY_IBSS)
printf(" IBSS");
@@ -211,7 +211,7 @@
if (capa & WLAN_CAPABILITY_CF_POLLABLE)
printf(" CfPollable");
if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
-@@ -2356,6 +2364,7 @@ static void print_capa_non_dmg(__u16 cap
+@@ -2405,6 +2413,7 @@ static void print_capa_non_dmg(__u16 cap
printf(" DelayedBACK");
if (capa & WLAN_CAPABILITY_IMM_BACK)
printf(" ImmediateBACK");
@@ -219,7 +219,7 @@
}
static int print_bss_handler(struct nl_msg *msg, void *arg)
-@@ -2440,8 +2449,10 @@ static int print_bss_handler(struct nl_m
+@@ -2489,8 +2498,10 @@ static int print_bss_handler(struct nl_m
if (bss[NL80211_BSS_FREQUENCY]) {
int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
printf("\tfreq: %d\n", freq);
@@ -230,7 +230,7 @@
}
if (bss[NL80211_BSS_BEACON_INTERVAL])
printf("\tbeacon interval: %d TUs\n",
-@@ -2635,6 +2646,7 @@ static int handle_stop_sched_scan(struct
+@@ -2684,6 +2695,7 @@ static int handle_stop_sched_scan(struct
return 0;
}
@@ -238,7 +238,7 @@
COMMAND(scan, sched_start,
SCHED_SCAN_OPTIONS,
NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
-@@ -2645,3 +2657,4 @@ COMMAND(scan, sched_start,
+@@ -2694,3 +2706,4 @@ COMMAND(scan, sched_start,
COMMAND(scan, sched_stop, "",
NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan,
"Stop an ongoing scheduled scan.");
--
2.25.1

View File

@@ -0,0 +1,32 @@
From 5171503cfa4387370fd4c33bbcf0d8c4b6ec86e4 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 18 May 2021 10:46:43 +0200
Subject: [PATCH] libubox: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
package/libs/libubox/Makefile | 4 +-
package/network/config/netifd/Makefile | 4 +-
.../config/netifd/patches/100-8021x.patch | 421 ++++++++++++++++++
3 files changed, 425 insertions(+), 4 deletions(-)
create mode 100644 package/network/config/netifd/patches/100-8021x.patch
diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile
index 4d582eacfd..8644764d59 100644
--- a/package/libs/libubox/Makefile
+++ b/package/libs/libubox/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
-PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255
+#PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255
PKG_SOURCE_DATE:=2020-12-12
-PKG_SOURCE_VERSION:=357877693ca363b12e6e7e14d345639b2440cd07
+PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
CMAKE_INSTALL:=1
--
2.25.1

View File

@@ -0,0 +1,73 @@
From a830b2677c7076d93ab35a90ec12d382b64551d0 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 27 May 2021 13:24:47 +0200
Subject: [PATCH 37/40] netifd: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/config/netifd/Makefile | 12 +++++++++---
package/network/config/netifd/files/etc/udhcpc.user | 1 +
.../config/netifd/files/lib/netifd/dhcp.script | 3 +++
3 files changed, 13 insertions(+), 3 deletions(-)
create mode 100644 package/network/config/netifd/files/etc/udhcpc.user
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index 7061456b08..2f6b779e6d 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
-PKG_SOURCE_DATE:=2021-01-09
-PKG_SOURCE_VERSION:=c00c8335d6188daa326ecfe5a62da15a9b9987e1
-PKG_MIRROR_HASH:=c740e51e0cec13eec336ba1c7a643db3b64a9a2235f8c1b73a566cb89e841190
+PKG_SOURCE_DATE:=2021-05-26
+PKG_SOURCE_VERSION:=899c2a4520526d43113f73cf673f20e2486a40fb
+PKG_MIRROR_HASH:=354905192b30af88ea953241ed332555e67cdb7e3b54dd139250bf1e6ad3a709
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0
@@ -25,6 +25,11 @@ define Package/netifd
TITLE:=OpenWrt Network Interface Configuration Daemon
endef
+define Package/netifd/conffiles
+/etc/udhcpc.user
+/etc/udhcpc.user.d/
+endef
+
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include/libnl-tiny \
-I$(STAGING_DIR)/usr/include \
@@ -40,6 +45,7 @@ define Package/netifd/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/
$(CP) ./files/* $(1)/
+ $(INSTALL_DIR) $(1)/etc/udhcpc.user.d/
$(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/
endef
diff --git a/package/network/config/netifd/files/etc/udhcpc.user b/package/network/config/netifd/files/etc/udhcpc.user
new file mode 100644
index 0000000000..78e2ba5f18
--- /dev/null
+++ b/package/network/config/netifd/files/etc/udhcpc.user
@@ -0,0 +1 @@
+# This script is sourced by udhcpc's dhcp.script at every DHCP event.
diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script
index 6585b641d6..e46005d84c 100755
--- a/package/network/config/netifd/files/lib/netifd/dhcp.script
+++ b/package/network/config/netifd/files/lib/netifd/dhcp.script
@@ -112,5 +112,8 @@ esac
# user rules
[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@"
+for f in /etc/udhcpc.user.d/*; do
+ [ -f "$f" ] && (. "$f" "$@")
+done
exit 0
--
2.25.1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
From d0634b3177d6aeaaf71d1fe4f143846a6d47fea5 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 27 May 2021 13:25:41 +0200
Subject: [PATCH 40/40] mt76: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
package/kernel/mt76/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
index e9e95fa9b3..5104c3ec53 100644
--- a/package/kernel/mt76/Makefile
+++ b/package/kernel/mt76/Makefile
@@ -8,9 +8,9 @@ PKG_LICENSE_FILES:=
PKG_SOURCE_URL:=https://github.com/openwrt/mt76
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2021-04-11
-PKG_SOURCE_VERSION:=bf45b30d891961dd7c4139dddb58b909ea2c2b5a
-PKG_MIRROR_HASH:=431cecf80dafa986e805f809522721c2bb26289867d6770695d49baf8b471bea
+PKG_SOURCE_DATE:=2021-05-15
+PKG_SOURCE_VERSION:=9d736545bb5ac9707e60b7900b7d6b290492e24d
+PKG_MIRROR_HASH:=8fd98f488579c18cfd8c442cff1796dcd70e2ecbc59c5d5b92ee8c0f06efafcf
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_BUILD_PARALLEL:=1
--
2.25.1

View File

@@ -7,10 +7,15 @@ boot() {
. /lib/functions.sh
mkdir -p /certificates /etc/ucentral/
local mtd=$(find_mtd_index certificates)
[ -n "$mtd" -a -f /sys/class/mtd/mtd15/oobsize ] && ubiattach -p /dev/mtd$mtd
[ -n "$(ubinfo -a | grep certificates)" ] && {
[ -n "$mtd" -a -f /sys/class/mtd/mtd$mtd/oobsize ] && ubiattach -p /dev/mtd$mtd
if [ -n "$(ubinfo -a | grep certificates)" ]; then
mount -t ubifs ubi0:certificates /certificates
mount -t ubifs ubi1:certificates /certificates
else
mount -t squashfs /dev/mtdblock$mtd /certificates
fi
[ -f /certificates/dev-id ] && {
cp /certificates/*.pem /etc/ucentral/
cp /certificates/dev-id /etc/ucentral/
}
[ -f /certificates/dev-id ] && cp /certificates/* /etc/ucentral/
}

View File

@@ -1,7 +1,7 @@
#!/bin/sh
rm /etc/config/network /etc/config/wireless
cp /rom/etc/config/uhttpd /rom/etc/config/firewall /rom/etc/config/dhcp /etc/config
cp /rom/etc/config/uhttpd /rom/etc/config/firewall /rom/etc/config/dhcp /rom/etc/config/dropbear /etc/config
config_generate
wifi config

View File

@@ -6,5 +6,5 @@ uci commit
cp -r /etc/config/ /etc/config-shadow/
rm /etc/config/network
cp /rom/etc/config/dhcp /etc/config/
cp /rom/etc/config/uhttpd /rom/etc/config/firewall /rom/etc/config/dhcp /rom/etc/config/dropbear /etc/config
config_generate

View File

@@ -14,6 +14,7 @@
{
"name": "WAN",
"role": "upstream",
"services": [ "lldp" ],
"ethernet": [
{
"select-ports": [
@@ -42,7 +43,7 @@
{
"name": "LAN",
"role": "downstream",
"services": [ "ssh" ],
"services": [ "ssh", "lldp" ],
"ethernet": [
{
"select-ports": [
@@ -86,6 +87,10 @@
}
},
"services": {
"lldp": {
"describe": "uCentral",
"location": "universe"
},
"ssh": {
"port": 22
}

View File

@@ -6,7 +6,8 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=https://github.com/blogic/ucentral-wifi.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-04-13
PKG_SOURCE_VERSION:=6b9129154507559edcb298680a84c9c0c6fa1449
PKG_SOURCE_VERSION:=06733b8471fe81cea7f232d838209ce2ead26e94
PKG_MIRROR_HASH:=a8000b3cf43ce9ebfa7305661475fec98ec1dba2dc7b062028c2e17d7c2ec50b
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=BSD-3-Clause

View File

@@ -61,9 +61,9 @@ define Package/ath11k-firmware-ipq807x/install
endef
define Package/ath11k-firmware-qcn9000/install
$(INSTALL_DIR) $(1)/lib/firmware/qcn9000
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/qcn9000/hw1.0/
$(INSTALL_DATA) ./files/QCN9000/* \
$(1)/lib/firmware/qcn9000
$(1)/lib/firmware/ath11k/qcn9000/hw1.0/
endef
$(eval $(call BuildPackage,ath11k-firmware-ipq60xx))

View File

@@ -13,7 +13,7 @@ PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2020-07-02
PKG_SOURCE_VERSION:=58b384f467
#PKG_MIRROR_HASH:=1b2a4947034142587a3f81eac2ea27dd64650e77f8943d973623b47533be2393
PKG_MIRROR_HASH:=75547b2cca6edf1010180af2b6b0ab0592ffc2c13c861c163ff851490108f81b
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=BSD-3-Clause

View File

@@ -45,7 +45,6 @@ hostapd_append_wpa_key_mgmt() {
append wpa_key_mgmt "WPA-$auth_type_l"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-${auth_type_l}"
[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256"
[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256"
;;
eap192)
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
@@ -92,20 +91,24 @@ hostapd_add_log_config() {
hostapd_common_add_device_config() {
config_add_array basic_rate
config_add_array supported_rates
config_add_string beacon_rate
config_add_string country
config_add_boolean country_ie doth
config_add_boolean spectrum_mgmt_required
config_add_int local_pwr_constraint
config_add_int maxassoc
config_add_string require_mode
config_add_boolean legacy_rates
config_add_int cell_density
config_add_int rts_threshold
config_add_int rssi_reject_assoc_rssi
config_add_int rssi_ignore_probe_request
config_add_int maxassoc
config_add_string acs_chan_bias
config_add_array hostapd_options
config_add_int airtime_mode
config_add_boolean multiple_bssid rnr_beacon he_co_locate ema
hostapd_add_log_config
}
@@ -114,27 +117,20 @@ hostapd_prepare_device_config() {
local config="$1"
local driver="$2"
local base="${config%%.conf}"
local base_cfg=
json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode maxassoc \
multiple_bssid he_co_locate rnr_beacon ema
acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \
rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc
hostapd_set_log_options base_cfg
set_default country_ie 1
set_default spectrum_mgmt_required 0
set_default doth 1
set_default legacy_rates 1
set_default legacy_rates 0
set_default airtime_mode 0
set_default multiple_bssid 0
set_default rnr_beacon 0
set_default he_co_locate 0
set_default ema 0
set_default maxassoc 0
[ "$hwmode" = "b" ] && legacy_rates=1
set_default cell_density 0
[ -n "$country" ] && {
append base_cfg "country_code=$country" "$N"
@@ -147,7 +143,6 @@ hostapd_prepare_device_config() {
[ "$hwmode" = "a" -a "$doth" -gt 0 ] && append base_cfg "ieee80211h=1" "$N"
}
[ "$maxassoc" -gt 0 ] && append base_cfg "global_max_num_sta=$maxassoc" "$N"
[ -n "$acs_chan_bias" ] && append base_cfg "acs_chan_bias=$acs_chan_bias" "$N"
local brlist= br
@@ -156,16 +151,57 @@ hostapd_prepare_device_config() {
json_get_values rate_list supported_rates
[ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N"
[ "$legacy_rates" -eq 0 ] && set_default require_mode g
[ "$hwmode" = "g" ] && {
[ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
[ -n "$require_mode" ] && set_default basic_rate_list "6000 12000 24000"
}
case "$require_mode" in
n) append base_cfg "require_ht=1" "$N";;
ac) append base_cfg "require_vht=1" "$N";;
if [ "$hwmode" = "g" ] || [ "$hwmode" = "a" ]; then
[ -n "$require_mode" ] && legacy_rates=0
case "$require_mode" in
n) append base_cfg "require_ht=1" "$N";;
ac) append base_cfg "require_vht=1" "$N";;
esac
fi
case "$hwmode" in
b)
if [ "$cell_density" -eq 1 ]; then
set_default rate_list "5500 11000"
set_default basic_rate_list "5500 11000"
elif [ "$cell_density" -ge 2 ]; then
set_default rate_list "11000"
set_default basic_rate_list "11000"
fi
;;
g)
if [ "$cell_density" -eq 0 ] || [ "$cell_density" -eq 1 ]; then
if [ "$legacy_rates" -eq 0 ]; then
set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
set_default basic_rate_list "6000 12000 24000"
elif [ "$cell_density" -eq 1 ]; then
set_default rate_list "5500 6000 9000 11000 12000 18000 24000 36000 48000 54000"
set_default basic_rate_list "5500 11000"
fi
elif [ "$cell_density" -ge 3 ] && [ "$legacy_rates" -ne 0 ] || [ "$cell_density" -eq 2 ]; then
if [ "$legacy_rates" -eq 0 ]; then
set_default rate_list "12000 18000 24000 36000 48000 54000"
set_default basic_rate_list "12000 24000"
else
set_default rate_list "11000 12000 18000 24000 36000 48000 54000"
set_default basic_rate_list "11000"
fi
elif [ "$cell_density" -ge 3 ]; then
set_default rate_list "24000 36000 48000 54000"
set_default basic_rate_list "24000"
fi
;;
a)
if [ "$cell_density" -eq 1 ]; then
set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
set_default basic_rate_list "6000 12000 24000"
elif [ "$cell_density" -eq 2 ]; then
set_default rate_list "12000 18000 24000 36000 48000 54000"
set_default basic_rate_list "12000 24000"
elif [ "$cell_density" -ge 3 ]; then
set_default rate_list "24000 36000 48000 54000"
set_default basic_rate_list "24000"
fi
;;
esac
for r in $rate_list; do
@@ -176,15 +212,16 @@ hostapd_prepare_device_config() {
hostapd_add_rate brlist "$br"
done
[ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
[ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
[ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N"
[ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
append base_cfg "beacon_int=$beacon_int" "$N"
[ -n "$rts_threshold" ] && append base_cfg "rts_threshold=$rts_threshold" "$N"
append base_cfg "dtim_period=$dtim_period" "$N"
[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N"
[ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N"
[ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N"
[ "$ema" -gt 0 ] && append base_cfg "ema=$ema" "$N"
[ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N"
[ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N"
json_get_values opts hostapd_options
for val in $opts; do
@@ -202,7 +239,7 @@ hostapd_common_add_bss_config() {
config_add_boolean wds wmm uapsd hidden utf8_ssid
config_add_int maxassoc max_inactivity
config_add_boolean disassoc_low_ack isolate short_preamble
config_add_boolean disassoc_low_ack isolate short_preamble skip_inactivity_poll
config_add_int \
wep_rekey eap_reauth_period \
@@ -214,7 +251,6 @@ hostapd_common_add_bss_config() {
config_add_boolean rsn_preauth auth_cache
config_add_int ieee80211w
config_add_int ieee80211ai
config_add_int eapol_version
config_add_string 'auth_server:host' 'server:host'
@@ -241,7 +277,7 @@ hostapd_common_add_bss_config() {
config_add_array domain_match domain_match2 domain_suffix_match domain_suffix_match2
config_add_string ieee80211w_mgmt_cipher
config_add_int dynamic_vlan vlan_naming
config_add_int dynamic_vlan vlan_naming vlan_no_bridge
config_add_string vlan_tagged_interface vlan_bridge
config_add_string vlan_file
@@ -291,11 +327,7 @@ hostapd_common_add_bss_config() {
config_add_int iw_ipaddr_type_availability iw_gas_address3
config_add_string iw_hessid iw_network_auth_type iw_qos_map_set
config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
config_add_array iw_anqp_elem
config_add_int beacon_rate
config_add_int rssi_reject_assoc_rssi
config_add_int rssi_ignore_probe_request
config_add_array iw_anqp_elem iw_venue_name iw_venue_url
config_add_boolean hs20 disable_dgaf osen
config_add_int anqp_domain_id
@@ -304,21 +336,20 @@ hostapd_common_add_bss_config() {
config_add_array osu_provider
config_add_array operator_icon
config_add_array hs20_conn_capab
config_add_array roaming_consortium
config_add_array venue_name
config_add_array venue_url
config_add_array nai_realm
config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
config_add_boolean interworking internet
config_add_int access_network_type asra esr uesa venue_group venue_type ipaddr_type_availability \
gas_address3
config_add_string hessid network_auth_type \
anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url
config_add_string hs20_t_c_server_url
config_add_array airtime_sta_weight
config_add_int airtime_bss_weight airtime_bss_limit
config_add_int rts_threshold
config_add_boolean multicast_to_unicast proxy_arp per_sta_vif
config_add_array hostapd_bss_options
config_add_boolean request_cui
config_add_array radius_auth_req_attr
config_add_array radius_acct_req_attr
}
hostapd_set_vlan_file() {
@@ -382,28 +413,24 @@ append_iw_nai_realm() {
[ -n "$1" ] && append bss_conf "nai_realm=$1" "$N"
}
append_roaming_consortium() {
[ -n "$1" ] && append bss_conf "roaming_consortium=$1" "$N"
append_iw_venue_name() {
append bss_conf "venue_name=$1" "$N"
}
append_venue_name() {
[ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
}
append_venue_url() {
[ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
}
append_nai_realm() {
[ -n "$1" ] && append bss_conf "nai_realm=$1" "$N"
append_iw_venue_url() {
append bss_conf "venue_url=$1" "$N"
}
append_hs20_oper_friendly_name() {
[ -n "$1" ] && append bss_conf "hs20_oper_friendly_name=$1" "$N"
append bss_conf "hs20_oper_friendly_name=$1" "$N"
}
append_osu_provider_friendly_name() {
append bss_conf "osu_friendly_name=$1" "$N"
}
append_osu_provider_service_desc() {
[ -n "$1" ] && append bss_conf "osu_service_desc=$1" "$N"
append bss_conf "osu_service_desc=$1" "$N"
}
append_hs20_icon() {
@@ -423,15 +450,15 @@ append_hs20_icons() {
}
append_operator_icon() {
[ -n "$1" ] && append bss_conf "operator_icon=$1" "$N"
append bss_conf "operator_icon=$1" "$N"
}
append_osu_icon() {
[ -n "$1" ] && append bss_conf "osu_icon=$1" "$N"
append bss_conf "osu_icon=$1" "$N"
}
append_osu_provider() {
local cfgtype osu_server_uri osu_nai osu_nai2 osu_method_list
local cfgtype osu_server_uri osu_friendly_name osu_nai osu_nai2 osu_method_list
config_load wireless
config_get cfgtype "$1" TYPE
@@ -443,10 +470,10 @@ append_osu_provider() {
config_get osu_nai2 "$1" osu_nai2
config_get osu_method_list "$1" osu_method
[ -n "$osu_server_uri" ] && append bss_conf "osu_server_uri=$osu_server_uri" "$N"
[ -n "$osu_nai" ] && append bss_conf "osu_nai=$osu_nai" "$N"
[ -n "$osu_nai2" ] && append bss_conf "osu_nai2=$osu_nai2" "$N"
[ -n "$osu_method_list" ] && append bss_conf "osu_method_list=$osu_method_list" "$N"
append bss_conf "osu_server_uri=$osu_server_uri" "$N"
append bss_conf "osu_nai=$osu_nai" "$N"
append bss_conf "osu_nai2=$osu_nai2" "$N"
append bss_conf "osu_method_list=$osu_method_list" "$N"
config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc
config_list_foreach "$1" osu_friendly_name append_osu_friendly_name
@@ -459,6 +486,14 @@ append_hs20_conn_capab() {
[ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N"
}
append_radius_acct_req_attr() {
append bss_conf "radius_acct_req_attr=$1" "$N"
}
append_radius_auth_req_attr() {
append bss_conf "radius_auth_req_attr=$1" "$N"
}
append_airtime_sta_weight() {
[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
}
@@ -480,24 +515,25 @@ hostapd_set_bss_options() {
wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 wps_ap_setup_locked \
wps_independent wps_device_type wps_device_name wps_manufacturer wps_pin \
macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \
iapp_interface eapol_version dynamic_vlan ieee80211w ieee80211ai nasid \
iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
acct_server acct_secret acct_port acct_interval \
bss_load_update_period chan_util_avg_period sae_require_mfp \
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \
airtime_bss_weight airtime_bss_limit airtime_sta_weight \
rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold
multicast_to_unicast proxy_arp per_sta_vif
set_default isolate 0
set_default maxassoc 0
set_default max_inactivity 0
set_default short_preamble 1
set_default disassoc_low_ack 1
set_default skip_inactivity_poll 0
set_default hidden 0
set_default wmm 1
set_default uapsd 1
set_default wpa_disable_eapol_key_retries 0
set_default tdls_prohibit 0
set_default eapol_version 0
set_default eapol_version $((wpa & 1))
set_default acct_port 1813
set_default bss_load_update_period 60
set_default chan_util_avg_period 600
@@ -505,9 +541,6 @@ hostapd_set_bss_options() {
set_default multi_ap 0
set_default airtime_bss_weight 0
set_default airtime_bss_limit 0
set_default rssi_reject_assoc_rssi 0
set_default rssi_ignore_probe_request 0
set_default rts_threshold -1
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -527,15 +560,13 @@ hostapd_set_bss_options() {
append bss_conf "bss_load_update_period=$bss_load_update_period" "$N"
append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N"
append bss_conf "disassoc_low_ack=$disassoc_low_ack" "$N"
append bss_conf "skip_inactivity_poll=$skip_inactivity_poll" "$N"
append bss_conf "preamble=$short_preamble" "$N"
append bss_conf "wmm_enabled=$wmm" "$N"
append bss_conf "ignore_broadcast_ssid=$hidden" "$N"
append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
append bss_conf "utf8_ssid=$utf8_ssid" "$N"
append bss_conf "multi_ap=$multi_ap" "$N"
append bss_conf "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
append bss_conf "rts_threshold=$rts_threshold" "$N"
[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
@@ -554,6 +585,7 @@ hostapd_set_bss_options() {
append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
[ -n "$acct_interval" ] && \
append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
json_for_each_item append_radius_acct_req_attr radius_acct_req_attr
}
case "$auth_type" in
@@ -608,7 +640,7 @@ hostapd_set_bss_options() {
auth_server auth_secret auth_port \
dae_client dae_secret dae_port \
ownip radius_client_addr \
eap_reauth_period
eap_reauth_period request_cui
# radius can provide VLAN ID for clients
vlan_possible=1
@@ -620,18 +652,20 @@ hostapd_set_bss_options() {
set_default auth_port 1812
set_default dae_port 3799
set_default request_cui 0
append bss_conf "auth_server_addr=$auth_server" "$N"
append bss_conf "auth_server_port=$auth_port" "$N"
append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
[ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N"
[ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
[ -n "$dae_client" -a -n "$dae_secret" ] && {
append bss_conf "radius_das_port=$dae_port" "$N"
append bss_conf "radius_das_client=$dae_client $dae_secret" "$N"
}
json_for_each_item append_radius_auth_req_attr radius_auth_req_attr
[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
@@ -673,7 +707,7 @@ hostapd_set_bss_options() {
set_default wps_independent 1
wps_state=2
[ -n "$wps_configured" ] && wps_state=1
[ -n "$wps_not_configured" ] && wps_state=1
[ "$ext_registrar" -gt 0 -a -n "$network_bridge" ] && append bss_conf "upnp_iface=$network_bridge" "$N"
@@ -711,6 +745,8 @@ hostapd_set_bss_options() {
}
json_get_vars time_advertisement time_zone wnm_sleep_mode bss_transition
set_default bss_transition 0
set_default wnm_sleep_mode 0
[ -n "$time_advertisement" ] && append bss_conf "time_advertisement=$time_advertisement" "$N"
[ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N"
@@ -722,18 +758,23 @@ hostapd_set_bss_options() {
if [ "$ieee80211k" -eq "1" ]; then
set_default rrm_neighbor_report 1
set_default rrm_beacon_report 1
else
set_default rrm_neighbor_report 0
set_default rrm_beacon_report 0
fi
[ "$rrm_neighbor_report" -eq "1" ] && append bss_conf "rrm_neighbor_report=1" "$N"
[ "$rrm_beacon_report" -eq "1" ] && append bss_conf "rrm_beacon_report=1" "$N"
json_get_vars ftm_responder stationary_ap lci civic
set_default ftm_responder 0
if [ "$ftm_responder" -eq "1" ]; then
set_default stationary_ap 0
iw phy "$phy" info | grep -q "ENABLE_FTM_RESPONDER" && {
append bss_conf "ftm_responder=1" "$N"
[ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N"
[ -n "$lci" ] && append bss_conf "lci=$lci" "$N"
[ -n "$civic" ] && append bss_conf "lci=$civic" "$N"
[ -n "$civic" ] && append bss_conf "civic=$civic" "$N"
}
fi
@@ -743,7 +784,7 @@ hostapd_set_bss_options() {
if [ "$ieee80211r" -gt "0" ]; then
json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline
set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)"
set_default ft_over_ds 1
set_default reassociation_deadline 1000
@@ -856,13 +897,17 @@ hostapd_set_bss_options() {
}
[ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && {
json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file
json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file vlan_no_bridge
set_default vlan_naming 1
[ -z "$vlan_file" ] && set_default vlan_file /var/run/hostapd-$ifname.vlan
append bss_conf "dynamic_vlan=$dynamic_vlan" "$N"
append bss_conf "vlan_naming=$vlan_naming" "$N"
[ -n "$vlan_bridge" ] && \
if [ -n "$vlan_bridge" ]; then
append bss_conf "vlan_bridge=$vlan_bridge" "$N"
else
set_default vlan_no_bridge 1
fi
append bss_conf "vlan_no_bridge=$vlan_no_bridge" "$N"
[ -n "$vlan_tagged_interface" ] && \
append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
[ -n "$vlan_file" ] && {
@@ -875,6 +920,7 @@ hostapd_set_bss_options() {
json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type
json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
json_get_vars iw_venue_name iw_venue_url
set_default iw_enabled 0
if [ "$iw_enabled" = "1" ]; then
@@ -903,6 +949,8 @@ hostapd_set_bss_options() {
json_for_each_item append_iw_roaming_consortium iw_roaming_consortium
json_for_each_item append_iw_anqp_elem iw_anqp_elem
json_for_each_item append_iw_nai_realm iw_nai_realm
json_for_each_item append_iw_venue_name iw_venue_name
json_for_each_item append_iw_venue_url iw_venue_url
iw_domain_name_conf=
json_for_each_item append_iw_domain_name iw_domain_name
@@ -918,15 +966,9 @@ hostapd_set_bss_options() {
local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \
interworking internet access_network_type asra esr uesa venue_group venue_type \
ipaddr_type_availability gas_address3 hessid \
network_auth_type anqp_3gpp_cell_net domain_name anqp_elem qos_map_set \
hs20_t_c_server_url
json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \
interworking internet access_network_type asra esr uesa venue_group venue_type \
ipaddr_type_availability gas_address3 hessid \
network_auth_type anqp_3gpp_cell_net domain_name anqp_elem qos_map_set \
hs20_t_c_server_url
set_default hs20 0
@@ -937,44 +979,41 @@ hostapd_set_bss_options() {
if [ "$hs20" = "1" ]; then
append bss_conf "hs20=1" "$N"
append_hs20_icons
[ -n "$disable_dgaf"] && append bss_conf "disable_dgaf=$disable_dgaf" "$N"
[ -n "$osen"] && append bss_conf "osen=$osen" "$N"
[ -n "$anqp_domain_id"] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N"
[ -n "$hs20_deauth_req_timeout"] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N"
append bss_conf "disable_dgaf=$disable_dgaf" "$N"
append bss_conf "osen=$osen" "$N"
append bss_conf "anqp_domain_id=$anqp_domain_id" "$N"
append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N"
[ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N"
[ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N"
[ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N"
[ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N"
[ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N"
[ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N"
json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name
json_for_each_item append_roaming_consortium roaming_consortium
json_for_each_item append_venue_name venue_name
json_for_each_item append_venue_url venue_url
json_for_each_item append_nai_realm nai_realm
json_for_each_item append_hs20_conn_capab hs20_conn_capab
json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name
json_for_each_item append_osu_provider osu_provider
json_for_each_item append_operator_icon operator_icon
[ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N"
[ -n "$internet" ] && append bss_conf "internet=$internet" "$N"
[ -n "$access_network_type" ] && append bss_conf "access_network_type=$access_network_type" "$N"
[ -n "$asra" ] && append bss_conf "asra=$asra" "$N"
[ -n "$esr" ] && append bss_conf "esr=$esr" "$N"
[ -n "$uesa" ] && append bss_conf "uesa=$uesa" "$N"
[ -n "$venue_group" ] && append bss_conf "venue_group=$venue_group" "$N"
[ -n "$venue_type" ] && append bss_conf "venue_type=$venue_type" "$N"
[ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N"
[ -n "$gas_address3" ] && append bss_conf "gas_address3=$gas_address3" "$N"
[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N"
[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N"
[ -n "$anqp_3gpp_cell_net" ] && append bss_conf "anqp_3gpp_cell_net=$anqp_3gpp_cell_net" "$N"
[ -n "$nai_realm" ] && append bss_conf "nai_realm=$nai_realm" "$N"
[ -n "$anqp_elem" ] && append bss_conf "anqp_elem=$anqp_elem" "$N"
[ -n "$qos_map_set" ] && append bss_conf "qos_map_set=$qos_map_set" "$N"
[ -n "$domain_name" ] && append bss_conf "domain_name=$domain_name" "$N"
[ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N"
fi
set_default multicast_to_unicast 0
if [ "$multicast_to_unicast" -gt 0 ]; then
append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N"
fi
set_default proxy_arp 0
if [ "$proxy_arp" -gt 0 ]; then
append bss_conf "proxy_arp=$proxy_arp" "$N"
fi
set_default per_sta_vif 0
if [ "$per_sta_vif" -gt 0 ]; then
append bss_conf "per_sta_vif=$per_sta_vif" "$N"
fi
json_get_values opts hostapd_bss_options
for val in $opts; do
append bss_conf "$val" "$N"
done
bss_md5sum=$(echo $bss_conf | md5sum | cut -d" " -f1)
append bss_conf "config_id=$bss_md5sum" "$N"
@@ -1095,9 +1134,9 @@ wpa_supplicant_set_fixed_freq() {
VHT*) append network_data "vht=1" "$N$T";;
esac
case "$htmode" in
VHT80|HE80) append network_data "max_oper_chwidth=1" "$N$T";;
VHT160|HE160) append network_data "max_oper_chwidth=2" "$N$T";;
VHT20|HE20|VHT40|HE40) append network_data "max_oper_chwidth=0" "$N$T";;
HE80|VHT80) append network_data "max_oper_chwidth=1" "$N$T";;
HE160|VHT160) append network_data "max_oper_chwidth=2" "$N$T";;
HE20|HE40|VHT20|VHT40) append network_data "max_oper_chwidth=0" "$N$T";;
*) append network_data "disable_vht=1" "$N$T";;
esac
}
@@ -1130,7 +1169,6 @@ wpa_supplicant_add_network() {
set_default multi_ap 0
local key_mgmt='NONE'
local enc_str=
local network_data=
local T=" "
@@ -1340,6 +1378,11 @@ wpa_supplicant_add_network() {
;;
esac
[ "$wpa_cipher" = GCMP ] && {
append network_data "pairwise=GCMP" "$N$T"
append network_data "group=GCMP" "$N$T"
}
[ "$mode" = mesh ] || {
case "$wpa" in
1)
@@ -1380,7 +1423,7 @@ wpa_supplicant_add_network() {
append network_data "mcast_rate=$mc_rate" "$N$T"
}
if [ "$key_mgnt" = "WPS" ]; then
if [ "$key_mgmt" = "WPS" ]; then
echo "wps_cred_processing=1" >> "$_config"
else
cat >> "$_config" <<EOF
@@ -1402,19 +1445,18 @@ wpa_supplicant_run() {
_wpa_supplicant_common "$ifname"
ubus wait_for wpa_supplicant
ubus call wpa_supplicant config_add "{ \
local supplicant_res="$(ubus call wpa_supplicant config_add "{ \
\"driver\": \"${_w_driver:-wext}\", \"ctrl\": \"$_rpath\", \
\"iface\": \"$ifname\", \"config\": \"$_config\" \
${network_bridge:+, \"bridge\": \"$network_bridge\"} \
${hostapd_ctrl:+, \"hostapd_ctrl\": \"$hostapd_ctrl\"} \
}"
}")"
ret="$?"
[ "$ret" != 0 ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
[ "$ret" != 0 -o -z "$supplicant_res" ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
local supplicant_pid=$(ubus call service list '{"name": "wpad"}' | jsonfilter -l 1 -e "@['wpad'].instances['supplicant'].pid")
wireless_add_process "$supplicant_pid" "/usr/sbin/wpa_supplicant" 1
wireless_add_process "$(jsonfilter -s "$supplicant_res" -l 1 -e @.pid)" "/usr/sbin/wpa_supplicant" 1 1
return $ret
}

View File

@@ -424,3 +424,52 @@
}
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -22,6 +22,7 @@
static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
int existsok)
{
+ bool vlan_exists = iface_exists(vlan->ifname);
int ret;
#ifdef CONFIG_WEP
int i;
@@ -36,7 +37,7 @@ static int vlan_if_add(struct hostapd_da
}
#endif /* CONFIG_WEP */
- if (!iface_exists(vlan->ifname))
+ if (!vlan_exists)
ret = hostapd_vlan_if_add(hapd, vlan->ifname);
else if (!existsok)
return -1;
@@ -51,6 +52,9 @@ static int vlan_if_add(struct hostapd_da
if (hapd->wpa_auth)
ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id);
+ if (!ret && !vlan_exists)
+ hostapd_ubus_add_vlan(hapd, vlan);
+
if (ret == 0)
return ret;
@@ -77,6 +81,8 @@ int vlan_if_remove(struct hostapd_data *
"WPA deinitialization for VLAN %d failed (%d)",
vlan->vlan_id, ret);
+ hostapd_ubus_remove_vlan(hapd, vlan);
+
return hostapd_vlan_if_remove(hapd, vlan->ifname);
}
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1179,6 +1179,8 @@ int hostapd_dfs_radar_detected(struct ho
"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
+ hostapd_ubus_notify_radar_detected(iface, freq, chan_width, cf1, cf2);
+
/* Proceed only if DFS is not offloaded to the driver */
if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
return 0;

View File

@@ -174,7 +174,7 @@
hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4493,6 +4493,9 @@ static int wpa_driver_nl80211_set_ap(voi
@@ -4511,6 +4511,9 @@ static int wpa_driver_nl80211_set_ap(voi
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
ret, strerror(-ret));

View File

@@ -0,0 +1,33 @@
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -115,6 +115,7 @@ struct hostapd_ssid {
#define DYNAMIC_VLAN_OPTIONAL 1
#define DYNAMIC_VLAN_REQUIRED 2
int dynamic_vlan;
+ int vlan_no_bridge;
#define DYNAMIC_VLAN_NAMING_WITHOUT_DEVICE 0
#define DYNAMIC_VLAN_NAMING_WITH_DEVICE 1
#define DYNAMIC_VLAN_NAMING_END 2
--- a/src/ap/vlan_full.c
+++ b/src/ap/vlan_full.c
@@ -466,6 +466,9 @@ void vlan_newlink(const char *ifname, st
wpa_printf(MSG_DEBUG, "VLAN: vlan_newlink(%s)", ifname);
+ if (hapd->conf->ssid.vlan_no_bridge)
+ return;
+
for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
if (vlan->configured ||
os_strcmp(ifname, vlan->ifname) != 0)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3400,6 +3400,8 @@ static int hostapd_config_fill(struct ho
#ifndef CONFIG_NO_VLAN
} else if (os_strcmp(buf, "dynamic_vlan") == 0) {
bss->ssid.dynamic_vlan = atoi(pos);
+ } else if (os_strcmp(buf, "vlan_no_bridge") == 0) {
+ bss->ssid.vlan_no_bridge = atoi(pos);
} else if (os_strcmp(buf, "per_sta_vif") == 0) {
bss->ssid.per_sta_vif = atoi(pos);
} else if (os_strcmp(buf, "vlan_file") == 0) {

View File

@@ -0,0 +1,82 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2873,6 +2873,14 @@ static int hostapd_config_fill(struct ho
line, bss->max_num_sta, MAX_STA_COUNT);
return 1;
}
+ } else if (os_strcmp(buf, "iface_max_num_sta") == 0) {
+ conf->max_num_sta = atoi(pos);
+ if (conf->max_num_sta < 0 ||
+ conf->max_num_sta > MAX_STA_COUNT) {
+ wpa_printf(MSG_ERROR, "Line %d: Invalid max_num_sta=%d; allowed range 0..%d",
+ line, conf->max_num_sta, MAX_STA_COUNT);
+ return 1;
+ }
} else if (os_strcmp(buf, "wpa") == 0) {
bss->wpa = atoi(pos);
} else if (os_strcmp(buf, "extended_key_id") == 0) {
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -648,6 +648,7 @@ void hostapd_cleanup_cs_params(struct ho
void hostapd_periodic_iface(struct hostapd_iface *iface);
int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
+int hostapd_check_max_sta(struct hostapd_data *hapd);
/* utils.c */
int hostapd_register_probereq_cb(struct hostapd_data *hapd,
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -236,6 +236,30 @@ static int hostapd_iface_conf_changed(st
}
+static inline int hostapd_iface_num_sta(struct hostapd_iface *iface)
+{
+ int num_sta = 0;
+ int i;
+
+ for (i = 0; i < iface->num_bss; i++)
+ num_sta += iface->bss[i]->num_sta;
+
+ return num_sta;
+}
+
+
+int hostapd_check_max_sta(struct hostapd_data *hapd)
+{
+ if (hapd->num_sta >= hapd->conf->max_num_sta)
+ return 1;
+
+ if (hapd->iconf->max_num_sta &&
+ hostapd_iface_num_sta(hapd->iface) >= hapd->iconf->max_num_sta)
+ return 1;
+
+ return 0;
+}
+
int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
{
struct hapd_interfaces *interfaces = iface->interfaces;
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1039,7 +1039,7 @@ void handle_probe_req(struct hostapd_dat
if (hapd->conf->no_probe_resp_if_max_sta &&
is_multicast_ether_addr(mgmt->da) &&
is_multicast_ether_addr(mgmt->bssid) &&
- hapd->num_sta >= hapd->conf->max_num_sta &&
+ hostapd_check_max_sta(hapd) &&
!ap_get_sta(hapd, mgmt->sa)) {
wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR
" since no room for additional STA",
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -976,6 +976,8 @@ struct hostapd_config {
unsigned int track_sta_max_num;
unsigned int track_sta_max_age;
+ int max_num_sta;
+
char country[3]; /* first two octets: country code as described in
* ISO/IEC 3166-1. Third octet:
* ' ' (ascii 32): all environments

View File

@@ -1,881 +0,0 @@
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -41,7 +41,7 @@ struct hapd_global {
static struct hapd_global global;
static int daemonize = 0;
static char *pid_file = NULL;
-
+uint32_t cached_events_nr = 0;
#ifndef CONFIG_NO_HOSTAPD_LOGGER
static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module,
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -97,6 +97,10 @@ struct hostapd_probereq_cb {
};
#define HOSTAPD_RATE_BASIC 0x00000001
+/* max number of cached events */
+#define HOSTAPD_MAX_CACHED_EVENTS 500
+/* event counter */
+uint32_t cached_events_nr;
struct hostapd_rate_data {
int rate; /* rate in 100 kbps */
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4908,6 +4908,7 @@ int ieee802_11_mgmt(struct hostapd_data
int ret = 0;
unsigned int freq;
int ssi_signal = fi ? fi->ssi_signal : 0;
+ int ubus_resp;
if (len < 24)
return 0;
@@ -4977,25 +4978,52 @@ int ieee802_11_mgmt(struct hostapd_data
if (hapd->iconf->track_sta_max_num)
sta_track_add(hapd->iface, mgmt->sa, ssi_signal);
+ /* ubus request */
+ struct hostapd_ubus_request req = {
+ .type = HOSTAPD_UBUS_TYPE_MAX,
+ .mgmt_frame = mgmt,
+ .ssi_signal = ssi_signal
+ };
+
switch (stype) {
case WLAN_FC_STYPE_AUTH:
wpa_printf(MSG_DEBUG, "mgmt::auth");
handle_auth(hapd, mgmt, len, ssi_signal, 0);
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]",
+ stype,
+ "AUTH");
+ req.type = HOSTAPD_UBUS_AUTH_REQ;
ret = 1;
break;
case WLAN_FC_STYPE_ASSOC_REQ:
wpa_printf(MSG_DEBUG, "mgmt::assoc_req");
handle_assoc(hapd, mgmt, len, 0, ssi_signal);
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]",
+ stype,
+ "ASSOC");
+ req.type = HOSTAPD_UBUS_ASSOC_REQ;
ret = 1;
break;
case WLAN_FC_STYPE_REASSOC_REQ:
wpa_printf(MSG_DEBUG, "mgmt::reassoc_req");
handle_assoc(hapd, mgmt, len, 1, ssi_signal);
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]",
+ stype,
+ "RE-ASSOC");
+ req.type = HOSTAPD_UBUS_REASSOC_REQ;
ret = 1;
break;
case WLAN_FC_STYPE_DISASSOC:
wpa_printf(MSG_DEBUG, "mgmt::disassoc");
handle_disassoc(hapd, mgmt, len);
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]",
+ stype,
+ "DISASSOC");
+ req.type = HOSTAPD_UBUS_DISASSOC_REQ;
ret = 1;
break;
case WLAN_FC_STYPE_DEAUTH:
@@ -5014,6 +5042,15 @@ int ieee802_11_mgmt(struct hostapd_data
break;
}
+ /* ubus send */
+ if (req.type != HOSTAPD_UBUS_TYPE_MAX) {
+ ubus_resp = hostapd_ubus_handle_rt_event(hapd, &req);
+ if (ubus_resp) {
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_INFO,
+ "hostapd_ubus_handle_rt_event: ERROR");
+ }
+ }
return ret;
}
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -423,8 +423,14 @@ void ap_handle_timer(void *eloop_ctx, vo
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_INFO, "deauthenticated due to "
"local deauth request");
- ap_free_sta(hapd, sta);
hostapd_ubus_notify(hapd, "local-deauth", sta->addr);
+ struct hostapd_ubus_request req = {
+ .type = HOSTAPD_UBUS_DISASSOC_REQ,
+ .sta = sta,
+ .reason = sta->deauth_reason
+ };
+ hostapd_ubus_handle_rt_event(hapd, &req);
+ ap_free_sta(hapd, sta);
return;
}
@@ -530,6 +536,14 @@ skip_poll:
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY :
WLAN_REASON_PREV_AUTH_NOT_VALID;
+ /* sessions */
+ struct hostapd_ubus_request req = {
+ .type = HOSTAPD_UBUS_DISASSOC_REQ,
+ .sta = sta,
+ .reason = reason
+ };
+ hostapd_ubus_handle_rt_event(hapd, &req);
+
hostapd_drv_sta_disassoc(hapd, sta->addr, reason);
}
}
@@ -566,6 +580,15 @@ skip_poll:
__func__, MAC2STR(sta->addr), AP_DEAUTH_DELAY);
eloop_register_timeout(AP_DEAUTH_DELAY, 0, ap_handle_timer,
hapd, sta);
+
+ /* sessions */
+ struct hostapd_ubus_request req = {
+ .type = HOSTAPD_UBUS_DISASSOC_REQ,
+ .sta = sta,
+ .reason = reason
+ };
+ hostapd_ubus_handle_rt_event(hapd, &req);
+
mlme_disassociate_indication(hapd, sta, reason);
break;
case STA_DEAUTH:
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -77,6 +77,9 @@ struct sta_info {
u8 supported_rates[WLAN_SUPP_RATES_MAX];
int supported_rates_len;
u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
+ u64 cl_session_id; /* client fnv1a 64bit session id */
+ u8 fdata; /* client first data flag */
+ u8 first_ip; /* client first ip flag */
#ifdef CONFIG_MESH
enum mesh_plink_state plink_state;
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -24,7 +24,10 @@
static struct ubus_context *ctx;
static struct blob_buf b;
+static struct blob_buf b_ev;
static int ctx_ref;
+static char** bss_lst = NULL;
+static size_t bss_nr = 0;
static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj)
{
@@ -63,6 +66,21 @@ static void hostapd_ubus_connection_lost
eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL);
}
+static int avl_compare_sess_id(const void *k1, const void *k2, void *ptr)
+{
+ const uint32_t *id1 = k1, *id2 = k2;
+
+ if (*id1 < *id2)
+ return -1;
+ else
+ return *id1 > *id2;
+}
+
+uint64_t get_time_in_ms(struct timespec *ts)
+{
+ return (uint64_t) ts->tv_sec * 1000 + ts->tv_nsec / 1000000;
+}
+
static bool hostapd_ubus_init(void)
{
if (ctx)
@@ -525,6 +543,177 @@ static const struct blobmsg_policy csa_p
};
#ifdef NEED_AP_MLME
+enum { CSESS_REQ_SESS_ID,
+ __CSESS_REQ_MAX,
+};
+
+static const struct blobmsg_policy client_session_del_policy[__CSESS_REQ_MAX] = {
+ [CSESS_REQ_SESS_ID] = { .name = "session_id", .type = BLOBMSG_TYPE_INT64 },
+};
+
+static int hostapd_clear_session(struct ubus_context *ctx,
+ struct ubus_object *obj,
+ struct ubus_request_data *req,
+ const char *method,
+ struct blob_attr *msg)
+{
+ struct blob_attr *tb[__CSESS_REQ_MAX];
+ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
+ struct hostapd_event_avl_rec *rec = NULL;
+ struct hostapd_event_avl_rec *rec_next = NULL;
+ uint64_t session_id = 0;
+
+ blobmsg_parse(client_session_del_policy, __CSESS_REQ_MAX, tb,
+ blob_data(msg), blob_len(msg));
+
+ if (!tb[CSESS_REQ_SESS_ID])
+ return UBUS_STATUS_INVALID_ARGUMENT;
+
+ session_id = blobmsg_get_u64(tb[CSESS_REQ_SESS_ID]);
+ /* remove from AVL and ubus session object) */
+ avl_for_each_element_safe(&hapd->ubus.rt_events, rec, avl, rec_next)
+ {
+ if (session_id == rec->session_id) {
+ /* dec counter and delete */
+ cached_events_nr -= rec->rec_nr;
+ avl_delete(&hapd->ubus.rt_events, &rec->avl);
+ os_free(rec->records);
+ os_free(rec);
+ }
+ }
+ return 0;
+}
+
+static int hostapd_clear_sessions(struct ubus_context *ctx,
+ struct ubus_object *obj,
+ struct ubus_request_data *req,
+ const char *method,
+ struct blob_attr *msg)
+{
+ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
+ struct hostapd_event_avl_rec *rec = NULL;
+ struct hostapd_event_avl_rec *rec_n = NULL;
+
+ avl_remove_all_elements(&hapd->ubus.rt_events, rec, avl, rec_n)
+ {
+ /* free events array */
+ os_free(rec->records);
+ os_free(rec);
+ }
+ /* reset counter */
+ cached_events_nr = 0;
+ return 0;
+}
+
+static int hostapd_sessions(struct ubus_context *ctx,
+ struct ubus_object *obj,
+ struct ubus_request_data *req,
+ const char *method,
+ struct blob_attr *msg)
+{
+ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
+ void *a = NULL;
+ void *t = NULL;
+ void *t_msg = NULL;
+ struct hostapd_event_avl_rec *rec = NULL;
+ struct client_session_record *c_rec = NULL;
+
+ blob_buf_init(&b_ev, 0);
+ a = blobmsg_open_table(&b_ev, "sessions");
+ avl_for_each_element(&hapd->ubus.rt_events, rec, avl)
+ {
+ /* open session */
+ t = blobmsg_open_table(&b_ev, "ClientSession");
+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id);
+ /* messages for current session */
+ for (size_t i = 0; i < rec->rec_nr; i++) {
+ c_rec = &rec->records[i];
+ /* check message type */
+ switch (c_rec->type) {
+ /* ClientAuthEvent */
+ case CST_AUTH: {
+ struct client_auth_event *p = &c_rec->u.auth;
+ t_msg = blobmsg_open_table(&b_ev, "ClientAuthEvent");
+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id);
+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp);
+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac);
+ blobmsg_add_u32(&b_ev, "band", p->band);
+ blobmsg_add_u32(&b_ev, "auth_status", p->auth_status);
+ blobmsg_add_string(&b_ev, "ssid", p->ssid);
+ blobmsg_close_table(&b_ev, t_msg);
+ break;
+ }
+
+ /* ClientAssocEvent */
+ case CST_ASSOC: {
+ struct client_assoc_event *p = &c_rec->u.assoc;
+ t_msg = blobmsg_open_table(&b_ev, "ClientAssocEvent");
+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id);
+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp);
+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac);
+ blobmsg_add_u32(&b_ev, "band", p->band);
+ blobmsg_add_u32(&b_ev, "assoc_type", 0);
+ blobmsg_add_u32(&b_ev, "rssi", p->rssi);
+ blobmsg_add_u32(&b_ev, "internal_sc", 0);
+ blobmsg_add_u8(&b_ev, "using11k", p->using11k);
+ blobmsg_add_u8(&b_ev, "using11r", p->using11r);
+ blobmsg_add_u8(&b_ev, "using11v", p->using11v);
+ blobmsg_add_string(&b_ev, "ssid", p->ssid);
+ blobmsg_close_table(&b_ev, t_msg);
+ break;
+ }
+
+ /* ClientDisconnectEvent */
+ case CST_DISASSOC: {
+ struct client_disassoc_event *p = &c_rec->u.disassoc;
+ t_msg = blobmsg_open_table(&b_ev, "ClientDisconnectEvent");
+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id);
+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp);
+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac);
+ blobmsg_add_u32(&b_ev, "band", p->band);
+ blobmsg_add_u32(&b_ev, "rssi", p->rssi);
+ blobmsg_add_u32(&b_ev, "internal_rc", p->internal_rc);
+ blobmsg_add_string(&b_ev, "ssid", p->ssid);
+ blobmsg_close_table(&b_ev, t_msg);
+ break;
+ }
+
+ /* ClientFirstDataEvent */
+ case CST_FDATA: {
+ struct client_fdata_event *p = &c_rec->u.fdata;
+ t_msg = blobmsg_open_table(&b_ev, "ClientFirstDataEvent");
+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id);
+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp);
+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac);
+ blobmsg_add_u64(&b_ev, "fdata_tx_up_ts_in_us", p->tx_ts.tv_sec * (uint64_t)1000000);
+ blobmsg_add_u64(&b_ev, "fdata_rx_up_ts_in_us", p->rx_ts.tv_sec * (uint64_t)1000000);
+ blobmsg_close_table(&b_ev, t_msg);
+ break;
+ }
+
+ /* ClientIpEvent */
+ case CST_IP: {
+ struct client_ip_event *p = &c_rec->u.ip;
+ t_msg = blobmsg_open_table(&b_ev, "ClientIpEvent");
+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id);
+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp);
+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac);
+ blobmsg_add_string(&b_ev, "ip_address", p->ip_addr);
+ blobmsg_close_table(&b_ev, t_msg);
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+ blobmsg_close_table(&b_ev, t);
+ }
+ blobmsg_close_table(&b_ev, a);
+ ubus_send_reply(ctx, req, b_ev.head);
+ return 0;
+}
+
static int
hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -1148,6 +1337,9 @@ static const struct ubus_method bss_meth
UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features),
#ifdef NEED_AP_MLME
UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy),
+ UBUS_METHOD_NOARG("get_sessions", hostapd_sessions),
+ UBUS_METHOD_NOARG("clear_sessions", hostapd_clear_sessions),
+ UBUS_METHOD("clear_session", hostapd_clear_session, client_session_del_policy),
#endif
UBUS_METHOD("set_vendor_elements", hostapd_vendor_elements, ve_policy),
UBUS_METHOD("notify_response", hostapd_notify_response, notify_policy),
@@ -1187,6 +1379,7 @@ void hostapd_ubus_add_bss(struct hostapd
if (asprintf(&name, "hostapd.%s", hapd->conf->iface) < 0)
return;
+ avl_init(&hapd->ubus.rt_events, avl_compare_sess_id, false, NULL);
avl_init(&hapd->ubus.banned, avl_compare_macaddr, false, NULL);
obj->name = name;
obj->type = &bss_object_type;
@@ -1194,6 +1387,9 @@ void hostapd_ubus_add_bss(struct hostapd
obj->n_methods = bss_object_type.n_methods;
ret = ubus_add_object(ctx, obj);
hostapd_ubus_ref_inc();
+ bss_nr++;
+ bss_lst = os_realloc(bss_lst, sizeof(char *) * bss_nr);
+ bss_lst[bss_nr - 1] = strdup(name);
if (hapd->conf->signal_stay_min > -128)
eloop_register_timeout(3, 0, hostapd_bss_signal_check, NULL, hapd); /* Start up the poll timer. */
}
@@ -1212,11 +1408,42 @@ void hostapd_ubus_free_bss(struct hostap
}
free(name);
+ for (size_t i = 0; i < bss_nr; i++)
+ os_free(bss_lst[i]);
+ free(bss_lst);
+ bss_lst = NULL;
+}
+
+static int hostapd_get_bss_list(struct ubus_context *ctx,
+ struct ubus_object *obj,
+ struct ubus_request_data *req,
+ const char *method,
+ struct blob_attr *msg)
+{
+ if (!bss_lst)
+ return 0;
+
+ void *a = NULL;
+ void *b = NULL;
+
+ /* create reply */
+ blob_buf_init(&b_ev, 0);
+ a = blobmsg_open_array(&b_ev, "bss_list");
+ /* check bss list from hapd */
+ for (size_t i = 0; i < bss_nr; i++) {
+ b = blobmsg_open_table(&b_ev, NULL);
+ blobmsg_add_string(&b_ev, "name", bss_lst[i]);
+ blobmsg_close_table(&b_ev, b);
+ }
+ blobmsg_close_array(&b_ev, a);
+ ubus_send_reply(ctx, req, b_ev.head);
+ return 0;
}
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),
+ UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list),
};
static struct ubus_object_type daemon_object_type =
@@ -1260,6 +1487,18 @@ struct ubus_event_req {
int resp;
};
+static uint64_t hash_fnv1a_64bit(const void *key, int len)
+{
+ if (key == NULL)
+ return 0;
+ unsigned char *p = (unsigned char *)key;
+ uint64_t h = 14695981039346656037UL;
+ int i;
+ for (i = 0; i < len; i++)
+ h = (h ^ p[i]) * 1099511628211UL;
+ return h;
+}
+
static void
ubus_event_cb(struct ubus_notify_request *req, int idx, int ret)
{
@@ -1268,6 +1507,224 @@ ubus_event_cb(struct ubus_notify_request
ureq->resp = ret;
}
+int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd,
+ struct hostapd_ubus_request *req)
+{
+ /* check event counter */
+ if (cached_events_nr > HOSTAPD_MAX_CACHED_EVENTS) {
+ hostapd_logger(
+ hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_WARNING,
+ "hostapd_ubus_handle_rt_event: HOSTAPD_MAX_CACHED_EVENTS [%d] exceeded",
+ HOSTAPD_MAX_CACHED_EVENTS);
+ return WLAN_STATUS_SUCCESS;
+ }
+ struct hostapd_event_avl_rec *rec = NULL;
+ struct timespec ts;
+ uint64_t timestamp = 0;
+ clock_gettime(CLOCK_REALTIME, &ts);
+ timestamp = get_time_in_ms(&ts);
+ uint64_t session_id = 0;
+ uint8_t new_rec = 0;
+ const struct ieee80211_mgmt *mgmt = req->mgmt_frame;
+ struct sta_info *sta = req->sta ? (void *)req->sta : ap_get_sta(hapd, mgmt->sa);
+ /* null pointer check */
+ if (!sta) return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
+
+ struct hostapd_bss_config *bss_conf = hapd->conf;
+ session_id = sta->cl_session_id;
+
+ /* find by session id */
+ rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl);
+
+ /* prepare rec if not found */
+ if (!rec) {
+ new_rec = 1;
+ rec = os_zalloc(sizeof(struct hostapd_event_avl_rec));
+ session_id = hash_fnv1a_64bit(&ts, sizeof(struct timespec));
+ }
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG,
+ "hostapd_ubus_handle_rt_event: REQ TYPE [%d]",
+ req->type);
+
+ switch (req->type) {
+ case HOSTAPD_UBUS_AUTH_REQ: {
+ /* session id */
+ rec->session_id = session_id;
+ rec->rec_nr++;
+ rec->records = os_realloc(rec->records,
+ sizeof(struct client_session_record) * rec->rec_nr);
+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
+ rp->type = CST_AUTH;
+ rp->u.auth.session_id = rec->session_id;
+
+ /* timestamp */
+ rp->timestamp = timestamp;
+ /* frequency */
+ rp->u.auth.band = hapd->iface->freq;
+ /* STA MAC */
+ sprintf(rp->u.auth.sta_mac, MACSTR, MAC2STR(sta->addr));
+ /* ssid */
+ rp->u.auth.ssid[0] = 0;
+ printf_encode(rp->u.auth.ssid, sizeof(rp->u.auth.ssid),
+ bss_conf->ssid.ssid, bss_conf->ssid.ssid_len);
+ /* auth status */
+ rp->u.auth.auth_status = le_to_host16(mgmt->u.auth.status_code);
+ hostapd_logger(
+ hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG,
+ "hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_AUTH_REQ");
+ /* inc counter */
+ cached_events_nr++;
+ break;
+ }
+ case HOSTAPD_UBUS_ASSOC_REQ: {
+ /* session id */
+ rec->session_id = session_id;
+ rec->rec_nr++;
+ rec->records = os_realloc(rec->records,
+ sizeof(struct client_session_record) * rec->rec_nr);
+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
+ rp->type = CST_ASSOC;
+ rp->u.assoc.session_id = rec->session_id;
+ /* timestamp */
+ rp->timestamp = timestamp;
+ /* frequency */
+ rp->u.assoc.band = hapd->iface->freq;
+ /* STA MAC */
+ sprintf(rp->u.assoc.sta_mac, MACSTR, MAC2STR(sta->addr));
+ /* ssid */
+ rp->u.assoc.ssid[0] = 0;
+ printf_encode(rp->u.assoc.ssid, sizeof(rp->u.assoc.ssid),
+ bss_conf->ssid.ssid, bss_conf->ssid.ssid_len);
+ /* rssi */
+ rp->u.assoc.rssi = req->ssi_signal;
+ /* using 11r */
+ rp->u.assoc.using11r = (sta->auth_alg & WPA_AUTH_ALG_FT);
+ /* using 11k */
+ if (sta->rrm_enabled_capa[0] || sta->rrm_enabled_capa[1] ||
+ sta->rrm_enabled_capa[2] || sta->rrm_enabled_capa[3] ||
+ sta->rrm_enabled_capa[4])
+ rp->u.assoc.using11k = 1;
+ else
+ rp->u.assoc.using11k = 0;
+ /* using 11v */
+ if (bss_conf->time_advertisement || bss_conf->wnm_sleep_mode ||
+ bss_conf->bss_transition)
+ rp->u.assoc.using11v = 1;
+ else
+ rp->u.assoc.using11v = 0;
+ hostapd_logger(
+ hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG,
+ "hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_ASSOC_REQ");
+ /* inc counter */
+ cached_events_nr++;
+ break;
+ }
+ case HOSTAPD_UBUS_DISASSOC_REQ: {
+ /* session id */
+ rec->session_id = session_id;
+ rec->rec_nr++;
+ rec->records = os_realloc(rec->records,
+ sizeof(struct client_session_record) * rec->rec_nr);
+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
+ rp->type = CST_DISASSOC;
+ rp->u.disassoc.session_id = rec->session_id;
+ /* timestamp */
+ rp->timestamp = timestamp;
+ /* frequency */
+ rp->u.disassoc.band = hapd->iface->freq;
+ /* STA MAC */
+ sprintf(rp->u.disassoc.sta_mac, MACSTR, MAC2STR(sta->addr));
+ /* ssid */
+ rp->u.disassoc.ssid[0] = 0;
+ printf_encode(rp->u.disassoc.ssid, sizeof(rp->u.disassoc.ssid),
+ bss_conf->ssid.ssid, bss_conf->ssid.ssid_len);
+ /* rssi */
+ rp->u.disassoc.rssi = req->ssi_signal;
+ /* internal_rc */
+ rp->u.disassoc.internal_rc = req->reason;
+ hostapd_logger(
+ hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG,
+ "hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_DISASSOC_REQ");
+ /* inc counter */
+ cached_events_nr++;
+ break;
+ }
+ case HOSTAPD_UBUS_FDATA_REQ: {
+ /* session id */
+ rec->session_id = session_id;
+ rec->rec_nr++;
+ rec->records = os_realloc(rec->records,
+ sizeof(struct client_session_record) * rec->rec_nr);
+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
+ rp->type = CST_FDATA;
+ rp->u.fdata.session_id = rec->session_id;
+ /* timestamp */
+ rp->timestamp = timestamp;
+ /* STA MAC */
+ sprintf(rp->u.fdata.sta_mac, MACSTR, MAC2STR(sta->addr));
+ /* rx ts */
+ rp->u.fdata.rx_ts = ts;
+ /* tx ts */
+ rp->u.fdata.tx_ts = ts;
+ /* single event only */
+ sta->fdata = 1;
+ hostapd_logger(
+ hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG,
+ "hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_FDATA_REQ");
+ /* inc counter */
+ cached_events_nr++;
+ break;
+ }
+ case HOSTAPD_UBUS_IP_REQ: {
+ if(sta->first_ip) break;
+ /* session id */
+ rec->session_id = session_id;
+ rec->rec_nr++;
+ rec->records = os_realloc(rec->records,
+ sizeof(struct client_session_record) * rec->rec_nr);
+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1];
+ rp->type = CST_IP;
+ rp->u.ip.session_id = rec->session_id;
+ /* timestamp */
+ rp->timestamp = timestamp;
+ /* STA MAC */
+ sprintf(rp->u.ip.sta_mac, MACSTR, MAC2STR(sta->addr));
+ /* ip address */
+ snprintf(rp->u.ip.ip_addr, 20, "%u.%u.%u.%u",
+ (req->ipaddr >> 24) & 0xFF,
+ (req->ipaddr >> 16) & 0xFF,
+ (req->ipaddr >> 8) & 0xFF,
+ req->ipaddr & 0xFF);
+ /* single event only */
+ sta->first_ip = 1;
+ /* inc counter */
+ cached_events_nr++;
+ break;
+ }
+ default:
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG,
+ "hostapd_ubus_handle_rt_event:UNKNOWN");
+ new_rec = 0;
+ break;
+ }
+ if (new_rec) {
+ /* insert new client session */
+ rec->avl.key = &rec->session_id;
+ sta->cl_session_id = session_id;
+ if (avl_insert(&hapd->ubus.rt_events, &rec->avl))
+ return WLAN_STATUS_UNSPECIFIED_FAILURE;
+ }
+
+ return WLAN_STATUS_SUCCESS;
+}
+
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
{
struct ubus_banned_client *ban;
--- a/src/ap/ubus.h
+++ b/src/ap/ubus.h
@@ -12,6 +12,11 @@ enum hostapd_ubus_event_type {
HOSTAPD_UBUS_PROBE_REQ,
HOSTAPD_UBUS_AUTH_REQ,
HOSTAPD_UBUS_ASSOC_REQ,
+ HOSTAPD_UBUS_REASSOC_REQ,
+ HOSTAPD_UBUS_DISASSOC_REQ,
+ HOSTAPD_UBUS_DEAUTH_REQ,
+ HOSTAPD_UBUS_FDATA_REQ,
+ HOSTAPD_UBUS_IP_REQ,
HOSTAPD_UBUS_TYPE_MAX
};
@@ -19,8 +24,11 @@ struct hostapd_ubus_request {
enum hostapd_ubus_event_type type;
const struct ieee80211_mgmt *mgmt_frame;
const struct ieee802_11_elems *elems;
+ const struct sta_info *sta;
int ssi_signal; /* dBm */
+ int reason;
const u8 *addr;
+ be32 ipaddr;
};
struct hostapd_iface;
@@ -37,6 +45,80 @@ struct hostapd_ubus_bss {
struct ubus_object obj;
struct avl_tree banned;
int notify_response;
+ struct avl_tree rt_events;
+};
+
+enum client_sess_type {
+ CST_ASSOC,
+ CST_AUTH,
+ CST_DISASSOC,
+ CST_FDATA,
+ CST_IP
+};
+
+struct client_assoc_event {
+ unsigned char sta_mac[20];
+ uint64_t session_id;
+ char ssid[SSID_MAX_LEN];
+ int band;
+ int assoc_type;
+ int status;
+ int rssi;
+ int internal_sc;
+ uint8_t using11k;
+ uint8_t using11r;
+ uint8_t using11v;
+};
+
+struct client_disassoc_event {
+ unsigned char sta_mac[20];
+ uint64_t session_id;
+ char ssid[SSID_MAX_LEN];
+ int band;
+ int assoc_type;
+ int status;
+ int rssi;
+ int internal_rc;
+};
+
+struct client_auth_event {
+ unsigned char sta_mac[20];
+ uint64_t session_id;
+ char ssid[SSID_MAX_LEN];
+ int band;
+ uint32_t auth_status;
+};
+
+struct client_fdata_event {
+ unsigned char sta_mac[20];
+ uint64_t session_id;
+ struct timespec rx_ts;
+ struct timespec tx_ts;
+};
+
+struct client_ip_event {
+ unsigned char sta_mac[20];
+ uint64_t session_id;
+ unsigned char ip_addr[16];
+};
+
+struct client_session_record {
+ int type;
+ uint64_t timestamp;
+ union {
+ struct client_assoc_event assoc;
+ struct client_disassoc_event disassoc;
+ struct client_auth_event auth;
+ struct client_fdata_event fdata;
+ struct client_ip_event ip;
+ } u;
+};
+
+struct hostapd_event_avl_rec {
+ uint64_t session_id;
+ struct client_session_record *records;
+ size_t rec_nr;
+ struct avl_node avl;
};
void hostapd_ubus_add_iface(struct hostapd_iface *iface);
@@ -45,6 +127,7 @@ void hostapd_ubus_add_bss(struct hostapd
void hostapd_ubus_free_bss(struct hostapd_data *hapd);
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
+int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
const u8 *addr, u8 token, u8 rep_mode,
@@ -78,6 +161,11 @@ static inline int hostapd_ubus_handle_ev
{
return 0;
}
+
+static inline int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
+{
+ return 0;
+}
static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac)
{
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1406,19 +1406,22 @@ static int hostapd_setup_bss(struct host
"Generic snooping infrastructure initialization failed");
return -1;
}
-
- if (dhcp_snoop_init(hapd)) {
- wpa_printf(MSG_ERROR,
- "DHCP snooping initialization failed");
- return -1;
- }
-
if (ndisc_snoop_init(hapd)) {
wpa_printf(MSG_ERROR,
"Neighbor Discovery snooping initialization failed");
return -1;
}
}
+ if (dhcp_snoop_init(hapd)) {
+ wpa_printf(MSG_ERROR,
+ "DHCP snooping initialization failed");
+ hostapd_logger(
+ hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG,
+ "dfranusic:DHCP snooping initialization failed");
+
+ return -1;
+ }
if (!hostapd_drv_none(hapd) && vlan_init(hapd)) {
wpa_printf(MSG_ERROR, "VLAN initialization failed.");
--- a/src/ap/dhcp_snoop.c
+++ b/src/ap/dhcp_snoop.c
@@ -40,6 +40,7 @@ static void handle_dhcp(void *ctx, const
int res, msgtype = 0, prefixlen = 32;
u32 subnet_mask = 0;
u16 ip_len;
+ int ubus_resp;
exten_len = len - ETH_HLEN - (sizeof(*b) - sizeof(b->exten));
if (exten_len < 4)
@@ -112,6 +113,19 @@ static void handle_dhcp(void *ctx, const
ipaddr_str(be_to_host32(b->your_ip)),
prefixlen);
+ struct hostapd_ubus_request req = {
+ .type = HOSTAPD_UBUS_IP_REQ,
+ .sta = sta,
+ .ipaddr = be_to_host32(b->your_ip)
+ };
+ ubus_resp = hostapd_ubus_handle_rt_event(hapd, &req);
+ if (ubus_resp) {
+ hostapd_logger(
+ hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_DEBUG,
+ "hostapd_ubus_handle_rt_event: ERROR");
+ }
+
if (sta->ipaddr == b->your_ip)
return;

View File

@@ -1,100 +0,0 @@
Index: hostapd-2020-06-08-5a8b3662/hostapd/config_file.c
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/hostapd/config_file.c
+++ hostapd-2020-06-08-5a8b3662/hostapd/config_file.c
@@ -2909,6 +2909,11 @@ static int hostapd_config_fill(struct ho
line);
return 1;
}
+ } else if (os_strcmp(buf, "global_max_num_sta") == 0) {
+ conf->global_max_num_sta = atoi(pos);
+ if (conf->global_max_num_sta < 0 ||
+ conf->global_max_num_sta > MAX_STA_COUNT)
+ conf->global_max_num_sta = MAX_STA_COUNT;
} else if (os_strcmp(buf, "max_num_sta") == 0) {
bss->max_num_sta = atoi(pos);
if (bss->max_num_sta < 0 ||
Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.c
+++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c
@@ -228,6 +228,8 @@ struct hostapd_config * hostapd_config_d
conf->num_bss = 1;
+ conf->global_max_num_sta = 0;
+
conf->beacon_int = 100;
conf->rts_threshold = -2; /* use driver default: 2347 */
conf->fragm_threshold = -2; /* user driver default: 2346 */
Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.h
+++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h
@@ -1069,6 +1069,7 @@ struct hostapd_config {
#define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1)
#endif /* CONFIG_AIRTIME_POLICY */
char *config_id;
+ int global_max_num_sta;
};
Index: hostapd-2020-06-08-5a8b3662/src/ap/beacon.c
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/beacon.c
+++ hostapd-2020-06-08-5a8b3662/src/ap/beacon.c
@@ -1030,7 +1030,8 @@ void handle_probe_req(struct hostapd_dat
if (hapd->conf->no_probe_resp_if_max_sta &&
is_multicast_ether_addr(mgmt->da) &&
is_multicast_ether_addr(mgmt->bssid) &&
- hapd->num_sta >= hapd->conf->max_num_sta &&
+ hapd_check_max_sta(hapd) &&
+// hapd->num_sta >= hapd->conf->max_num_sta &&
!ap_get_sta(hapd, mgmt->sa)) {
wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR
" since no room for additional STA",
Index: hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/sta_info.c
+++ hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c
@@ -705,7 +705,8 @@ struct sta_info * ap_sta_add(struct host
return sta;
wpa_printf(MSG_DEBUG, " New STA");
- if (hapd->num_sta >= hapd->conf->max_num_sta) {
+ if (hapd_check_max_sta(hapd)) {
+// if (hapd->num_sta >= hapd->conf->max_num_sta) {
/* FIX: might try to remove some old STAs first? */
wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
hapd->num_sta, hapd->conf->max_num_sta);
Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.c
+++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c
@@ -3779,3 +3779,15 @@ void hostapd_ocv_check_csa_sa_query(void
}
}
#endif /* CONFIG_OCV */
+
+int hapd_check_max_sta(struct hostapd_data *hapd)
+{
+ int cnt = 0, i;
+
+ if (!hapd->iconf->global_max_num_sta)
+ return hapd->num_sta >= hapd->conf->max_num_sta;
+
+ for (i = 0; i < hapd->iface->num_bss; i++)
+ cnt += hapd->iface->bss[i]->num_sta;
+ return cnt >= hapd->iconf->global_max_num_sta;
+}
Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h
===================================================================
--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.h
+++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h
@@ -693,4 +693,6 @@ void fst_hostapd_fill_iface_obj(struct h
struct fst_wpa_obj *iface_obj);
#endif /* CONFIG_FST */
+int hapd_check_max_sta(struct hostapd_data *hapd);
+
#endif /* HOSTAPD_H */

View File

@@ -490,6 +490,8 @@ 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;
int ret = UBUS_STATUS_OK;
int i;
blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg));
@@ -514,10 +516,14 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool);
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
for (i = 0; i < hapd->iface->num_bss; i++) {
struct hostapd_data *bss = hapd->iface->bss[i];
if (hostapd_switch_channel(hapd, &css) != 0)
return UBUS_STATUS_NOT_SUPPORTED;
return UBUS_STATUS_OK;
if (hostapd_switch_channel(bss, &css) != 0)
ret = UBUS_STATUS_NOT_SUPPORTED;
}
return ret;
#undef SET_CSA_SETTING
}
#endif
@@ -1104,6 +1110,43 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd)
free(name);
}
static void
hostapd_ubus_vlan_action(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
const char *action)
{
struct vlan_description *desc = &vlan->vlan_desc;
void *c;
int i;
if (!hapd->ubus.obj.has_subscribers)
return;
blob_buf_init(&b, 0);
blobmsg_add_string(&b, "ifname", vlan->ifname);
blobmsg_add_string(&b, "bridge", vlan->bridge);
blobmsg_add_u32(&b, "vlan_id", vlan->vlan_id);
if (desc->notempty) {
blobmsg_add_u32(&b, "untagged", desc->untagged);
c = blobmsg_open_array(&b, "tagged");
for (i = 0; i < ARRAY_SIZE(desc->tagged) && desc->tagged[i]; i++)
blobmsg_add_u32(&b, "", desc->tagged[i]);
blobmsg_close_array(&b, c);
}
ubus_notify(ctx, &hapd->ubus.obj, action, b.head, -1);
}
void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
{
hostapd_ubus_vlan_action(hapd, vlan, "vlan_add");
}
void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
{
hostapd_ubus_vlan_action(hapd, vlan, "vlan_remove");
}
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),
@@ -1290,3 +1333,24 @@ void hostapd_ubus_notify_beacon_report(
ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1);
}
void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency,
int chan_width, int cf1, int cf2)
{
struct hostapd_data *hapd;
int i;
if (!hapd->ubus.obj.has_subscribers)
return;
blob_buf_init(&b, 0);
blobmsg_add_u16(&b, "frequency", frequency);
blobmsg_add_u16(&b, "width", chan_width);
blobmsg_add_u16(&b, "center1", cf1);
blobmsg_add_u16(&b, "center2", cf2);
for (i = 0; i < iface->num_bss; i++) {
hapd = iface->bss[i];
ubus_notify(ctx, &hapd->ubus.obj, "radar-detected", b.head, -1);
}
}

View File

@@ -43,6 +43,8 @@ void hostapd_ubus_add_iface(struct hostapd_iface *iface);
void hostapd_ubus_free_iface(struct hostapd_iface *iface);
void hostapd_ubus_add_bss(struct hostapd_data *hapd);
void hostapd_ubus_free_bss(struct hostapd_data *hapd);
void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan);
void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan);
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
@@ -50,6 +52,8 @@ void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
const u8 *addr, u8 token, u8 rep_mode,
struct rrm_measurement_beacon_report *rep,
size_t len);
void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency,
int chan_width, int cf1, int cf2);
void hostapd_ubus_add(struct hapd_interfaces *interfaces);
void hostapd_ubus_free(struct hapd_interfaces *interfaces);
@@ -74,6 +78,14 @@ static inline void hostapd_ubus_free_bss(struct hostapd_data *hapd)
{
}
static inline void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
{
}
static inline void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
{
}
static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
{
return 0;
@@ -90,6 +102,10 @@ static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
size_t len)
{
}
static inline void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency,
int chan_width, int cf1, int cf2)
{
}
static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces)
{

View File

@@ -1,72 +0,0 @@
#
# Copyright (C) 2007-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=iw
PKG_VERSION:=5.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/software/network/iw
PKG_HASH:=a2469f677088d7b1070a7fbb28f3c747041697e8f6ec70783339cb1bc27a395f
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
define Package/iw
SECTION:=net
CATEGORY:=Network
TITLE:=cfg80211 interface configuration utility
URL:=http://wireless.kernel.org/en/users/Documentation/iw
DEPENDS:= +libnl-tiny
VARIANT:=tiny
endef
define Package/iw-full
$(Package/iw)
TITLE += (full version)
VARIANT:=full
PROVIDES:=iw
endef
define Build/Configure
echo "const char iw_version[] = \"$(PKG_VERSION)\";" > $(PKG_BUILD_DIR)/version.c
echo "#!/bin/sh" > $(PKG_BUILD_DIR)/version.sh
chmod +x $(PKG_BUILD_DIR)/version.sh
endef
TARGET_CPPFLAGS:= \
-I$(STAGING_DIR)/usr/include/libnl-tiny \
$(TARGET_CPPFLAGS) \
-DCONFIG_LIBNL20 \
-D_GNU_SOURCE
ifeq ($(BUILD_VARIANT),full)
TARGET_CPPFLAGS += -DIW_FULL
MAKE_FLAGS += IW_FULL=1
endif
MAKE_FLAGS += \
CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \
LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
NL1FOUND="" NL2FOUND=Y \
NLLIBNAME="libnl-tiny" \
LIBS="-lm -lnl-tiny" \
V=1
define Package/iw/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iw $(1)/usr/sbin/
endef
Package/iw-full/install=$(Package/iw/install)
$(eval $(call BuildPackage,iw))
$(eval $(call BuildPackage,iw-full))

View File

@@ -1,21 +0,0 @@
--- a/nl80211.h
+++ b/nl80211.h
@@ -2361,6 +2361,9 @@ enum nl80211_commands {
* @NL80211_ATTR_HE_OBSS_PD: nested attribute for OBSS Packet Detection
* functionality.
*
+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
+ * transmit power to stay within regulatory limits. u32, dBi.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2820,6 +2823,8 @@ enum nl80211_attrs {
NL80211_ATTR_HE_OBSS_PD,
+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,

View File

@@ -1,36 +0,0 @@
--- a/phy.c
+++ b/phy.c
@@ -740,6 +740,33 @@ COMMAND(set, antenna, "<bitmap> | all |
"Set a bitmap of allowed antennas to use for TX and RX.\n"
"The driver may reject antenna configurations it cannot support.");
+static int handle_antenna_gain(struct nl80211_state *state,
+ struct nl_msg *msg,
+ int argc, char **argv,
+ enum id_input id)
+{
+ char *endptr;
+ int dbm;
+
+ /* get the required args */
+ if (argc != 1)
+ return 1;
+
+ dbm = strtol(argv[0], &endptr, 10);
+ if (*endptr)
+ return 2;
+
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm);
+
+ return 0;
+
+ nla_put_failure:
+ return -ENOBUFS;
+}
+COMMAND(set, antenna_gain, "<antenna gain in dBm>",
+ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain,
+ "Specify antenna gain.");
+
static int handle_set_txq(struct nl80211_state *state,
struct nl_msg *msg,
int argc, char **argv,

View File

@@ -1,454 +0,0 @@
--- a/event.c
+++ b/event.c
@@ -42,6 +42,7 @@ static int parse_beacon_hint_chan(struct
return 0;
}
+#ifdef IW_FULL
static void print_frame(struct print_event_args *args, struct nlattr *attr)
{
uint8_t *frame;
@@ -292,7 +293,7 @@ static void parse_wowlan_wake_event(stru
if (tb[NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS])
printf("\t* TCP connection ran out of tokens\n");
}
-
+#endif
static void parse_nan_term(struct nlattr **attrs)
{
struct nlattr *func[NL80211_NAN_FUNC_ATTR_MAX + 1];
@@ -653,15 +654,18 @@ static void parse_nan_match(struct nlatt
static int print_event(struct nl_msg *msg, void *arg)
{
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
- struct nlattr *tb[NL80211_ATTR_MAX + 1], *nst;
+ struct nlattr *tb[NL80211_ATTR_MAX + 1];
struct print_event_args *args = arg;
char ifname[100];
char macbuf[6*3];
__u8 reg_type;
struct ieee80211_beacon_channel chan_before_beacon, chan_after_beacon;
__u32 wiphy_idx = 0;
+#ifdef IW_FULL
+ struct nlattr *nst;
int rem_nst;
__u16 status;
+#endif
if (args->time || args->reltime) {
unsigned long long usecs, previous;
@@ -699,6 +703,7 @@ static int print_event(struct nl_msg *ms
}
switch (gnlh->cmd) {
+#ifdef IW_FULL
case NL80211_CMD_NEW_WIPHY:
printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
break;
@@ -734,6 +739,7 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_SCHED_SCAN_RESULTS:
printf("got scheduled scan results\n");
break;
+#endif
case NL80211_CMD_REG_CHANGE:
printf("regulatory domain change: ");
@@ -812,6 +818,7 @@ static int print_event(struct nl_msg *ms
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("del station %s\n", macbuf);
break;
+#ifdef IW_FULL
case NL80211_CMD_JOIN_IBSS:
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("IBSS %s joined\n", macbuf);
@@ -976,6 +983,7 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_DEL_WIPHY:
printf("delete wiphy\n");
break;
+#endif
case NL80211_CMD_PEER_MEASUREMENT_RESULT:
parse_pmsr_result(tb, args);
break;
@@ -990,8 +998,7 @@ static int print_event(struct nl_msg *ms
break;
}
default:
- printf("unknown event %d (%s)\n",
- gnlh->cmd, command_name(gnlh->cmd));
+ printf("unknown event %d\n", gnlh->cmd);
break;
}
--- a/info.c
+++ b/info.c
@@ -19,6 +19,7 @@ static void print_flag(const char *name,
*open = 1;
}
+#ifdef IW_FULL
static char *cipher_name(__u32 c)
{
static char buf[20];
@@ -56,6 +57,7 @@ static char *cipher_name(__u32 c)
return buf;
}
}
+#endif
static int ext_feature_isset(const unsigned char *ext_features, int ext_features_len,
enum nl80211_ext_feature_index ftidx)
@@ -95,20 +97,21 @@ static int print_phy_handler(struct nl_m
[NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
};
-
+#ifdef IW_FULL
struct nlattr *tb_rate[NL80211_BITRATE_ATTR_MAX + 1];
static struct nla_policy rate_policy[NL80211_BITRATE_ATTR_MAX + 1] = {
[NL80211_BITRATE_ATTR_RATE] = { .type = NLA_U32 },
[NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE] = { .type = NLA_FLAG },
};
-
- struct nlattr *nl_band;
- struct nlattr *nl_freq;
struct nlattr *nl_rate;
- struct nlattr *nl_mode;
struct nlattr *nl_cmd;
struct nlattr *nl_if, *nl_ftype;
- int rem_band, rem_freq, rem_rate, rem_mode, rem_cmd, rem_ftype, rem_if;
+ int rem_rate, rem_cmd, rem_ftype, rem_if;
+#endif
+ struct nlattr *nl_band;
+ struct nlattr *nl_freq;
+ struct nlattr *nl_mode;
+ int rem_band, rem_freq, rem_mode;
int open;
/*
* static variables only work here, other applications need to use the
@@ -213,6 +216,7 @@ next:
}
}
+#ifdef IW_FULL
if (tb_band[NL80211_BAND_ATTR_RATES]) {
printf("\t\tBitrates (non-HT):\n");
nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
@@ -229,6 +233,7 @@ next:
printf("\n");
}
}
+#endif
}
}
@@ -294,6 +299,7 @@ next:
printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
}
+#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
int i;
@@ -305,6 +311,7 @@ next:
cipher_name(ciphers[i]));
}
}
+#endif
if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
@@ -324,11 +331,13 @@ next:
printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
}
+#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) {
printf("\tsoftware interface modes (can always be added):\n");
nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode)
printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
}
+#endif
if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
struct nlattr *nl_combi;
@@ -425,6 +434,7 @@ broken_combination:
printf("\tinterface combinations are not supported\n");
}
+#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
printf("\tSupported commands:\n");
nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
@@ -522,6 +532,7 @@ broken_combination:
printf("\t\t * wake up on TCP connection\n");
}
}
+#endif
if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
printf("\tDevice supports roaming.\n");
@@ -560,6 +571,7 @@ broken_combination:
}
}
+#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
@@ -627,6 +639,10 @@ broken_combination:
if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
printf("\tDevice supports T-DLS.\n");
+ if (features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH)
+ printf("\tDevice supports TDLS channel switching\n");
+ }
+#endif
if (tb_msg[NL80211_ATTR_EXT_FEATURES]) {
struct nlattr *tb = tb_msg[NL80211_ATTR_EXT_FEATURES];
@@ -732,6 +748,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
"List all wireless devices and their capabilities.");
TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
+#ifdef IW_FULL
static int handle_commands(struct nl80211_state *state, struct nl_msg *msg,
int argc, char **argv, enum id_input id)
{
@@ -743,6 +760,7 @@ static int handle_commands(struct nl8021
}
TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
"list all known commands and their decimal & hex value");
+#endif
static int print_feature_handler(struct nl_msg *msg, void *arg)
{
--- a/scan.c
+++ b/scan.c
@@ -559,6 +559,7 @@ static void print_ssid(const uint8_t typ
#define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126
#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
+#ifdef IW_FULL
static void print_supprates(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -676,6 +677,7 @@ static void print_erp(const uint8_t type
printf(" Barker_Preamble_Mode");
printf("\n");
}
+#endif
static void print_cipher(const uint8_t *data)
{
@@ -993,12 +995,14 @@ static void print_rsn_ie(const char *def
_print_rsn_ie(defcipher, defauth, len, data, 0);
}
+#ifdef IW_FULL
static void print_osen_ie(const char *defcipher, const char *defauth,
uint8_t len, const uint8_t *data)
{
printf("\n\t");
_print_rsn_ie(defcipher, defauth, len, data, 1);
}
+#endif
static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1016,6 +1020,7 @@ static void print_ht_capa(const uint8_t
print_ht_mcs(data + 3);
}
+#ifdef IW_FULL
static const char* ntype_11u(uint8_t t)
{
switch (t) {
@@ -1168,6 +1173,7 @@ static void print_11u_rcon(const uint8_t
}
}
}
+#endif
static const char *ht_secondary_offset[4] = {
"no secondary",
@@ -1195,6 +1201,7 @@ static void print_ht_op(const uint8_t ty
printf("\t\t * secondary channel offset: %s\n",
ht_secondary_offset[data[1] & 0x3]);
printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
+ return;
printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
@@ -1207,6 +1214,7 @@ static void print_ht_op(const uint8_t ty
printf("\t\t * PCO phase: %d\n", (data[5] & 0x8) >> 3);
}
+#ifdef IW_FULL
static void print_capabilities(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1384,6 +1392,7 @@ static void print_ibssatim(const uint8_t
{
printf(" %d TUs\n", (data[1] << 8) + data[0]);
}
+#endif
static void print_vht_capa(const uint8_t type, uint8_t len, const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1412,6 +1421,7 @@ static void print_vht_oper(const uint8_t
printf("\t\t * VHT basic MCS set: 0x%.2x%.2x\n", data[4], data[3]);
}
+#ifdef IW_FULL
static void print_obss_scan_params(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1426,6 +1436,7 @@ static void print_obss_scan_params(const
printf("\t\t * OBSS Scan Activity Threshold: %d.%02d %%\n",
((data[13] << 8) | data[12]) / 100, ((data[13] << 8) | data[12]) % 100);
}
+#endif
static void print_secchan_offs(const uint8_t type, uint8_t len,
const uint8_t *data,
@@ -1437,6 +1448,7 @@ static void print_secchan_offs(const uin
printf(" %d\n", data[0]);
}
+#ifdef IW_FULL
static void print_bss_load(const uint8_t type, uint8_t len, const uint8_t *data,
const struct print_ies_data *ie_buffer)
{
@@ -1478,6 +1490,7 @@ static void print_mesh_conf(const uint8_
if (data[6] & 0x40)
printf("\t\t\t Mesh Power Save Level\n");
}
+#endif
struct ie_print {
const char *name;
@@ -1522,6 +1535,13 @@ static void print_ie(const struct ie_pri
static const struct ie_print ieprinters[] = {
[0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
+ [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
+ [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
+ [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
+ [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
+ [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
+ [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
+#ifdef IW_FULL
[1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
[3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
[5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
@@ -1531,14 +1551,8 @@ static const struct ie_print ieprinters[
[32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
[35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
[42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
- [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
[47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
[74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
- [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
- [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
- [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
- [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
- [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
[50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
[113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
[114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
@@ -1546,8 +1560,10 @@ static const struct ie_print ieprinters[
[107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
[108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
[111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
+#endif
};
+#ifdef IW_FULL
static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
const struct print_ies_data *ie_buffer)
{
@@ -1822,6 +1838,7 @@ static const struct ie_print wifiprinter
[2] = { "WMM", print_wifi_wmm, 1, 255, BIT(PRINT_SCAN), },
[4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), },
};
+#endif
static inline void print_p2p(const uint8_t type, uint8_t len,
const uint8_t *data,
@@ -1917,6 +1934,7 @@ static inline void print_hs20_ind(const
printf("\t\tUnexpected length: %i\n", len);
}
+#ifdef IW_FULL
static void print_wifi_owe_tarns(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -2010,6 +2028,7 @@ static void print_vendor(unsigned char l
printf(" %.2x", data[i]);
printf("\n");
}
+#endif
void print_ies(unsigned char *ie, int ielen, bool unknown,
enum print_ie_type ptype)
@@ -2024,6 +2043,7 @@ void print_ies(unsigned char *ie, int ie
ieprinters[ie[0]].flags & BIT(ptype)) {
print_ie(&ieprinters[ie[0]],
ie[0], ie[1], ie + 2, &ie_buffer);
+#ifdef IW_FULL
} else if (ie[0] == 221 /* vendor */) {
print_vendor(ie[1], ie + 2, unknown, ptype);
} else if (unknown) {
@@ -2033,6 +2053,7 @@ void print_ies(unsigned char *ie, int ie
for (i=0; i<ie[1]; i++)
printf(" %.2x", ie[2+i]);
printf("\n");
+#endif
}
ielen -= ie[1] + 2;
ie += ie[1] + 2;
@@ -2073,6 +2094,7 @@ static void print_capa_non_dmg(__u16 cap
printf(" ESS");
if (capa & WLAN_CAPABILITY_IBSS)
printf(" IBSS");
+#ifdef IW_FULL
if (capa & WLAN_CAPABILITY_CF_POLLABLE)
printf(" CfPollable");
if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
@@ -2101,6 +2123,7 @@ static void print_capa_non_dmg(__u16 cap
printf(" DelayedBACK");
if (capa & WLAN_CAPABILITY_IMM_BACK)
printf(" ImmediateBACK");
+#endif
}
static int print_bss_handler(struct nl_msg *msg, void *arg)
@@ -2185,8 +2208,10 @@ static int print_bss_handler(struct nl_m
if (bss[NL80211_BSS_FREQUENCY]) {
int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
printf("\tfreq: %d\n", freq);
+#ifdef IW_FULL
if (freq > 45000)
is_dmg = true;
+#endif
}
if (bss[NL80211_BSS_BEACON_INTERVAL])
printf("\tbeacon interval: %d TUs\n",
--- a/util.c
+++ b/util.c
@@ -147,6 +147,7 @@ const char *iftype_name(enum nl80211_ift
return modebuf;
}
+#ifdef IW_FULL
static const char *commands[NL80211_CMD_MAX + 1] = {
#include "nl80211-commands.inc"
};
@@ -160,6 +161,7 @@ const char *command_name(enum nl80211_co
sprintf(cmdbuf, "Unknown command (%d)", cmd);
return cmdbuf;
}
+#endif
int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
{

View File

@@ -1,40 +0,0 @@
Add channel attribure support for nl80211 message
---
info.c | 9 +++++++--
nl80211.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
--- a/info.c
+++ b/info.c
@@ -180,13 +180,18 @@ static int print_phy_handler(struct nl_m
band_had_freq = true;
}
nla_for_each_nested(nl_freq, tb_band[NL80211_BAND_ATTR_FREQS], rem_freq) {
- uint32_t freq;
+ uint32_t freq,channel;
nla_parse(tb_freq, NL80211_FREQUENCY_ATTR_MAX, nla_data(nl_freq),
nla_len(nl_freq), freq_policy);
if (!tb_freq[NL80211_FREQUENCY_ATTR_FREQ])
continue;
freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
- printf("\t\t\t* %d MHz [%d]", freq, ieee80211_frequency_to_channel(freq));
+ if (tb_freq[NL80211_FREQUENCY_ATTR_CHANNEL])
+ channel = nla_get_u16(tb_freq[NL80211_FREQUENCY_ATTR_CHANNEL]);
+ else
+ channel = ieee80211_frequency_to_channel(freq);
+ printf("\t\t\t* %d MHz [%d]", freq, channel);
+
if (tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] &&
!tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
--- a/nl80211.h
+++ b/nl80211.h
@@ -3561,6 +3561,7 @@ enum nl80211_frequency_attr {
NL80211_FREQUENCY_ATTR_NO_20MHZ,
NL80211_FREQUENCY_ATTR_NO_10MHZ,
NL80211_FREQUENCY_ATTR_WMM,
+ NL80211_FREQUENCY_ATTR_CHANNEL,
/* keep last */
__NL80211_FREQUENCY_ATTR_AFTER_LAST,

View File

@@ -1,200 +0,0 @@
--- a/interface.c
+++ b/interface.c
@@ -727,3 +727,78 @@ COMMAND(switch, freq,
"Switch the operating channel by sending a channel switch announcement (CSA).");
COMMAND(switch, channel, "<channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]",
NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL);
+
+static int handle_retry_count(struct nl80211_state *state,
+ struct nl_msg *msg,
+ int argc, char **argv,
+ enum id_input id)
+{
+ struct nl_msg *tid = NULL;
+ unsigned char mac_addr[ETH_ALEN];
+ uint8_t retry_short, retry_long, tid_no;
+ char *end;
+ int ret = -ENOSPC;
+
+ if (argc < 4)
+ return 1;
+
+ tid = nlmsg_alloc();
+ if (!tid)
+ return -ENOMEM;
+
+ while (argc) {
+ if (strcmp(argv[0], "tid") == 0) {
+ if (argc < 2)
+ return 1;
+
+ tid_no = strtoul(argv[1], &end, 8);
+ if (*end)
+ return 1;
+
+ NLA_PUT_U8(tid, NL80211_ATTR_TID, tid_no);
+ } else if (strcmp(argv[0], "peer") == 0) {
+ if (argc < 2)
+ return 1;
+
+ if (mac_addr_a2n(mac_addr, argv[1])) {
+ fprintf(stderr, "invalid mac address\n");
+ return 2;
+ }
+
+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+ } else if (strcmp(argv[0], "short") == 0) {
+ if (argc < 2)
+ return 1;
+
+ retry_short = strtoul(argv[1], &end, 0);
+ if (*end)
+ return 1;
+
+ NLA_PUT_U8(tid, NL80211_ATTR_TID_RETRY_SHORT, retry_short);
+ } else if (strcmp(argv[0], "long") == 0) {
+ if (argc < 2)
+ return 1;
+ retry_long = strtoul(argv[1], &end, 0);
+ if (*end)
+ return 1;
+
+ NLA_PUT_U8(tid, NL80211_ATTR_TID_RETRY_LONG, retry_long);
+ } else {
+ return 1;
+ }
+ argc -= 2;
+ argv += 2;
+ }
+
+ NLA_PUT_FLAG(tid, NL80211_ATTR_TID_RETRY_CONFIG);
+ nla_put_nested(msg, NL80211_ATTR_TID_CONFIG, tid);
+
+ ret = 0;
+
+nla_put_failure:
+ nlmsg_free(tid);
+ return ret;
+}
+COMMAND(set, tid_retry_count, "tid <tid> <[peer <MAC address>] short <limit> long <limit>]>",
+ NL80211_CMD_SET_TID_CONFIG, 0, CIB_NETDEV, handle_retry_count,
+ "Set the retry count for the TIDs ");
--- a/nl80211.h
+++ b/nl80211.h
@@ -1101,6 +1101,10 @@
* peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
* content. The frame is ethernet data.
*
+ * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration
+ * is passed through this command using %NL80211_ATTR_TID_CONFIG
+ * nested attributes.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1325,6 +1329,8 @@ enum nl80211_commands {
NL80211_CMD_PROBE_MESH_LINK,
+ NL80211_CMD_SET_TID_CONFIG,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -2367,15 +2373,23 @@ enum nl80211_commands {
* functionality.
*
* @NL80211_ATTR_WIPHY_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz
- * channel(s) that are allowed to be used for EDMG transmissions.
- * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. (u8 attribute)
+ * channel(s) that are allowed to be used for EDMG transmissions.
+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. (u8 attribute)
* @NL80211_ATTR_WIPHY_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes
- * the allowed channel bandwidth configurations. (u8 attribute)
- * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
+ * the allowed channel bandwidth configurations. (u8 attribute)
+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
+ *
+ * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key
+ * (u16).
*
* @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
* transmit power to stay within regulatory limits. u32, dBi.
*
+ * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
+ * nested attribute with %NL80211_ATTR_TID_* sub-attributes.
+ * @NL80211_ATTR_MAX_RETRY_COUNT: The upper limit for the retry count
+ * configuration that the driver can accept.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2838,6 +2852,11 @@ enum nl80211_attrs {
NL80211_ATTR_WIPHY_EDMG_CHANNELS,
NL80211_ATTR_WIPHY_EDMG_BW_CONFIG,
+ NL80211_ATTR_VLAN_ID,
+
+ NL80211_ATTR_TID_CONFIG,
+ NL80211_ATTR_MAX_RETRY_COUNT,
+
NL80211_ATTR_WIPHY_ANTENNA_GAIN,
/* add attributes here, update the policy in nl80211.c */
@@ -4601,7 +4620,55 @@ enum nl80211_ps_state {
NL80211_PS_DISABLED,
NL80211_PS_ENABLED,
};
-
+/*
+ * @NL80211_ATTR_TID: a TID value (u8 attribute)
+ * @NL80211_ATTR_TID_RETRY_CONFIG: Data frame retry count should be
+ * applied with the value passed through %NL80211_ATTR_RETRY_LONG
+ * and/or %NL80211_ATTR_RETRY_SHORT. This configuration is per-TID,
+ * TID is specified with %NL80211_ATTR_TID. If the peer MAC address
+ * is passed in %NL80211_ATTR_MAC, the retry configuration is applied
+ * to the data frame for the tid to that connected station.
+ * This attribute will be useful to notfiy the driver to apply default
+ * retry values for the connected station (%NL80211_ATTR_MAC), when the
+ * command received without %NL80211_ATTR_RETRY_LONG and/or
+ * %NL80211_ATTR_RETRY_SHORT.
+ * Station specific retry configuration is valid only for STA's
+ * current connection. i.e. the configuration will be reset to default when
+ * the station connects back after disconnection/roaming.
+ * when user-space does not include %NL80211_ATTR_MAC, this configuration
+ * should be treated as per-netdev configuration. This configuration will
+ * be cleared when the interface goes down and on the disconnection from a
+ * BSS. When retry count has never been configured using this command, the
+ * other available radio level retry configuration
+ * (%NL80211_ATTR_WIPHY_RETRY_SHORT and %NL80211_ATTR_WIPHY_RETRY_LONG)
+ * should be used. Driver supporting this feature should advertise
+ * NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG and supporting per station
+ * retry count configuration should advertise
+ * NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG.
+ * @NL80211_ATTR_TID_RETRY_SHORT: Number of retries used with data frame
+ * transmission, user-space sets this configuration in
+ * &NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and
+ * the max value should be advertised by the driver through
+ * max_data_retry_count. when this attribute is not present, the driver
+ * would use the default configuration.
+ * @NL80211_ATTR_TID_RETRY_LONG: Number of retries used with data frame
+ * transmission, user-space sets this configuration in
+ * &NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and
+ * the max value should be advertised by the driver through
+ * max_data_retry_count. when this attribute is not present, the driver
+ * would use the default configuration.
+ */
+enum nl80211_attr_tid_config {
+ __NL80211_ATTR_TID_INVALID,
+ NL80211_ATTR_TID,
+ NL80211_ATTR_TID_RETRY_CONFIG,
+ NL80211_ATTR_TID_RETRY_SHORT,
+ NL80211_ATTR_TID_RETRY_LONG,
+
+ /* keep last */
+ __NL80211_ATTR_TID_AFTER_LAST,
+ NL80211_ATTR_TID_MAX = __NL80211_ATTR_TID_AFTER_LAST - 1
+};
/**
* enum nl80211_attr_cqm - connection quality monitor attributes
* @__NL80211_ATTR_CQM_INVALID: invalid

View File

@@ -1,114 +0,0 @@
--- a/interface.c
+++ b/interface.c
@@ -802,3 +802,68 @@ nla_put_failure:
COMMAND(set, tid_retry_count, "tid <tid> <[peer <MAC address>] short <limit> long <limit>]>",
NL80211_CMD_SET_TID_CONFIG, 0, CIB_NETDEV, handle_retry_count,
"Set the retry count for the TIDs ");
+
+static int handle_aggr_conf(struct nl80211_state *state,
+ struct nl_msg *msg,
+ int argc, char **argv,
+ enum id_input id)
+{
+ struct nl_msg *tid = NULL;
+ unsigned char mac_addr[ETH_ALEN];
+ uint8_t tid_no;
+ char *end;
+ int ret = -ENOSPC;
+
+ if (argc < 4)
+ return 1;
+
+ tid = nlmsg_alloc();
+ if (!tid)
+ return -ENOMEM;
+
+ while (argc) {
+ if (strcmp(argv[0], "tid") == 0) {
+ if (argc < 2)
+ return 1;
+
+ tid_no = strtoul(argv[1], &end, 8);
+ if (*end)
+ return 1;
+
+ NLA_PUT_U8(tid, NL80211_ATTR_TID, tid_no);
+ } else if (strcmp(argv[0], "peer") == 0) {
+ if (argc < 2)
+ return 1;
+
+ if (mac_addr_a2n(mac_addr, argv[1])) {
+ fprintf(stderr, "invalid mac address\n");
+ return 2;
+ }
+
+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+ } else if (strcmp(argv[0], "aggr") == 0) {
+ if (argc < 2)
+ return 1;
+ if (strcmp(argv[1], "on") == 0)
+ NLA_PUT_U8(tid, NL80211_ATTR_TID_AMPDU_AGGR_CTRL, 1);
+ else if (strcmp(argv[1], "off") == 0)
+ NLA_PUT_U8(tid, NL80211_ATTR_TID_AMPDU_AGGR_CTRL, 0);
+ else
+ return 1;
+ } else {
+ return 1;
+ }
+ argc -= 2;
+ argv += 2;
+ }
+
+ nla_put_nested(msg, NL80211_ATTR_TID_CONFIG, tid);
+ ret = 0;
+
+nla_put_failure:
+ nlmsg_free(tid);
+ return ret;
+}
+COMMAND(set, tid_aggr_conf, "tid <tid> <[peer <MAC address>] aggr on|off>",
+ NL80211_CMD_SET_TID_CONFIG, 0, CIB_NETDEV, handle_aggr_conf,
+ "Enable/disable aggregation for the TIDs ");
--- a/nl80211.h
+++ b/nl80211.h
@@ -4635,17 +4635,32 @@ enum nl80211_ps_state {
* the max value should be advertised by the driver through
* max_data_retry_count. when this attribute is not present, the driver
* would use the default configuration.
+ * @NL80211_ATTR_TID_AMPDU_AGGR_CTRL: Enable/Disable aggregation for the TID
+ * specified in %%NL80211_ATTR_TID. Its type is u8, if the peer MAC address
+ * is passed in %NL80211_ATTR_MAC, the aggregation configuration is applied
+ * to the data frame for the tid to that connected station.
+ * Station specific aggregation configuration is valid only for STA's
+ * current connection. i.e. the configuration will be reset to default when
+ * the station connects back after disconnection/roaming.
+ * when user-space does not include %NL80211_ATTR_MAC, this configuration
+ * should be treated as per-netdev configuration. This configuration will
+ * be cleared when the interface goes down and on the disconnection from a
+ * BSS. Driver supporting this feature should advertise
+ * NL80211_EXT_FEATURE_PER_STA_AMPDU_AGGR_CTRL and supporting per station
+ * aggregation configuration should advertise
+ * NL80211_EXT_FEATURE_PER_STA_AMPDU_AGGR_CTRL.
*/
enum nl80211_attr_tid_config {
- __NL80211_ATTR_TID_INVALID,
- NL80211_ATTR_TID,
- NL80211_ATTR_TID_RETRY_CONFIG,
- NL80211_ATTR_TID_RETRY_SHORT,
- NL80211_ATTR_TID_RETRY_LONG,
+ __NL80211_ATTR_TID_INVALID,
+ NL80211_ATTR_TID,
+ NL80211_ATTR_TID_RETRY_CONFIG,
+ NL80211_ATTR_TID_RETRY_SHORT,
+ NL80211_ATTR_TID_RETRY_LONG,
+ NL80211_ATTR_TID_AMPDU_AGGR_CTRL,
- /* keep last */
- __NL80211_ATTR_TID_AFTER_LAST,
- NL80211_ATTR_TID_MAX = __NL80211_ATTR_TID_AFTER_LAST - 1
+ /* keep last */
+ __NL80211_ATTR_TID_AFTER_LAST,
+ NL80211_ATTR_TID_MAX = __NL80211_ATTR_TID_AFTER_LAST - 1
};
/**
* enum nl80211_attr_cqm - connection quality monitor attributes

View File

@@ -1,54 +0,0 @@
--- a/interface.c
+++ b/interface.c
@@ -579,23 +579,43 @@ static int handle_interface_noack_map(st
enum id_input id)
{
uint16_t noack_map;
+ unsigned char mac_addr[ETH_ALEN];
char *end;
- if (argc != 1)
+ if (argc < 1)
return 1;
- noack_map = strtoul(argv[0], &end, 16);
- if (*end)
- return 1;
-
- NLA_PUT_U16(msg, NL80211_ATTR_NOACK_MAP, noack_map);
+ if (strcmp(argv[0], "peer") == 0) {
+ if (argc < 2)
+ return 1;
+
+ if (mac_addr_a2n(mac_addr, argv[1])) {
+ fprintf(stderr, "Invalid MAC address\n");
+ return 2;
+ }
+
+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+ argc -= 2;
+ argv += 2;
+ }
+
+ if (argc) {
+ if (argc > 1)
+ return 1;
+
+ noack_map = strtoul(argv[0], &end, 16);
+ if (*end)
+ return 1;
+ NLA_PUT_U16(msg, NL80211_ATTR_NOACK_MAP, noack_map);
+ }
return 0;
- nla_put_failure:
+
+nla_put_failure:
return -ENOBUFS;
}
-COMMAND(set, noack_map, "<map>",
+COMMAND(set, noack_map, "<[peer <addr>] [map]>",
NL80211_CMD_SET_NOACK_MAP, 0, CIB_NETDEV, handle_interface_noack_map,
"Set the NoAck map for the TIDs. (0x0009 = BE, 0x0006 = BK, 0x0030 = VI, 0x00C0 = VO)");

View File

@@ -1,107 +0,0 @@
--- a/station.c
+++ b/station.c
@@ -321,9 +321,10 @@ static int print_sta_handler(struct nl_m
[NL80211_STA_INFO_TID_STATS] = { .type = NLA_NESTED },
[NL80211_STA_INFO_BSS_PARAM] = { .type = NLA_NESTED },
[NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
- [NL80211_STA_INFO_TX_DURATION] = { .type = NLA_U64 },
[NL80211_STA_INFO_ACK_SIGNAL] = {.type = NLA_U8 },
[NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_U8 },
+ [NL80211_STA_INFO_TX_DURATION] = {.type = NLA_U64},
+ [NL80211_STA_INFO_AIRTIME_WEIGHT] = {.type = NLA_U16},
};
char *chain;
@@ -414,10 +415,6 @@ static int print_sta_handler(struct nl_m
printf("\n\ttx bitrate:\t%s", buf);
}
- if (sinfo[NL80211_STA_INFO_TX_DURATION])
- printf("\n\ttx duration:\t%lld us",
- (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_TX_DURATION]));
-
if (sinfo[NL80211_STA_INFO_RX_BITRATE]) {
char buf[100];
@@ -437,6 +434,10 @@ static int print_sta_handler(struct nl_m
printf("\n\tavg ack signal:\t%d dBm",
(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_ACK_SIGNAL_AVG]));
+ if (sinfo[NL80211_STA_INFO_TX_DURATION])
+ printf("\n\ttx duration:\t%lld us",
+ (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_TX_DURATION]));
+
if (sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT]) {
printf("\n\tairtime weight: %d", nla_get_u16(sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT]));
}
@@ -671,6 +672,7 @@ COMMAND(station, del, "<MAC address> [su
static const struct cmd *station_set_plink;
static const struct cmd *station_set_vlan;
+static const struct cmd *station_set_airtime;
static const struct cmd *station_set_mesh_power_mode;
static const struct cmd *station_set_airtime_weight;
static const struct cmd *station_set_txpwr;
@@ -683,6 +685,8 @@ static const struct cmd *select_station_
return station_set_plink;
if (strcmp(argv[1], "vlan") == 0)
return station_set_vlan;
+ if (strcmp(argv[1], "airtime") == 0)
+ return station_set_airtime;
if (strcmp(argv[1], "mesh_power_mode") == 0)
return station_set_mesh_power_mode;
if (strcmp(argv[1], "airtime_weight") == 0)
@@ -788,6 +792,53 @@ COMMAND_ALIAS(station, set, "<MAC addres
"Set an AP VLAN for this station.",
select_station_cmd, station_set_vlan);
+static int handle_station_set_airtime(struct nl80211_state *state,
+ struct nl_msg *msg,
+ int argc, char **argv,
+ enum id_input id)
+{
+ unsigned char mac_addr[ETH_ALEN];
+ unsigned long airtime_weight = 0;
+ char *err = NULL;
+
+ if (argc < 3)
+ return 1;
+
+ if (mac_addr_a2n(mac_addr, argv[0])) {
+ fprintf(stderr, "invalid mac address\n");
+ return 2;
+ }
+ argc--;
+ argv++;
+
+ if (strcmp("airtime", argv[0]) != 0)
+ return 1;
+ argc--;
+ argv++;
+
+ airtime_weight = strtoul(argv[0], &err, 0);
+ if ((err && *err) || airtime_weight <= 0) {
+ fprintf(stderr, "invalid airtime weight\n");
+ return 2;
+ }
+ argc--;
+ argv++;
+
+ if (argc)
+ return 1;
+
+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+ NLA_PUT_U32(msg, NL80211_ATTR_AIRTIME_WEIGHT, airtime_weight);
+
+ return 0;
+ nla_put_failure:
+ return -ENOBUFS;
+}
+COMMAND_ALIAS(station, set, "<MAC address> airtime <airtime in usecs>",
+ NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_airtime,
+ "Set airtime weight for this station.",
+ select_station_cmd, station_set_airtime);
+
static int handle_station_set_mesh_power_mode(struct nl80211_state *state,
struct nl_msg *msg,
int argc, char **argv,

View File

@@ -1,71 +0,0 @@
--- a/iw.h
+++ b/iw.h
@@ -62,6 +62,19 @@ enum id_input {
II_WDEV,
};
+/* Attributes for data used by
+ * QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION and
+ * QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_CONFIGURATION subcommands.
+ */
+enum qca_wlan_vendor_attr_config {
+ QCA_WLAN_VENDOR_ATTR_CONFIG_GTX = 57,
+
+ /* keep last */
+ QCA_WLAN_VENDOR_ATTR_CONFIG_AFTER_LAST,
+ QCA_WLAN_VENDOR_ATTR_CONFIG_MAX =
+ QCA_WLAN_VENDOR_ATTR_CONFIG_AFTER_LAST - 1,
+};
+
#define HANDLER_RET_USAGE 1
#define HANDLER_RET_DONE 3
--- a/vendor.c
+++ b/vendor.c
@@ -78,9 +78,12 @@ static int handle_vendor(struct nl80211_
{
unsigned int oui;
unsigned int subcmd;
+ struct nlattr *params;
char buf[2048] = {};
int res, count = 0;
FILE *file = NULL;
+ char *end;
+ unsigned int ap_ps;
if (argc < 3)
return 1;
@@ -105,6 +108,33 @@ static int handle_vendor(struct nl80211_
NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_ID, oui);
NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_SUBCMD, subcmd);
+ if (subcmd == 0x4a) {
+ argc -= 2;
+ argv += 2;
+
+ if (!argc)
+ return 1;
+
+ params = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA | NLA_F_NESTED);
+
+ if (!strcmp(argv[0], "ap-ps")) {
+ if (argc < 2)
+ return 1;
+ ap_ps = strtol(argv[1], &end, 10);
+ if (*end)
+ return 2;
+
+ if (ap_ps > 1)
+ return -EINVAL;
+
+ if (ap_ps)
+ NLA_PUT_FLAG(msg, QCA_WLAN_VENDOR_ATTR_CONFIG_GTX);
+ }
+
+ nla_nest_end(msg, params);
+ return 0;
+ }
+
if (file) {
count = read_file(file, buf, sizeof(buf));
if (file != stdin)

View File

@@ -1,138 +0,0 @@
--- a/scan.c
+++ b/scan.c
@@ -378,19 +378,23 @@ static int handle_scan(struct nl80211_st
enum {
NONE,
FREQ,
+ MODE,
+ CHECK_SCAN_FLAG_AP,
IES,
SSID,
MESHID,
DURATION,
DONE,
} parse = NONE;
- int freq;
+ int freq = 0;
unsigned int duration = 0;
bool passive = false, have_ssids = false, have_freqs = false;
+ bool have_chandef = false;
bool duration_mandatory = false;
size_t ies_len = 0, meshid_len = 0;
unsigned char *ies = NULL, *meshid = NULL, *tmpies = NULL;
unsigned int flags = 0;
+ struct chandef chandef;
ssids = nlmsg_alloc();
if (!ssids)
@@ -407,7 +411,6 @@ static int handle_scan(struct nl80211_st
case NONE:
if (strcmp(argv[i], "freq") == 0) {
parse = FREQ;
- have_freqs = true;
break;
} else if (strcmp(argv[i], "ies") == 0) {
parse = IES;
@@ -451,15 +454,35 @@ static int handle_scan(struct nl80211_st
err = 1;
goto nla_put_failure;
case FREQ:
- freq = strtoul(argv[i], &eptr, 10);
- if (eptr != argv[i] + strlen(argv[i])) {
- /* failed to parse as number -- maybe a tag? */
- i--;
- parse = NONE;
- continue;
+ parse_freqchan(&chandef, false, argc - i, argv + i, NULL);
+
+ if (!chandef.control_freq || have_freqs) {
+ freq = strtoul(argv[i], &eptr, 10);
+ if (eptr != argv[i] + strlen(argv[i])) {
+ /* failed to parse as number -- maybe a tag? */
+ i--;
+ parse = NONE;
+ continue;
+ }
+ NLA_PUT_U32(freqs, i, freq);
+ } else {
+ if (chandef.width == NL80211_CHAN_WIDTH_20_NOHT){
+ have_freqs = true;
+ NLA_PUT_U32(freqs, i, chandef.control_freq);
+ } else {
+ parse = MODE;
+ }
}
NLA_PUT_U32(freqs, i, freq);
break;
+ case MODE:
+ have_chandef = true;
+ parse = CHECK_SCAN_FLAG_AP;
+ break;
+ case CHECK_SCAN_FLAG_AP:
+ if (strcmp(argv[i], "ap-force") == 0)
+ flags |= NL80211_SCAN_FLAG_AP;
+ break;
case IES:
if (ies)
free(ies);
@@ -506,8 +529,11 @@ static int handle_scan(struct nl80211_st
if (!passive)
nla_put_nested(msg, NL80211_ATTR_SCAN_SSIDS, ssids);
- if (have_freqs)
+ if (have_chandef)
+ put_chandef(msg, &chandef);
+ else if (have_freqs)
nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
+
if (flags)
NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, flags);
if (duration)
@@ -2344,20 +2370,24 @@ static int handle_scan_combined(struct n
dump_argv[0] = argv[0];
return handle_cmd(state, id, dump_argc, dump_argv);
}
-TOPLEVEL(scan, "[-u] [freq <freq>*] [duration <dur>] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force,duration-mandatory] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]", 0, 0,
+TOPLEVEL(scan, "[-u] [freq <freq>*] [HT40+|HT40-|80MHz] [duration <dur>] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force,duration-mandatory] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]", 0, 0,
CIB_NETDEV, handle_scan_combined,
"Scan on the given frequencies and probe for the given SSIDs\n"
"(or wildcard if not given) unless passive scanning is requested.\n"
+ "If channel mode/width is provided along with frequency, only \n"
+ "scanning on primary frequency of channel mode/width is done.\n"
"If -u is specified print unknown data in the scan results.\n"
"Specified (vendor) IEs must be well-formed.");
COMMAND(scan, dump, "[-u]",
NL80211_CMD_GET_SCAN, NLM_F_DUMP, CIB_NETDEV, handle_scan_dump,
"Dump the current scan results. If -u is specified, print unknown\n"
"data in scan results.");
-COMMAND(scan, trigger, "[freq <freq>*] [duration <dur>] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force,duration-mandatory] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]",
+COMMAND(scan, trigger, "[freq <freq>*] [HT40+|HT40-|80MHz] [duration <dur>] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force,duration-mandatory] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]",
NL80211_CMD_TRIGGER_SCAN, 0, CIB_NETDEV, handle_scan,
"Trigger a scan on the given frequencies with probing for the given\n"
"SSIDs (or wildcard if not given) unless passive scanning is requested.\n"
+ "If channel mode/width is provided along with frequency, only \n"
+ "scanning on primary frequency of channel mode/width is done.\n"
"Duration(in TUs), if specified, will be used to set dwell times.\n");
--- a/util.c
+++ b/util.c
@@ -613,6 +613,9 @@ int parse_freqchan(struct chandef *chand
if (!argv[0])
goto out;
+
+ memset(chandef, 0, sizeof(struct chandef));
+
freq = strtoul(argv[0], &end, 10);
if (*end) {
res = 1;
@@ -621,8 +624,6 @@ int parse_freqchan(struct chandef *chand
_parsed += 1;
- memset(chandef, 0, sizeof(struct chandef));
-
if (chan) {
enum nl80211_band band;

View File

@@ -1,398 +0,0 @@
From ebd46629ad718be6811c66bed748f61d9ea67f1b Mon Sep 17 00:00:00 2001
From: Miles Hu <milehu@codeaurora.org>
Date: Tue, 5 Nov 2019 14:49:16 -0800
Subject: [PATCH] iw: add HE rate/gi/ltf support
Signed-off-by: Miles Hu <milehu@codeaurora.org>
---
bitrate.c | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
nl80211.h | 24 +++++++++
2 files changed, 181 insertions(+), 15 deletions(-)
--- a/bitrate.c
+++ b/bitrate.c
@@ -4,13 +4,22 @@
#include "iw.h"
-static int parse_vht_chunk(const char *arg, __u8 *nss, __u16 *mcs)
+static int parse_rate_chunk(const char *arg, __u8 *nss, __u16 *mcs, unsigned int mode)
{
unsigned int count, i;
- unsigned int inss, mcs_start, mcs_end, tab[10];
+ unsigned int inss, mcs_start, mcs_end, tab[12];
+ unsigned int max_mcs = 0, max_nss = 0;
*nss = 0; *mcs = 0;
+ if (mode == NL80211_TXRATE_HE) {
+ max_mcs = 11;
+ max_nss = NL80211_HE_NSS_MAX;
+ } else {
+ max_mcs = 9;
+ max_nss = NL80211_VHT_NSS_MAX;
+ }
+
if (strchr(arg, '-')) {
/* Format: NSS:MCS_START-MCS_END */
count = sscanf(arg, "%u:%u-%u", &inss, &mcs_start, &mcs_end);
@@ -18,13 +27,13 @@ static int parse_vht_chunk(const char *a
if (count != 3)
return 0;
- if (inss < 1 || inss > NL80211_VHT_NSS_MAX)
+ if (inss < 1 || inss > max_nss)
return 0;
if (mcs_start > mcs_end)
return 0;
- if (mcs_start > 9 || mcs_end > 9)
+ if (mcs_start > max_mcs || mcs_end > max_mcs)
return 0;
*nss = inss;
@@ -33,19 +42,26 @@ static int parse_vht_chunk(const char *a
} else {
/* Format: NSS:MCSx,MCSy,... */
- count = sscanf(arg, "%u:%u,%u,%u,%u,%u,%u,%u,%u,%u,%u", &inss,
- &tab[0], &tab[1], &tab[2], &tab[3], &tab[4], &tab[5],
- &tab[6], &tab[7], &tab[8], &tab[9]);
+ if (mode == NL80211_TXRATE_HE) {
+ count = sscanf(arg, "%u:%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u",
+ &inss, &tab[0], &tab[1], &tab[2], &tab[3],
+ &tab[4], &tab[5], &tab[6], &tab[7], &tab[8],
+ &tab[9], &tab[10], &tab[11]);
+ } else {
+ count = sscanf(arg, "%u:%u,%u,%u,%u,%u,%u,%u,%u,%u,%u", &inss,
+ &tab[0], &tab[1], &tab[2], &tab[3], &tab[4],
+ &tab[5], &tab[6], &tab[7], &tab[8], &tab[9]);
+ }
if (count < 2)
return 0;
- if (inss < 1 || inss > NL80211_VHT_NSS_MAX)
+ if (inss < 1 || inss > max_nss)
return 0;
*nss = inss;
for (i = 0; i < count - 1; i++) {
- if (tab[i] > 9)
+ if (tab[i] > max_mcs)
return 0;
*mcs |= 1 << tab[i];
}
@@ -54,6 +70,16 @@ static int parse_vht_chunk(const char *a
return 1;
}
+static int parse_vht_chunk(const char *arg, __u8 *nss, __u16 *mcs)
+{
+ return parse_rate_chunk(arg, nss, mcs, NL80211_TXRATE_VHT);
+}
+
+static int parse_he_chunk(const char *arg, __u8 *nss, __u16 *mcs)
+{
+ return parse_rate_chunk(arg, nss, mcs, NL80211_TXRATE_HE);
+}
+
static int setup_vht(struct nl80211_txrate_vht *txrate_vht,
int argc, char **argv)
{
@@ -74,6 +100,45 @@ static int setup_vht(struct nl80211_txra
return 1;
}
+static int setup_he(struct nl80211_txrate_he *txrate_he,
+ int argc, char **argv)
+{
+ __u8 nss;
+ __u16 mcs;
+ int i;
+
+ memset(txrate_he, 0, sizeof(*txrate_he));
+
+ for (i = 0; i < argc; i++) {
+ if (!parse_he_chunk(argv[i], &nss, &mcs))
+ return 0;
+
+ nss--;
+ txrate_he->mcs[nss] |= mcs;
+ }
+
+ return 1;
+}
+
+#define HE_GI_STR_MAX 16
+#define HE_GI_08_STR "0.8"
+#define HE_GI_16_STR "1.6"
+#define HE_GI_32_STR "3.2"
+int parse_he_gi(char *he_gi)
+{
+ if (he_gi == NULL)
+ return 0;
+
+ if (!strncmp(he_gi, HE_GI_08_STR, sizeof(HE_GI_08_STR)))
+ return NL80211_RATE_INFO_HE_GI_0_8;
+ if (!strncmp(he_gi, HE_GI_16_STR, sizeof(HE_GI_16_STR)))
+ return NL80211_RATE_INFO_HE_GI_1_6;
+ if (!strncmp(he_gi, HE_GI_32_STR, sizeof(HE_GI_32_STR)))
+ return NL80211_RATE_INFO_HE_GI_3_2;
+
+ return -1;
+}
+
#define VHT_ARGC_MAX 100
static int handle_bitrates(struct nl80211_state *state,
@@ -90,24 +155,35 @@ static int handle_bitrates(struct nl8021
int *n_legacy = NULL;
bool have_ht_mcs_24 = false, have_ht_mcs_5 = false;
bool have_vht_mcs_24 = false, have_vht_mcs_5 = false;
+ bool have_he_mcs_24 = false, have_he_mcs_5 = false;
uint8_t ht_mcs_24[77], ht_mcs_5[77];
int n_ht_mcs_24 = 0, n_ht_mcs_5 = 0;
struct nl80211_txrate_vht txrate_vht_24 = {};
struct nl80211_txrate_vht txrate_vht_5 = {};
+ struct nl80211_txrate_he txrate_he_24 = {};
+ struct nl80211_txrate_he txrate_he_5 = {};
uint8_t *mcs = NULL;
int *n_mcs = NULL;
char *vht_argv_5[VHT_ARGC_MAX] = {}; char *vht_argv_24[VHT_ARGC_MAX] = {};
- char **vht_argv = NULL;
+ char *he_argv_5[VHT_ARGC_MAX] = {}; char *he_argv_24[VHT_ARGC_MAX] = {};
+ char **vht_argv = NULL, **he_argv = NULL;
int vht_argc_5 = 0; int vht_argc_24 = 0;
- int *vht_argc = NULL;
+ int he_argc_5 = 0; int he_argc_24 = 0;
+ int *vht_argc = NULL, *he_argc = NULL;
int sgi_24 = 0, sgi_5 = 0, lgi_24 = 0, lgi_5 = 0;
+ int has_he_gi_24 = 0, has_he_gi_5 = 0, has_he_ltf_24 = 0, has_he_ltf_5 = 0;
+ int he_gi = 0, he_ltf = 0;
+ char *he_gi_argv = NULL;
enum {
S_NONE,
S_LEGACY,
S_HT,
S_VHT,
+ S_HE,
S_GI,
+ S_HE_GI,
+ S_HE_LTF,
} parser_state = S_NONE;
for (i = 0; i < argc; i++) {
@@ -158,6 +234,20 @@ static int handle_bitrates(struct nl8021
vht_argv = vht_argv_5;
vht_argc = &vht_argc_5;
have_vht_mcs_5 = true;
+ } else if (strcmp(argv[i], "he-mcs-2.4") == 0) {
+ if (have_he_mcs_24)
+ return 1;
+ parser_state = S_HE;
+ he_argv = he_argv_24;
+ he_argc = &he_argc_24;
+ have_he_mcs_24 = true;
+ } else if (strcmp(argv[i], "he-mcs-5") == 0) {
+ if (have_he_mcs_5)
+ return 1;
+ parser_state = S_HE;
+ he_argv = he_argv_5;
+ he_argc = &he_argc_5;
+ have_he_mcs_5 = true;
} else if (strcmp(argv[i], "sgi-2.4") == 0) {
sgi_24 = 1;
parser_state = S_GI;
@@ -170,6 +260,18 @@ static int handle_bitrates(struct nl8021
} else if (strcmp(argv[i], "lgi-5") == 0) {
lgi_5 = 1;
parser_state = S_GI;
+ } else if (strcmp(argv[i], "he-gi-2.4") == 0) {
+ has_he_gi_24 = 1;
+ parser_state = S_HE_GI;
+ } else if (strcmp(argv[i], "he-gi-5") == 0) {
+ has_he_gi_5 = 1;
+ parser_state = S_HE_GI;
+ } else if (strcmp(argv[i], "he-ltf-2.4") == 0) {
+ has_he_ltf_24 = 1;
+ parser_state = S_HE_LTF;
+ } else if (strcmp(argv[i], "he-ltf-5") == 0) {
+ has_he_ltf_5 = 1;
+ parser_state = S_HE_LTF;
} else switch (parser_state) {
case S_LEGACY:
tmpd = strtod(argv[i], &end);
@@ -192,8 +294,24 @@ static int handle_bitrates(struct nl8021
return 1;
vht_argv[(*vht_argc)++] = argv[i];
break;
+ case S_HE:
+ if (*he_argc >= VHT_ARGC_MAX)
+ return 1;
+ he_argv[(*he_argc)++] = argv[i];
+ break;
case S_GI:
break;
+ case S_HE_GI:
+ he_gi_argv = argv[i];
+ break;
+ case S_HE_LTF:
+ he_ltf = strtol(argv[i], &end, 0);
+ if (*end != '\0')
+ return 1;
+ if (he_ltf < 0 || he_ltf > 4)
+ return 1;
+ he_ltf = he_ltf >> 1;
+ break;
default:
return 1;
}
@@ -207,17 +325,32 @@ static int handle_bitrates(struct nl8021
if(!setup_vht(&txrate_vht_5, vht_argc_5, vht_argv_5))
return -EINVAL;
+ if (have_he_mcs_24)
+ if (!setup_he(&txrate_he_24, he_argc_24, he_argv_24))
+ return -EINVAL;
+
+ if (have_he_mcs_5)
+ if (!setup_he(&txrate_he_5, he_argc_5, he_argv_5))
+ return -EINVAL;
+
if (sgi_5 && lgi_5)
return 1;
if (sgi_24 && lgi_24)
return 1;
+ if (he_gi_argv) {
+ he_gi = parse_he_gi(he_gi_argv);
+ if (he_gi < 0)
+ return 1;
+ }
+
nl_rates = nla_nest_start(msg, NL80211_ATTR_TX_RATES);
if (!nl_rates)
goto nla_put_failure;
- if (have_legacy_24 || have_ht_mcs_24 || have_vht_mcs_24 || sgi_24 || lgi_24) {
+ if (have_legacy_24 || have_ht_mcs_24 || have_vht_mcs_24 || have_he_mcs_24 ||
+ sgi_24 || lgi_24 || has_he_gi_24 || has_he_ltf_24) {
nl_band = nla_nest_start(msg, NL80211_BAND_2GHZ);
if (!nl_band)
goto nla_put_failure;
@@ -227,14 +360,22 @@ static int handle_bitrates(struct nl8021
nla_put(msg, NL80211_TXRATE_HT, n_ht_mcs_24, ht_mcs_24);
if (have_vht_mcs_24)
nla_put(msg, NL80211_TXRATE_VHT, sizeof(txrate_vht_24), &txrate_vht_24);
+ if (have_he_mcs_24)
+ nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_24),
+ &txrate_he_24);
if (sgi_24)
nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_SGI);
if (lgi_24)
nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_LGI);
+ if (has_he_gi_24)
+ nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi);
+ if (has_he_ltf_24)
+ nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf);
nla_nest_end(msg, nl_band);
}
- if (have_legacy_5 || have_ht_mcs_5 || have_vht_mcs_5 || sgi_5 || lgi_5) {
+ if (have_legacy_5 || have_ht_mcs_5 || have_vht_mcs_5 || have_he_mcs_5 ||
+ sgi_5 || lgi_5 || has_he_gi_5 || has_he_ltf_5) {
nl_band = nla_nest_start(msg, NL80211_BAND_5GHZ);
if (!nl_band)
goto nla_put_failure;
@@ -244,10 +385,17 @@ static int handle_bitrates(struct nl8021
nla_put(msg, NL80211_TXRATE_HT, n_ht_mcs_5, ht_mcs_5);
if (have_vht_mcs_5)
nla_put(msg, NL80211_TXRATE_VHT, sizeof(txrate_vht_5), &txrate_vht_5);
+ if (have_he_mcs_5)
+ nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_5),
+ &txrate_he_5);
if (sgi_5)
nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_SGI);
if (lgi_5)
nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_LGI);
+ if (has_he_gi_5)
+ nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi);
+ if (has_he_ltf_5)
+ nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf);
nla_nest_end(msg, nl_band);
}
@@ -259,9 +407,9 @@ static int handle_bitrates(struct nl8021
}
#define DESCR_LEGACY "[legacy-<2.4|5> <legacy rate in Mbps>*]"
-#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]"
+#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]"
-COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]",
+COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-2.4:0.8/1.6/3.2] [he-gi-5:0.8/1.6/3.2] [he-ltf-2.4:1/2/4] [he-ltf-5:1/2/4]",
NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_bitrates,
"Sets up the specified rate masks.\n"
"Not passing any arguments would clear the existing mask (if any).");
--- a/nl80211.h
+++ b/nl80211.h
@@ -3059,6 +3059,18 @@ enum nl80211_he_gi {
};
/**
+ * enum nl80211_he_ltf - HE long training field
+ * @NL80211_RATE_INFO_HE_1xLTF: 3.2 usec
+ * @NL80211_RATE_INFO_HE_2xLTF: 6.4 usec
+ * @NL80211_RATE_INFO_HE_4xLTF: 12.8 usec
+ */
+enum nl80211_he_ltf {
+ NL80211_RATE_INFO_HE_1XLTF,
+ NL80211_RATE_INFO_HE_2XLTF,
+ NL80211_RATE_INFO_HE_4XLTF,
+};
+
+/**
* enum nl80211_he_ru_alloc - HE RU allocation values
* @NL80211_RATE_INFO_HE_RU_ALLOC_26: 26-tone RU allocation
* @NL80211_RATE_INFO_HE_RU_ALLOC_52: 52-tone RU allocation
@@ -4570,6 +4582,10 @@ enum nl80211_key_attributes {
* in an array of MCS numbers.
* @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection,
* see &struct nl80211_txrate_vht
+ * @NL80211_TXRATE_HE: HE rates allowed for TX rate selection,
+ * see &struct nl80211_txrate_he
+ * @NL80211_TXRATE_HE_GI: configure HE GI, 0.8us, 1.6us and 3.2us.
+ * @NL80211_TXRATE_HE_LTF: configure HE LTF, 1XLTF, 2XLTF and 4XLTF.
* @NL80211_TXRATE_GI: configure GI, see &enum nl80211_txrate_gi
* @__NL80211_TXRATE_AFTER_LAST: internal
* @NL80211_TXRATE_MAX: highest TX rate attribute
@@ -4580,6 +4596,9 @@ enum nl80211_tx_rate_attributes {
NL80211_TXRATE_HT,
NL80211_TXRATE_VHT,
NL80211_TXRATE_GI,
+ NL80211_TXRATE_HE,
+ NL80211_TXRATE_HE_GI,
+ NL80211_TXRATE_HE_LTF,
/* keep last */
__NL80211_TXRATE_AFTER_LAST,
@@ -4597,6 +4616,15 @@ struct nl80211_txrate_vht {
__u16 mcs[NL80211_VHT_NSS_MAX];
};
+#define NL80211_HE_NSS_MAX 8
+/**
+ * struct nl80211_txrate_he - HE MCS/NSS txrate bitmap
+ * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.)
+ */
+struct nl80211_txrate_he {
+ __u16 mcs[NL80211_HE_NSS_MAX];
+};
+
enum nl80211_txrate_gi {
NL80211_TXRATE_DEFAULT_GI,
NL80211_TXRATE_FORCE_SGI,

View File

@@ -1,61 +0,0 @@
From ade60d37824164c85ce0d90e35d69d22956bd759 Mon Sep 17 00:00:00 2001
From: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Date: Fri, 19 Jun 2020 18:47:54 -0700
Subject: [PATCH] iw-update-freq-to-chan-mappings-for-6GHz-band-per-IE
This fixes dfferences in 6GHz frequencies which were updated in
IEEE P802.11ax/D6.1.
Also sync 60GHz band channel to freq mapping with kernel.
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
util.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/util.c b/util.c
index cdedd7a23bb0..8c63ae49ad8d 100644
--- a/util.c
+++ b/util.c
@@ -182,8 +182,15 @@ int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
else
return 5000 + chan * 5;
break;
+ case NL80211_BAND_6GHZ:
+ /* see 802.11ax D6.1 27.3.23.2 */
+ if (chan == 2)
+ return 5935;
+ if (chan <= 253)
+ return 5950 + chan * 5;
+ break;
case NL80211_BAND_60GHZ:
- if (chan < 5)
+ if (chan < 7)
return 56160 + chan * 2160;
break;
default:
@@ -197,13 +204,19 @@ 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 <= 45000) /* DMG band lower limit */
+ else if (freq < 5950)
return (freq - 5000) / 5;
- else if (freq >= 58320 && freq <= 64800)
+ 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;
--
2.17.1

View File

@@ -1,48 +0,0 @@
From 7bc4688806777e9f6131289c9befba141a8e0f6c Mon Sep 17 00:00:00 2001
From: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Date: Wed, 2 Sep 2020 17:56:04 -0700
Subject: [PATCH] iw: enable 80M support for 6GHz 11s mesh
without this 11s mesh could not be configured for 80MHz using iw.
example:
iw <interface> mesh join <meshname> freq 6195 HT40+ ---> 40MHz
iw <interface> mesh join <meshname> freq 6195 80MHz ---> 80MHz
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
util.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/util.c b/util.c
index 8c63ae49ad8d..37c1447bb877 100644
--- a/util.c
+++ b/util.c
@@ -1228,20 +1228,20 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
int get_cf1(const struct chanmode *chanmode, unsigned long freq)
{
unsigned int cf1 = freq, j;
- unsigned int vht80[] = { 5180, 5260, 5500, 5580, 5660, 5745 };
+ unsigned int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955, 6035, 6115, 6195, 6275, 6355, 6435, 6515, 6595, 6675, 6755, 6835, 6195, 6995};
switch (chanmode->width) {
case NL80211_CHAN_WIDTH_80:
/* setup center_freq1 */
- for (j = 0; j < ARRAY_SIZE(vht80); j++) {
- if (freq >= vht80[j] && freq < vht80[j] + 80)
+ for (j = 0; j < ARRAY_SIZE(bw80); j++) {
+ if (freq >= bw80[j] && freq < bw80[j] + 80)
break;
}
- if (j == ARRAY_SIZE(vht80))
+ if (j == ARRAY_SIZE(bw80))
break;
- cf1 = vht80[j] + 30;
+ cf1 = bw80[j] + 30;
break;
default:
cf1 = freq + chanmode->freq1_diff;
--
2.17.1

View File

@@ -1,109 +0,0 @@
From 092d838b9660999c7e7212fe9430a5bd0eed8ef9 Mon Sep 17 00:00:00 2001
From: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Date: Thu, 3 Sep 2020 16:45:40 -0700
Subject: [PATCH] iw: support optional argument to parse 6Ghz channel
Channel numbers of 6GHz band overlaps with those of 2G or 5G bands.
Therefore additional argument "6G" is expected next to channel
number to map it to correct frequency. If not specified defaults to
matching 2G or 5G frequency.
example: iw wlanX set channel 1 6G 80MHz
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
interface.c | 6 ++++--
phy.c | 8 ++++----
util.c | 14 ++++++++++----
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/interface.c b/interface.c
index 931d77a278c0..c37cd08cc56c 100644
--- a/interface.c
+++ b/interface.c
@@ -755,8 +755,10 @@ COMMAND(switch, freq,
"<control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]] [beacons <count>] [block-tx]",
NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_freq,
"Switch the operating channel by sending a channel switch announcement (CSA).");
-COMMAND(switch, channel, "<channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]",
- NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL);
+COMMAND(switch, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]",
+ NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan,
+ "Switch the operating channel by sending a channel switch announcement (CSA)."
+ "6GHz channels expects '6G' in argument. Defaults to 5GHz or 2GHz channels");
static int handle_retry_count(struct nl80211_state *state,
struct nl_msg *msg,
diff --git a/phy.c b/phy.c
index 7dbf66200a51..37079b31d7d9 100644
--- a/phy.c
+++ b/phy.c
@@ -222,9 +222,9 @@ static int handle_chan(struct nl80211_state *state, struct nl_msg *msg,
return put_chandef(msg, &chandef);
}
-COMMAND(set, channel, "<channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]",
+COMMAND(set, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]",
NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_chan, NULL);
-COMMAND(set, channel, "<channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]",
+COMMAND(set, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [6G]",
NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_chan, NULL);
@@ -369,12 +369,12 @@ err_out:
free(cac_trigger_argv);
return err;
}
-TOPLEVEL(cac, "channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
+TOPLEVEL(cac, "channel <channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
"freq <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
"freq <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
0, 0, CIB_NETDEV, handle_cac, NULL);
COMMAND(cac, trigger,
- "channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
+ "channel <channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
"freq <frequency> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
"freq <frequency> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_trigger,
diff --git a/util.c b/util.c
index 37c1447bb877..3dbe7c8fcc9f 100644
--- a/util.c
+++ b/util.c
@@ -571,7 +571,8 @@ static int parse_freqs(struct chandef *chandef, int argc, char **argv,
* user by giving "NOHT" instead.
*
* The working specifier if chan is set are:
- * <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]
+ * <channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]
+ * channel number defaults to 5G or 2G band unless 6G is specified.
*
* And if frequency is set:
* <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]
@@ -640,7 +641,12 @@ int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv,
if (chan) {
enum nl80211_band band;
- band = freq <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
+ if (argc > 1 && strcmp(argv[1], "6G") == 0) {
+ band = NL80211_BAND_6GHZ;
+ _parsed += 1;
+ } else {
+ band = freq <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
+ }
freq = ieee80211_channel_to_frequency(freq, band);
}
chandef->control_freq = freq;
@@ -648,9 +654,9 @@ int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv,
chandef->center_freq1 = freq;
/* Try to parse HT mode definitions */
- if (argc > 1) {
+ if ((argc - _parsed) > 0) {
for (i = 0; i < ARRAY_SIZE(chanmode); i++) {
- if (strcasecmp(chanmode[i].name, argv[1]) == 0) {
+ if (strcasecmp(chanmode[i].name, argv[_parsed]) == 0) {
chanmode_selected = &chanmode[i];
_parsed += 1;
break;
--
2.17.1

View File

@@ -1,125 +0,0 @@
From 1be1ed17b60a44d02fde7ccbf8baadf8d020b558 Mon Sep 17 00:00:00 2001
From: Rajkumar Manoharan <rmanohar@codeaurora.org>
Date: Wed, 16 Sep 2020 10:05:10 -0700
Subject: [PATCH] iw: support HE rate configuration in 6 GHz band
Allow HE-MCS, HE-GI, HE-LTF in 6 GHz band as well and allow only
MCS rates in 6 GHz.
Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
---
bitrate.c | 40 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/bitrate.c b/bitrate.c
index 70a23fb6ac83..460708a1dbea 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -156,22 +156,27 @@ static int handle_bitrates(struct nl80211_state *state,
bool have_ht_mcs_24 = false, have_ht_mcs_5 = false;
bool have_vht_mcs_24 = false, have_vht_mcs_5 = false;
bool have_he_mcs_24 = false, have_he_mcs_5 = false;
+ bool have_he_mcs_6 = false;
uint8_t ht_mcs_24[77], ht_mcs_5[77];
int n_ht_mcs_24 = 0, n_ht_mcs_5 = 0;
struct nl80211_txrate_vht txrate_vht_24 = {};
struct nl80211_txrate_vht txrate_vht_5 = {};
struct nl80211_txrate_he txrate_he_24 = {};
struct nl80211_txrate_he txrate_he_5 = {};
+ struct nl80211_txrate_he txrate_he_6 = {};
uint8_t *mcs = NULL;
int *n_mcs = NULL;
char *vht_argv_5[VHT_ARGC_MAX] = {}; char *vht_argv_24[VHT_ARGC_MAX] = {};
char *he_argv_5[VHT_ARGC_MAX] = {}; char *he_argv_24[VHT_ARGC_MAX] = {};
+ char *he_argv_6[VHT_ARGC_MAX] = {};
char **vht_argv = NULL, **he_argv = NULL;
int vht_argc_5 = 0; int vht_argc_24 = 0;
int he_argc_5 = 0; int he_argc_24 = 0;
+ int he_argc_6 = 0;
int *vht_argc = NULL, *he_argc = NULL;
int sgi_24 = 0, sgi_5 = 0, lgi_24 = 0, lgi_5 = 0;
int has_he_gi_24 = 0, has_he_gi_5 = 0, has_he_ltf_24 = 0, has_he_ltf_5 = 0;
+ int has_he_gi_6 = 0, has_he_ltf_6 = 0;
int he_gi = 0, he_ltf = 0;
char *he_gi_argv = NULL;
@@ -248,6 +253,13 @@ static int handle_bitrates(struct nl80211_state *state,
he_argv = he_argv_5;
he_argc = &he_argc_5;
have_he_mcs_5 = true;
+ } else if (strcmp(argv[i], "he-mcs-6") == 0) {
+ if (have_he_mcs_6)
+ return 1;
+ parser_state = S_HE;
+ he_argv = he_argv_6;
+ he_argc = &he_argc_6;
+ have_he_mcs_6 = true;
} else if (strcmp(argv[i], "sgi-2.4") == 0) {
sgi_24 = 1;
parser_state = S_GI;
@@ -266,12 +278,18 @@ static int handle_bitrates(struct nl80211_state *state,
} else if (strcmp(argv[i], "he-gi-5") == 0) {
has_he_gi_5 = 1;
parser_state = S_HE_GI;
+ } else if (strcmp(argv[i], "he-gi-6") == 0) {
+ has_he_gi_6 = 1;
+ parser_state = S_HE_GI;
} else if (strcmp(argv[i], "he-ltf-2.4") == 0) {
has_he_ltf_24 = 1;
parser_state = S_HE_LTF;
} else if (strcmp(argv[i], "he-ltf-5") == 0) {
has_he_ltf_5 = 1;
parser_state = S_HE_LTF;
+ } else if (strcmp(argv[i], "he-ltf-6") == 0) {
+ has_he_ltf_6 = 1;
+ parser_state = S_HE_LTF;
} else switch (parser_state) {
case S_LEGACY:
tmpd = strtod(argv[i], &end);
@@ -333,6 +351,10 @@ static int handle_bitrates(struct nl80211_state *state,
if (!setup_he(&txrate_he_5, he_argc_5, he_argv_5))
return -EINVAL;
+ if (have_he_mcs_6)
+ if (!setup_he(&txrate_he_6, he_argc_6, he_argv_6))
+ return -EINVAL;
+
if (sgi_5 && lgi_5)
return 1;
@@ -399,6 +421,20 @@ static int handle_bitrates(struct nl80211_state *state,
nla_nest_end(msg, nl_band);
}
+ if (have_he_mcs_6 || has_he_gi_6 || has_he_ltf_6) {
+ nl_band = nla_nest_start(msg, NL80211_BAND_6GHZ);
+ if (!nl_band)
+ goto nla_put_failure;
+ if (have_he_mcs_6)
+ nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_6),
+ &txrate_he_6);
+ if (has_he_gi_6)
+ nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi);
+ if (has_he_ltf_6)
+ nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf);
+ nla_nest_end(msg, nl_band);
+ }
+
nla_nest_end(msg, nl_rates);
return 0;
@@ -407,9 +443,9 @@ static int handle_bitrates(struct nl80211_state *state,
}
#define DESCR_LEGACY "[legacy-<2.4|5> <legacy rate in Mbps>*]"
-#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]"
+#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]"
-COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-2.4:0.8/1.6/3.2] [he-gi-5:0.8/1.6/3.2] [he-ltf-2.4:1/2/4] [he-ltf-5:1/2/4]",
+COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>] [he-ltf-<2.4|5|6> <1|2|4>]",
NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_bitrates,
"Sets up the specified rate masks.\n"
"Not passing any arguments would clear the existing mask (if any).");
--
2.7.4

View File

@@ -1,165 +0,0 @@
From c6e29601fc643c84ada00fc065e1d54353a4f6a3 Mon Sep 17 00:00:00 2001
From: Muna Sinada <msinada@codeaurora.org>
Date: Thu, 8 Oct 2020 04:59:37 -0700
Subject: [PATCH] iw: Add HE UL MU fixed rate setting
Adding mcs fixed rate settings for HE UL MU traffic, which
encompasses both UL-OFDMA and UL-MUMIO.
Signed-off-by: Muna Sinada <msinada@codeaurora.org>
---
bitrate.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------
nl80211.h | 1 +
2 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/bitrate.c b/bitrate.c
index 323bf4ce5fe7..bd91461938e9 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -156,6 +156,7 @@ static int handle_bitrates(struct nl80211_state *state,
bool have_ht_mcs_24 = false, have_ht_mcs_5 = false;
bool have_vht_mcs_24 = false, have_vht_mcs_5 = false;
bool have_he_mcs_24 = false, have_he_mcs_5 = false;
+ bool have_he_ul_mcs_24 = false, have_he_ul_mcs_5 = false;
bool have_he_mcs_6 = false;
uint8_t ht_mcs_24[77], ht_mcs_5[77];
int n_ht_mcs_24 = 0, n_ht_mcs_5 = 0;
@@ -164,16 +165,20 @@ static int handle_bitrates(struct nl80211_state *state,
struct nl80211_txrate_he txrate_he_24 = {};
struct nl80211_txrate_he txrate_he_5 = {};
struct nl80211_txrate_he txrate_he_6 = {};
+ struct nl80211_txrate_he txrate_he_ul_24 = {};
+ struct nl80211_txrate_he txrate_he_ul_5 = {};
uint8_t *mcs = NULL;
int *n_mcs = NULL;
char *vht_argv_5[VHT_ARGC_MAX] = {}; char *vht_argv_24[VHT_ARGC_MAX] = {};
char *he_argv_5[VHT_ARGC_MAX] = {}; char *he_argv_24[VHT_ARGC_MAX] = {};
char *he_argv_6[VHT_ARGC_MAX] = {};
- char **vht_argv = NULL, **he_argv = NULL;
+ char *he_ul_argv_5[VHT_ARGC_MAX] = {}; char *he_ul_argv_24[VHT_ARGC_MAX] = {};
+ char **vht_argv = NULL, **he_argv = NULL, **he_ul_argv = NULL;
int vht_argc_5 = 0; int vht_argc_24 = 0;
int he_argc_5 = 0; int he_argc_24 = 0;
int he_argc_6 = 0;
- int *vht_argc = NULL, *he_argc = NULL;
+ int he_ul_argc_5 = 0; int he_ul_argc_24 = 0;
+ int *vht_argc = NULL, *he_argc = NULL, *he_ul_argc = NULL;
int sgi_24 = 0, sgi_5 = 0, lgi_24 = 0, lgi_5 = 0;
int has_he_gi_24 = 0, has_he_gi_5 = 0, has_he_ltf_24 = 0, has_he_ltf_5 = 0;
int has_he_gi_6 = 0, has_he_ltf_6 = 0;
@@ -189,6 +194,7 @@ static int handle_bitrates(struct nl80211_state *state,
S_GI,
S_HE_GI,
S_HE_LTF,
+ S_HE_UL,
} parser_state = S_NONE;
for (i = 0; i < argc; i++) {
@@ -290,6 +296,20 @@ static int handle_bitrates(struct nl80211_state *state,
} else if (strcmp(argv[i], "he-ltf-6") == 0) {
has_he_ltf_6 = 1;
parser_state = S_HE_LTF;
+ } else if (strcmp(argv[i], "he-ul-mcs-2.4") == 0) {
+ if (have_he_ul_mcs_24)
+ return 1;
+ parser_state = S_HE_UL;
+ he_ul_argv = he_ul_argv_24;
+ he_ul_argc = &he_ul_argc_24;
+ have_he_ul_mcs_24 = true;
+ } else if (strcmp(argv[i], "he-ul-mcs-5") == 0) {
+ if (have_he_ul_mcs_5)
+ return 1;
+ parser_state = S_HE_UL;
+ he_ul_argv = he_ul_argv_5;
+ he_ul_argc = &he_ul_argc_5;
+ have_he_ul_mcs_5 = true;
} else switch (parser_state) {
case S_LEGACY:
tmpd = strtod(argv[i], &end);
@@ -330,6 +350,11 @@ static int handle_bitrates(struct nl80211_state *state,
return 1;
he_ltf = he_ltf >> 1;
break;
+ case S_HE_UL:
+ if (*he_ul_argc >= VHT_ARGC_MAX)
+ return 1;
+ he_ul_argv[(*he_ul_argc)++] = argv [i];
+ break;
default:
return 1;
}
@@ -367,12 +392,20 @@ static int handle_bitrates(struct nl80211_state *state,
return 1;
}
+ if (have_he_ul_mcs_24)
+ if (!setup_he(&txrate_he_ul_24, he_ul_argc_24, he_ul_argv_24))
+ return -EINVAL;
+
+ if (have_he_ul_mcs_5)
+ if (!setup_he(&txrate_he_ul_5, he_ul_argc_5, he_ul_argv_5))
+ return -EINVAL;
+
nl_rates = nla_nest_start(msg, NL80211_ATTR_TX_RATES);
if (!nl_rates)
goto nla_put_failure;
if (have_legacy_24 || have_ht_mcs_24 || have_vht_mcs_24 || have_he_mcs_24 ||
- sgi_24 || lgi_24 || has_he_gi_24 || has_he_ltf_24) {
+ sgi_24 || lgi_24 || has_he_gi_24 || has_he_ltf_24 || have_he_ul_mcs_24) {
nl_band = nla_nest_start(msg, NL80211_BAND_2GHZ);
if (!nl_band)
goto nla_put_failure;
@@ -393,11 +426,14 @@ static int handle_bitrates(struct nl80211_state *state,
nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi);
if (has_he_ltf_24)
nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf);
+ if (have_he_ul_mcs_24)
+ nla_put(msg, NL80211_TXRATE_HE_UL, sizeof(txrate_he_ul_24),
+ &txrate_he_ul_24);
nla_nest_end(msg, nl_band);
}
if (have_legacy_5 || have_ht_mcs_5 || have_vht_mcs_5 || have_he_mcs_5 ||
- sgi_5 || lgi_5 || has_he_gi_5 || has_he_ltf_5) {
+ sgi_5 || lgi_5 || has_he_gi_5 || has_he_ltf_5 || have_he_ul_mcs_5) {
nl_band = nla_nest_start(msg, NL80211_BAND_5GHZ);
if (!nl_band)
goto nla_put_failure;
@@ -418,6 +454,9 @@ static int handle_bitrates(struct nl80211_state *state,
nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi);
if (has_he_ltf_5)
nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf);
+ if (have_he_ul_mcs_5)
+ nla_put(msg, NL80211_TXRATE_HE_UL, sizeof(txrate_he_ul_5),
+ &txrate_he_ul_5);
nla_nest_end(msg, nl_band);
}
@@ -443,9 +482,9 @@ static int handle_bitrates(struct nl80211_state *state,
}
#define DESCR_LEGACY "[legacy-<2.4|5> <legacy rate in Mbps>*]"
-#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]"
+#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-ul-mcs-<2.4|5> <NSS:MCS>]"
-COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>] [he-ltf-<2.4|5|6> <1|2|4>]",
+COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>] [he-ltf-<2.4|5|6> <1|2|4>] [he-ul-mcs-<2.4|5> <NSS:MCS>]",
NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_bitrates,
"Sets up the specified rate masks.\n"
"Not passing any arguments would clear the existing mask (if any).");
diff --git a/nl80211.h b/nl80211.h
index 17386c0d8c8f..5f1faaf27760 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -4589,6 +4589,7 @@ enum nl80211_tx_rate_attributes {
NL80211_TXRATE_HE,
NL80211_TXRATE_HE_GI,
NL80211_TXRATE_HE_LTF,
+ NL80211_TXRATE_HE_UL,
/* keep last */
__NL80211_TXRATE_AFTER_LAST,
--
2.7.4

View File

@@ -26,7 +26,6 @@ drv_mac80211_init_device_config() {
hostapd_common_add_device_config
config_add_string path phy 'macaddr:macaddr'
config_add_string hwmode
config_add_string tx_burst
config_add_string distance
config_add_int beacon_int chanbw frag rts
@@ -44,11 +43,24 @@ drv_mac80211_init_device_config() {
su_beamformee \
mu_beamformer \
mu_beamformee \
he_su_beamformer \
he_su_beamformee \
he_mu_beamformer \
vht_txop_ps \
htc_vht \
rx_antenna_pattern \
tx_antenna_pattern
config_add_int vht_max_a_mpdu_len_exp vht_max_mpdu vht_link_adapt vht160 rx_stbc tx_stbc
tx_antenna_pattern \
he_spr_sr_control \
he_twt_required
config_add_int \
vht_max_a_mpdu_len_exp \
vht_max_mpdu \
vht_link_adapt \
vht160 \
rx_stbc \
tx_stbc \
he_bss_color \
he_spr_non_srg_obss_pd_max_offset
config_add_boolean \
ldpc \
greenfield \
@@ -56,13 +68,6 @@ drv_mac80211_init_device_config() {
short_gi_40 \
max_amsdu \
dsss_cck_40
config_add_int \
he_su_beamformer \
he_su_beamformee \
he_mu_beamformer \
he_bss_color \
he_spr_sr_control \
he_spr_non_srg_obss_pd_max_offset
}
drv_mac80211_init_iface_config() {
@@ -76,7 +81,6 @@ drv_mac80211_init_iface_config() {
config_add_int max_listen_int
config_add_int dtim_period
config_add_int start_disabled
config_add_int he_twt_required he_spr_sr_control
# mesh
config_add_string mesh_id
@@ -112,7 +116,10 @@ mac80211_add_he_capabilities() {
for capab in "$@"; do
set -- $capab
[ "$(($4))" -gt 0 ] || continue
[ "$(((0x$2) & $3))" -gt 0 ] || continue
[ "$(((0x$2) & $3))" -gt 0 ] || {
eval "$4=0"
continue
}
append base_cfg "$1=1" "$N"
done
IFS="$oifs"
@@ -197,11 +204,6 @@ mac80211_hostapd_setup_base() {
[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))"
conf_tx_ant=$(iw phy "$phy" info | grep 'Configured Antennas:' | cut -d: -f2)
set -- $conf_tx_ant
if [ "$2" == "0x1" -o "$2" == "0x10" ]; then
tx_stbc=0
fi
mac80211_add_capabilities ht_capab_flags $ht_cap_mask \
LDPC:0x1::$ldpc \
GF:0x10::$greenfield \
@@ -222,12 +224,14 @@ mac80211_hostapd_setup_base() {
enable_ac=0
vht_oper_chwidth=0
vht_center_seg0=
chan_ofs=0
[ "$band" = "6g" ] && chan_ofs=1
idx="$channel"
case "$htmode" in
VHT20|HE20) enable_ac=1;;
VHT40|HE40)
case "$(( ($channel / 4) % 2 ))" in
case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
1) idx=$(($channel + 2));;
0) idx=$(($channel - 2));;
esac
@@ -235,7 +239,7 @@ mac80211_hostapd_setup_base() {
vht_center_seg0=$idx
;;
VHT80|HE80)
case "$(( ($channel / 4) % 4 ))" in
case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
1) idx=$(($channel + 6));;
2) idx=$(($channel + 2));;
3) idx=$(($channel - 2));;
@@ -246,15 +250,35 @@ mac80211_hostapd_setup_base() {
vht_center_seg0=$idx
;;
VHT160|HE160)
case "$channel" in
36|40|44|48|52|56|60|64) idx=50;;
100|104|108|112|116|120|124|128) idx=114;;
esac
if [ "$band" = "6g" ]; then
case "$channel" in
1|5|9|13|17|21|25|29) idx=15;;
33|37|41|45|49|53|57|61) idx=47;;
65|69|73|77|81|85|89|93) idx=79;;
97|101|105|109|113|117|121|125) idx=111;;
129|133|137|141|145|149|153|157) idx=143;;
161|165|169|173|177|181|185|189) idx=175;;
193|197|201|205|209|213|217|221) idx=207;;
esac
else
case "$channel" in
36|40|44|48|52|56|60|64) idx=50;;
100|104|108|112|116|120|124|128) idx=114;;
esac
fi
enable_ac=1
vht_oper_chwidth=2
vht_center_seg0=$idx
;;
esac
[ "$band" = "6g" ] && {
op_class=
case "$htmode" in
HE20) op_class=131;;
HE*) op_class=$((132 + $vht_oper_chwidth))
esac
[ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
}
[ "$hwmode" = "a" ] || enable_ac=0
if [ "$enable_ac" != "0" ]; then
@@ -291,11 +315,6 @@ mac80211_hostapd_setup_base() {
[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
conf_tx_ant=$(iw phy "$phy" info | grep 'Configured Antennas:' | cut -d: -f2)
set -- $conf_tx_ant
if [ "$2" == "0x1" -o "$2" == "0x10" ]; then
tx_stbc_2by1=0
fi
mac80211_add_capabilities vht_capab $vht_cap \
RXLDPC:0x10::$rxldpc \
SHORT-GI-80:0x20::$short_gi_80 \
@@ -365,9 +384,7 @@ mac80211_hostapd_setup_base() {
# 802.11ax
enable_ax=0
case "$htmode" in
HE20|HE40|HE80| HE160)
enable_ax=1
;;
HE*) enable_ax=1 ;;
esac
if [ "$enable_ax" != "0" ]; then
@@ -378,20 +395,20 @@ mac80211_hostapd_setup_base() {
he_twt_required:0 \
he_spr_sr_control:0 \
he_spr_non_srg_obss_pd_max_offset:1 \
he_bss_color:64
he_bss_color
append base_cfg "ieee80211ax=1" "$N"
append base_cfg "he_bss_color=$he_bss_color" "$N"
[ "$hwmode" = "a" ] && {
append base_cfg "he_oper_chwidth=$vht_oper_chwidth" "$N"
append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
}
he_phy_cap=$(iw phy "$phy" info | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
he_phy_cap=${he_phy_cap:2}
he_mac_cap=$(iw phy "$phy" info | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1)
he_mac_cap=${he_mac_cap:2}
append base_cfg "ieee80211ax=1" "$N"
[ -n "$he_bss_color" ] && append base_cfg "he_bss_color=$he_bss_color" "$N"
[ "$hwmode" = "a" ] && {
append base_cfg "he_oper_chwidth=$vht_oper_chwidth" "$N"
append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
}
mac80211_add_he_capabilities \
he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
@@ -399,10 +416,7 @@ mac80211_hostapd_setup_base() {
he_spr_sr_control:${he_phy_cap:14:2}:0x1:$he_spr_sr_control \
he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
[ "$he_spr_sr_control" != "0" ] && {
append base_cfg "he_spr_sr_control=$he_spr_sr_control" "$N"
append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
}
[ "$he_spr_sr_control" -gt 0 ] && append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
append base_cfg "he_default_pe_duration=4" "$N"
append base_cfg "he_rts_threshold=1023" "$N"
@@ -484,7 +498,6 @@ mac80211_get_addr() {
mac80211_generate_mac() {
local phy="$1"
local multiple_bssid="$2"
local id="${macidx:-0}"
local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
@@ -493,7 +506,7 @@ mac80211_generate_mac() {
[ "$mask" = "00:00:00:00:00:00" ] && {
mask="ff:ff:ff:ff:ff:ff";
[ "$(wc -l < /sys/class/ieee80211/${phy}/addresses)" -gt 1 ] && {
[ "$(wc -l < /sys/class/ieee80211/${phy}/addresses)" -gt $id ] && {
addr="$(mac80211_get_addr "$phy" "$id")"
[ -n "$addr" ] && {
echo "$addr"
@@ -509,16 +522,11 @@ mac80211_generate_mac() {
local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS"
[ "$multiple_bssid" -eq 1 ] && {
printf "02:%s:%s:%s:%s:%02x" $b1 $2 $3 $4 $5 $macidx
return
}
macidx=$(($id + 1))
[ "$((0x$mask1))" -gt 0 ] && {
b1="0x$1"
[ "$id" -gt 0 ] && \
b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2) | 0x2)))
b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2))
printf "%02x:%s:%s:%s:%s:%s" $b1 $2 $3 $4 $5 $6
return
}
@@ -622,7 +630,6 @@ mac80211_iw_interface_add() {
}
mac80211_prepare_vif() {
local multiple_bssid=$1
json_select config
json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file
@@ -636,7 +643,7 @@ mac80211_prepare_vif() {
json_select ..
[ -n "$macaddr" ] || {
macaddr="$(mac80211_generate_mac $phy $multiple_bssid)"
macaddr="$(mac80211_generate_mac $phy)"
macidx="$(($macidx + 1))"
}
@@ -777,17 +784,10 @@ mac80211_setup_supplicant_noctl() {
mac80211_prepare_iw_htmode() {
case "$htmode" in
VHT20|HT20|HE20) iw_htmode=HT20;;
HT40*|VHT40|VHT160|\
HE40|HE40|HE160)
case "$hwmode" in
a)
case "$(( ($channel / 4) % 2 ))" in
1) iw_htmode="HT40+" ;;
0) iw_htmode="HT40-";;
esac
;;
*)
VHT20|HT20) iw_htmode=HT20;;
HT40*|VHT40|VHT160)
case "$band" in
2g)
case "$htmode" in
HT40+) iw_htmode="HT40+";;
HT40-) iw_htmode="HT40-";;
@@ -800,10 +800,16 @@ mac80211_prepare_iw_htmode() {
;;
esac
;;
*)
case "$(( ($channel / 4) % 2 ))" in
1) iw_htmode="HT40+" ;;
0) iw_htmode="HT40-";;
esac
;;
esac
[ "$auto_channel" -gt 0 ] && iw_htmode="HT40+"
;;
VHT80|HE80)
VHT80)
iw_htmode="80MHZ"
;;
NONE|NOHT)
@@ -909,7 +915,6 @@ mac80211_setup_vif() {
mesh)
wireless_vif_parse_encryption
[ -z "$htmode" ] && htmode="NOHT";
freq="$(get_freq "$phy" "$channel")"
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then
mac80211_setup_supplicant $vif_enable || failed=1
else
@@ -923,7 +928,6 @@ mac80211_setup_vif() {
adhoc)
wireless_vif_parse_encryption
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then
freq="$(get_freq "$phy" "$channel")"
mac80211_setup_supplicant_noctl $vif_enable || failed=1
else
mac80211_setup_adhoc $vif_enable
@@ -940,10 +944,30 @@ mac80211_setup_vif() {
get_freq() {
local phy="$1"
local chan="$2"
iw "$phy" info | grep -E -m1 "(\* ${chan:-....} MHz${chan:+|\\[$chan\\]})" | grep MHz | awk '{print $2}'
local channel="$2"
local band="$3"
case "$band" in
2g) band="1:";;
5g) band="2:";;
60g) band="3:";;
6g) band="4:";;
esac
iw "$phy" info | awk -v band="$band" -v channel="[$channel]" '
$1 ~ /Band/ {
band_match = band == $2
}
band_match && $3 == "MHz" && $4 == channel {
print $2
exit
}
'
}
chan_is_dfs() {
local phy="$1"
local chan="$2"
@@ -987,8 +1011,7 @@ drv_mac80211_setup() {
country chanbw distance \
txpower antenna_gain \
rxantenna txantenna \
frag rts beacon_int:100 htmode \
multiple_bssid:0
frag rts beacon_int:100 htmode
json_get_values basic_rate_list basic_rate
json_get_values scan_list scan_list
json_select ..
@@ -1027,7 +1050,7 @@ drv_mac80211_setup() {
done
# convert channel to frequency
[ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel")"
[ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel" "$band")"
[ -n "$country" ] && {
iw reg get | grep -q "^country $country:" || {
@@ -1083,7 +1106,7 @@ drv_mac80211_setup() {
mac80211_prepare_iw_htmode
for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
NEWAPLIST=
for_each_interface "ap" mac80211_prepare_vif ${multiple_bssid}
for_each_interface "ap" mac80211_prepare_vif
NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file})
OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5)
if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then
@@ -1111,15 +1134,14 @@ drv_mac80211_setup() {
if [ "$no_reload" != "0" ]; then
add_ap=1
ubus wait_for hostapd
ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}"
local hostapd_pid=$(ubus call service list '{"name": "wpad"}' | jsonfilter -l 1 -e "@['wpad'].instances['hostapd'].pid")
wireless_add_process "$hostapd_pid" "/usr/sbin/hostapd" 1
local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")"
ret="$?"
[ "$ret" != 0 -o -z "$hostapd_res" ] && {
wireless_setup_failed HOSTAPD_START_FAILED
return
}
wireless_add_process "$(jsonfilter -s "$hostapd_res" -l 1 -e @.pid)" "/usr/sbin/hostapd" 1 1
fi
ret="$?"
[ "$ret" != 0 ] && {
wireless_setup_failed HOSTAPD_START_FAILED
return
}
}
uci -q -P /var/state set wireless._${phy}.aplist="${NEWAPLIST}"
uci -q -P /var/state set wireless._${phy}.md5="${NEW_MD5}"

View File

@@ -57,6 +57,85 @@ check_mac80211_device() {
[ "$phy" = "$dev" ] && found=1
}
__get_band_defaults() {
local phy="$1"
( iw phy "$phy" info; echo ) | awk '
BEGIN {
bands = ""
}
($1 == "Band" || $1 == "") && band {
if (channel) {
mode="NOHT"
if (ht) mode="HT20"
if (vht) mode="VHT80"
if (he) mode="HE80"
if (he && band == "1:") mode="HE20"
sub("\\[", "", channel)
sub("\\]", "", channel)
bands = bands band channel ":" mode " "
}
band=""
}
$1 == "Band" {
band = $2
channel = ""
vht = ""
ht = ""
he = ""
}
$0 ~ "Capabilities:" {
ht=1
}
$0 ~ "VHT Capabilities:" {
vht=1
}
$0 ~ "HE Iftypes" {
he=1
}
$1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel {
channel = $4
}
END {
print bands
}'
}
get_band_defaults() {
local phy="$1"
for c in $(__get_band_defaults "$phy"); do
local band="${c%%:*}"
c="${c#*:}"
local chan="${c%%:*}"
c="${c#*:}"
local mode="${c%%:*}"
case "$band" in
1) band=2g;;
2) band=5g;;
3) band=60g;;
4) band=6g;;
*) band="";;
esac
[ -n "$band" ] || continue
[ -n "$mode_band" -a "$band" = "6g" ] && return
mode_band="$band"
channel="$chan"
htmode="$mode"
done
}
detect_mac80211() {
devidx=0
config_load wireless
@@ -75,31 +154,12 @@ detect_mac80211() {
config_foreach check_mac80211_device wifi-device
[ "$found" -gt 0 ] && continue
mode_band="g"
channel="11"
mode_band=""
channel=""
htmode=""
ht_capab=""
iw phy "$dev" info | grep -q 'Capabilities:' && {
htmode=HT20
iw phy "$dev" info | grep -q 'HE.*Capabilities' && htmode="HE20"
}
iw phy "$dev" info | grep -q '5180 MHz' && {
mode_band="a"
channel="36"
iw phy "$dev" info | grep -q '5180 MHz.*disabled' && channel=149
iw phy "$dev" info | grep -q 'VHT Capabilities' && htmode="VHT80"
iw phy "$dev" info | grep -q 'HE.*Capabilities' && htmode="HE80"
}
iw phy "$dev" info | grep -q '5955 MHz' && {
mode_band="a"
channel="1"
htmode="HE80"
}
[ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
get_band_defaults "$dev"
path="$(mac80211_phy_to_path "$dev")"
if [ -n "$path" ]; then
@@ -111,10 +171,10 @@ detect_mac80211() {
uci -q batch <<-EOF
set wireless.radio${devidx}=wifi-device
set wireless.radio${devidx}.type=mac80211
set wireless.radio${devidx}.channel=${channel}
set wireless.radio${devidx}.hwmode=11${mode_band}
${dev_id}
${ht_capab}
set wireless.radio${devidx}.channel=${channel}
set wireless.radio${devidx}.band=${mode_band}
set wireless.radio${devidx}.htmode=$htmode
set wireless.radio${devidx}.disabled=1
set wireless.default_radio${devidx}=wifi-iface

View File

@@ -1,7 +1,7 @@
From 08ee04152e51ed8bf1eddd3b914ae23c53541814 Mon Sep 17 00:00:00 2001
From 70327bf769598c991896f6216bc23b3c6d6be46d Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sat, 18 Jul 2020 08:53:44 +0200
Subject: [PATCH 01/18] ipq807x: add the Qualcomm AX target support
Subject: [PATCH 01/23] ipq807x: add the Qualcomm AX target support
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -19,7 +19,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
.../ipq807x/base-files/etc/init.d/bootcount | 12 +
.../linux/ipq807x/base-files/etc/init.d/wdt | 14 +
...G4_v5.4.B-AQR_CIG_WIFI_ID44715_VER1673.cld | Bin 0 -> 391170 bytes
.../base-files/lib/upgrade/platform.sh | 62 +
.../base-files/lib/upgrade/platform.sh | 64 +
target/linux/ipq807x/config-4.4 | 821 +++++++++
.../arm/boot/dts/qcom-ipq6018-cig-wf188.dts | 18 +
.../arm/boot/dts/qcom-ipq6018-cig-wf188n.dts | 18 +
@@ -38,10 +38,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
target/linux/ipq807x/ipq60xx/config-default | 144 ++
.../linux/ipq807x/ipq60xx/profiles/default.mk | 9 +
target/linux/ipq807x/ipq60xx/target.mk | 8 +
target/linux/ipq807x/ipq807x/config-default | 74 +
target/linux/ipq807x/ipq807x/config-default | 75 +
.../linux/ipq807x/ipq807x/profiles/default.mk | 9 +
target/linux/ipq807x/ipq807x/target.mk | 7 +
target/linux/ipq807x/modules.mk | 58 +
target/linux/ipq807x/modules.mk | 61 +
.../linux/ipq807x/patches/100-qrtr-ns.patch | 976 +++++++++++
.../linux/ipq807x/patches/101-squashfs.patch | 16 +
.../linux/ipq807x/patches/102-cig-wf188.patch | 869 ++++++++++
@@ -53,7 +53,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
.../linux/ipq807x/patches/108-log-spam.patch | 37 +
target/linux/ipq807x/patches/109-tplink.patch | 1518 +++++++++++++++++
.../ipq807x/patches/110-add-esmt-nand.patch | 37 +
48 files changed, 9307 insertions(+), 3 deletions(-)
48 files changed, 9313 insertions(+), 3 deletions(-)
create mode 100644 package/boot/uboot-envtools/files/ipq807x
create mode 100644 target/linux/ipq807x/109-logspam.patch
create mode 100644 target/linux/ipq807x/Makefile
@@ -312,7 +312,7 @@ index 0000000000..39f4c941c0
+exit 0
diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network
new file mode 100755
index 0000000000..d2c7687947
index 0000000000..eaa440943b
--- /dev/null
+++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
@@ -0,0 +1,77 @@
@@ -341,10 +341,6 @@ index 0000000000..d2c7687947
+ ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth4"
+ ucidef_set_interface_wan "eth5"
+ ;;
+ xiaomi,ax1800)
+ ucidef_set_interface_lan "eth0 eth1 eth2"
+ ucidef_set_interface_wan "eth3"
+ ;;
+ cig,wf194c|\
+ sercomm,wallaby)
+ ucidef_set_interface_lan "eth0"
@@ -359,6 +355,10 @@ index 0000000000..d2c7687947
+ ucidef_set_interface_lan "eth1"
+ ucidef_set_interface_wan "eth0"
+ ;;
+ qcom,ipq807x-hk14)
+ ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
+ ucidef_set_interface_wan "eth4"
+ ;;
+ esac
+}
+
@@ -4736,10 +4736,10 @@ HcmV?d00001
diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
new file mode 100755
index 0000000000..ef940fe13c
index 0000000000..de64559bce
--- /dev/null
+++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,62 @@
@@ -0,0 +1,64 @@
+. /lib/functions/system.sh
+
+qca_do_upgrade() {
@@ -4770,7 +4770,8 @@ index 0000000000..ef940fe13c
+ tplink,ex227|\
+ tplink,ex447|\
+ qcom,ipq6018-cp01|\
+ qcom,ipq807x-hk01)
+ qcom,ipq807x-hk01|\
+ qcom,ipq807x-hk14)
+ [ "$magic_long" = "73797375" ] && return 0
+ ;;
+ esac
@@ -4791,6 +4792,7 @@ index 0000000000..ef940fe13c
+ cig,wf194c|\
+ qcom,ipq6018-cp01|\
+ qcom,ipq807x-hk01|\
+ qcom,ipq807x-hk14|\
+ tplink,ex447|\
+ tplink,ex227)
+ nand_upgrade_tar "$1"
@@ -7578,10 +7580,10 @@ index 0000000000..cf2bf7b9cd
+endef
diff --git a/target/linux/ipq807x/ipq807x/config-default b/target/linux/ipq807x/ipq807x/config-default
new file mode 100644
index 0000000000..74862253e6
index 0000000000..837fdcda8a
--- /dev/null
+++ b/target/linux/ipq807x/ipq807x/config-default
@@ -0,0 +1,74 @@
@@ -0,0 +1,75 @@
+# CONFIG_AHCI_IPQ is not set
+CONFIG_ARCH_IPQ807x=y
+# CONFIG_DIAGFWD_BRIDGE_CODE is not set
@@ -7656,6 +7658,7 @@ index 0000000000..74862253e6
+CONFIG_QCOM_QMI_POWER_COLLAPSE=y
+CONFIG_RMNET_CTL=y
+CONFIG_RMNET_CTL_DEBUG=y
+# CONFIG_MHI_BUS_TEST is not set
diff --git a/target/linux/ipq807x/ipq807x/profiles/default.mk b/target/linux/ipq807x/ipq807x/profiles/default.mk
new file mode 100644
index 0000000000..f47e73acfc
@@ -7686,10 +7689,10 @@ index 0000000000..7c24b66e60
+endef
diff --git a/target/linux/ipq807x/modules.mk b/target/linux/ipq807x/modules.mk
new file mode 100644
index 0000000000..3b772a5726
index 0000000000..0223ff2590
--- /dev/null
+++ b/target/linux/ipq807x/modules.mk
@@ -0,0 +1,58 @@
@@ -0,0 +1,61 @@
+define KernelPackage/usb-phy-ipq807x
+ TITLE:=DWC3 USB QCOM PHY driver for IPQ807x
+ DEPENDS:=@TARGET_ipq807x
@@ -7716,6 +7719,9 @@ index 0000000000..3b772a5726
+ DEPENDS+= @TARGET_ipq807x
+ KCONFIG:= \
+ CONFIG_QRTR=y \
+ CONFIG_QRTR_MHI=y \
+ CONFIG_MHI_BUS=y \
+ CONFIG_MHI_QTI=y \
+ CONFIG_QCOM_APCS_IPC=y \
+ CONFIG_QCOM_GLINK_SSR=y \
+ CONFIG_QCOM_Q6V5_WCSS=y \

View File

@@ -0,0 +1,197 @@
From 842b431559c3992e182190b7f96c4407978723c7 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 27 May 2021 16:48:27 +0200
Subject: [PATCH] ramips: add tplink ex228 support
Signed-off-by: John Crispin <john@phrozen.org>
---
.../linux/ramips/dts/mt7621_tplink_ex228.dts | 129 ++++++++++++++++++
target/linux/ramips/image/mt7621.mk | 10 ++
.../mt7621/base-files/etc/board.d/02_network | 1 +
.../mt7621/base-files/lib/upgrade/platform.sh | 1 +
4 files changed, 141 insertions(+)
create mode 100644 target/linux/ramips/dts/mt7621_tplink_ex228.dts
diff --git a/target/linux/ramips/dts/mt7621_tplink_ex228.dts b/target/linux/ramips/dts/mt7621_tplink_ex228.dts
new file mode 100644
index 0000000000..9e5cc9ef01
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_tplink_ex228.dts
@@ -0,0 +1,129 @@
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "tplink,ex228", "mediatek,mt7621-soc";
+ model = "TP-Link EX228";
+
+ aliases {
+ led-boot = &led_status;
+ led-failsafe = &led_status;
+ led-running = &led_status;
+ led-upgrade = &led_status;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_status: blue {
+ label = "blue:status";
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+ };
+
+ green {
+ label = "green:system";
+ gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+ };
+
+ red {
+ label = "green:system";
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+};
+
+&nand {
+ status = "okay";
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x80000>;
+ read-only;
+ };
+
+ partition@80000 {
+ label = "u-boot-env";
+ reg = <0x80000 0x80000>;
+ read-only;
+ };
+
+ factory: partition@100000 {
+ label = "factory";
+ reg = <0x100000 0x80000>;
+ read-only;
+ };
+
+ partition@180000 {
+ label = "kernel";
+ reg = <0x180000 0x400000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x7a60000>;
+ };
+ };
+};
+
+&pcie {
+ status = "okay";
+};
+
+&pcie1 {
+ mt76@0,0 {
+ reg = <0x0000 0 0 0 0>;
+ mediatek,mtd-eeprom = <&factory 0x0000>;
+ };
+};
+
+&switch0 {
+ ports {
+ port@1 {
+ status = "okay";
+ label = "lan1";
+ };
+
+ port@2 {
+ status = "okay";
+ label = "lan2";
+ };
+
+ port@3 {
+ status = "okay";
+ label = "lan3";
+ };
+
+ port@0 {
+ status = "okay";
+ label = "wan";
+ };
+ };
+};
+
+&state_default {
+ gpio {
+ groups = "uart3", "jtag";
+ function = "gpio";
+ };
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index a8f558326d..1a84abc842 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1138,6 +1138,16 @@ define Device/tplink_eap235-wall-v1
endef
TARGET_DEVICES += tplink_eap235-wall-v1
+define Device/tplink_ex228
+ $(Device/uimage-lzma-loader)
+ DEVICE_VENDOR := TP-Link
+ DEVICE_MODEL := EX228
+ DEVICE_PACKAGES := kmod-mt7915e
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | check-size
+ IMAGE_SIZE=20000k
+endef
+TARGET_DEVICES += tplink_ex228
+
define Device/tplink_re350-v1
$(Device/dsa-migration)
$(Device/tplink-safeloader)
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 89e679be7c..b6b8b6482d 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -36,6 +36,7 @@ ramips_setup_interfaces()
;;
gehua,ghl-r-001|\
hiwifi,hc5962|\
+ tplink,ex228|\
xiaomi,mi-router-3-pro|\
xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100)
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index c9152c5cf4..853a464ea5 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -61,6 +61,7 @@ platform_do_upgrade() {
netgear,wac104|\
netgear,wac124|\
netis,wf2881|\
+ tplink,ex228|\
xiaomi,mi-router-3g|\
xiaomi,mi-router-3-pro|\
xiaomi,mi-router-4|\
--
2.25.1

View File

@@ -1,476 +0,0 @@
From 5171503cfa4387370fd4c33bbcf0d8c4b6ec86e4 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 18 May 2021 10:46:43 +0200
Subject: [PATCH] netifd/libubox: update to latest HEAD
* required for wired ieee8021x
Signed-off-by: John Crispin <john@phrozen.org>
---
package/libs/libubox/Makefile | 4 +-
package/network/config/netifd/Makefile | 4 +-
.../config/netifd/patches/100-8021x.patch | 421 ++++++++++++++++++
3 files changed, 425 insertions(+), 4 deletions(-)
create mode 100644 package/network/config/netifd/patches/100-8021x.patch
diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile
index 4d582eacfd..8644764d59 100644
--- a/package/libs/libubox/Makefile
+++ b/package/libs/libubox/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
-PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255
+#PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255
PKG_SOURCE_DATE:=2020-12-12
-PKG_SOURCE_VERSION:=357877693ca363b12e6e7e14d345639b2440cd07
+PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
CMAKE_INSTALL:=1
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index 7061456b08..03e3c3ca2a 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -6,8 +6,8 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
PKG_SOURCE_DATE:=2021-01-09
-PKG_SOURCE_VERSION:=c00c8335d6188daa326ecfe5a62da15a9b9987e1
-PKG_MIRROR_HASH:=c740e51e0cec13eec336ba1c7a643db3b64a9a2235f8c1b73a566cb89e841190
+PKG_SOURCE_VERSION:=3052f2f67686f3d540d4d941e4664730de530741
+#PKG_MIRROR_HASH:=c740e51e0cec13eec336ba1c7a643db3b64a9a2235f8c1b73a566cb89e841190
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0
diff --git a/package/network/config/netifd/patches/100-8021x.patch b/package/network/config/netifd/patches/100-8021x.patch
new file mode 100644
index 0000000000..eb8eaaa6fb
--- /dev/null
+++ b/package/network/config/netifd/patches/100-8021x.patch
@@ -0,0 +1,421 @@
+Return-path: <nbd@nbd.name>
+X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ds12
+X-Spam-Level:
+X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2
+Envelope-to: john@phrozen.org
+Delivery-date: Mon, 17 May 2021 11:23:58 +0200
+Received: from p54ae9ff2.dip0.t-ipconnect.de ([84.174.159.242] helo=localhost.localdomain)
+ by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
+ (Exim 4.89)
+ (envelope-from <nbd@nbd.name>)
+ id 1liZTi-0007JJ-8s
+ for john@phrozen.org; Mon, 17 May 2021 11:23:58 +0200
+From: Felix Fietkau <nbd@nbd.name>
+To: john@phrozen.org
+Subject: [PATCH netifd] device: add support for configuring devices with external auth handler
+Date: Mon, 17 May 2021 11:23:56 +0200
+Message-Id: <20210517092356.85402-1-nbd@nbd.name>
+X-Mailer: git-send-email 2.30.1
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+
+This can be used to support 802.1x on wired devices.
+In order to use this, the device section for each port needing authentication
+needs to contain the option auth 1
+When set, this option prevents devices from being added to bridges or configured
+with IP settings by default, until the set_state ubus call on network.device
+sets "auth_status" to true for the device.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+ bridge.c | 58 +++++++++++++++++++++++++++++++++++++----------------
+ device.c | 34 +++++++++++++++++++++++++++++++
+ device.h | 17 +++++++++++++++-
+ interface.c | 21 ++++++++++++++-----
+ ubus.c | 6 ++++++
+ 5 files changed, 113 insertions(+), 23 deletions(-)
+
+diff --git a/bridge.c b/bridge.c
+index 099dfe4d24ef..397ac979daaf 100644
+--- a/bridge.c
++++ b/bridge.c
+@@ -122,6 +122,7 @@ struct bridge_member {
+ struct device_user dev;
+ uint16_t pvid;
+ bool present;
++ bool active;
+ char name[];
+ };
+
+@@ -299,19 +300,21 @@ bridge_set_vlan_state(struct bridge_state *bst, struct bridge_vlan *vlan, bool a
+ }
+
+ static int
+-bridge_disable_member(struct bridge_member *bm)
++bridge_disable_member(struct bridge_member *bm, bool keep_dev)
+ {
+ struct bridge_state *bst = bm->bst;
+ struct bridge_vlan *vlan;
+
+- if (!bm->present)
++ if (!bm->present || !bm->active)
+ return 0;
+
++ bm->active = false;
+ vlist_for_each_element(&bst->dev.vlans, vlan, node)
+ bridge_set_member_vlan(bm, vlan, false);
+
+ system_bridge_delif(&bst->dev, bm->dev.dev);
+- device_release(&bm->dev);
++ if (!keep_dev)
++ device_release(&bm->dev);
+
+ device_broadcast_event(&bst->dev, DEV_EVENT_TOPO_CHANGE);
+
+@@ -356,6 +359,7 @@ bridge_enable_member(struct bridge_member *bm)
+ {
+ struct bridge_state *bst = bm->bst;
+ struct bridge_vlan *vlan;
++ struct device *dev;
+ int ret;
+
+ if (!bm->present)
+@@ -375,12 +379,20 @@ bridge_enable_member(struct bridge_member *bm)
+ if (ret < 0)
+ goto error;
+
++ dev = bm->dev.dev;
++ if (dev->settings.auth && !dev->auth_status)
++ return -1;
++
++ if (bm->active)
++ return 0;
++
+ ret = system_bridge_addif(&bst->dev, bm->dev.dev);
+ if (ret < 0) {
+ D(DEVICE, "Bridge device %s could not be added\n", bm->dev.dev->ifname);
+ goto error;
+ }
+
++ bm->active = true;
+ if (bst->has_vlans) {
+ /* delete default VLAN 1 */
+ system_bridge_vlan(bm->dev.dev->ifname, 1, false, 0);
+@@ -412,7 +424,7 @@ bridge_remove_member(struct bridge_member *bm)
+ return;
+
+ if (bst->dev.active)
+- bridge_disable_member(bm);
++ bridge_disable_member(bm, false);
+
+ bm->present = false;
+ bm->bst->n_present--;
+@@ -481,10 +493,11 @@ bridge_check_retry(struct bridge_state *bst)
+ }
+
+ static void
+-bridge_member_cb(struct device_user *dev, enum device_event ev)
++bridge_member_cb(struct device_user *dep, enum device_event ev)
+ {
+- struct bridge_member *bm = container_of(dev, struct bridge_member, dev);
++ struct bridge_member *bm = container_of(dep, struct bridge_member, dev);
+ struct bridge_state *bst = bm->bst;
++ struct device *dev = dep->dev;
+
+ switch (ev) {
+ case DEV_EVENT_ADD:
+@@ -495,19 +508,30 @@ bridge_member_cb(struct device_user *dev, enum device_event ev)
+
+ if (bst->n_present == 1)
+ device_set_present(&bst->dev, true);
+- if (bst->dev.active && !bridge_enable_member(bm)) {
+- /*
+- * Adding a bridge member can overwrite the bridge mtu
+- * in the kernel, apply the bridge settings in case the
+- * bridge mtu is set
+- */
+- system_if_apply_settings(&bst->dev, &bst->dev.settings,
+- DEV_OPT_MTU | DEV_OPT_MTU6);
+- }
++ fallthrough;
++ case DEV_EVENT_AUTH_UP:
++ if (!bst->dev.active)
++ break;
++
++ if (bridge_enable_member(bm))
++ break;
++
++ /*
++ * Adding a bridge member can overwrite the bridge mtu
++ * in the kernel, apply the bridge settings in case the
++ * bridge mtu is set
++ */
++ system_if_apply_settings(&bst->dev, &bst->dev.settings,
++ DEV_OPT_MTU | DEV_OPT_MTU6);
++ break;
++ case DEV_EVENT_LINK_DOWN:
++ if (!dev->settings.auth)
++ break;
+
++ bridge_disable_member(bm, true);
+ break;
+ case DEV_EVENT_REMOVE:
+- if (dev->hotplug) {
++ if (dep->hotplug) {
+ vlist_delete(&bst->members, &bm->node);
+ return;
+ }
+@@ -529,7 +553,7 @@ bridge_set_down(struct bridge_state *bst)
+ bst->set_state(&bst->dev, false);
+
+ vlist_for_each_element(&bst->members, bm, node)
+- bridge_disable_member(bm);
++ bridge_disable_member(bm, false);
+
+ bridge_disable_interface(bst);
+
+diff --git a/device.c b/device.c
+index 7f011b615fbf..26254cc2eb90 100644
+--- a/device.c
++++ b/device.c
+@@ -59,6 +59,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
+ [DEV_ATTR_DROP_GRATUITOUS_ARP] = { .name = "drop_gratuitous_arp", .type = BLOBMSG_TYPE_BOOL },
+ [DEV_ATTR_DROP_UNSOLICITED_NA] = { .name = "drop_unsolicited_na", .type = BLOBMSG_TYPE_BOOL },
+ [DEV_ATTR_ARP_ACCEPT] = { .name = "arp_accept", .type = BLOBMSG_TYPE_BOOL },
++ [DEV_ATTR_AUTH] = { .name = "auth", .type = BLOBMSG_TYPE_BOOL },
+ };
+
+ const struct uci_blob_param_list device_attr_list = {
+@@ -270,6 +271,7 @@ device_merge_settings(struct device *dev, struct device_settings *n)
+ s->drop_unsolicited_na : os->drop_unsolicited_na;
+ n->arp_accept = s->flags & DEV_OPT_ARP_ACCEPT ?
+ s->arp_accept : os->arp_accept;
++ n->auth = s->flags & DEV_OPT_AUTH ? s->auth : os->auth;
+ n->flags = s->flags | os->flags | os->valid_flags;
+ }
+
+@@ -439,6 +441,11 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
+ s->flags |= DEV_OPT_ARP_ACCEPT;
+ }
+
++ if ((cur = tb[DEV_ATTR_AUTH])) {
++ s->auth = blobmsg_get_bool(cur);
++ s->flags |= DEV_OPT_AUTH;
++ }
++
+ device_set_disabled(dev, disabled);
+ }
+
+@@ -716,6 +723,28 @@ device_refresh_present(struct device *dev)
+ __device_set_present(dev, state);
+ }
+
++void
++device_set_auth_status(struct device *dev, bool value)
++{
++ if (dev->auth_status == value)
++ return;
++
++ dev->auth_status = value;
++ if (!dev->present)
++ return;
++
++ if (dev->auth_status) {
++ device_broadcast_event(dev, DEV_EVENT_AUTH_UP);
++ return;
++ }
++
++ device_broadcast_event(dev, DEV_EVENT_LINK_DOWN);
++ if (!dev->link_active)
++ return;
++
++ device_broadcast_event(dev, DEV_EVENT_LINK_UP);
++}
++
+ void device_set_present(struct device *dev, bool state)
+ {
+ if (dev->sys_present == state)
+@@ -734,6 +763,8 @@ void device_set_link(struct device *dev, bool state)
+ netifd_log_message(L_NOTICE, "%s '%s' link is %s\n", dev->type->name, dev->ifname, state ? "up" : "down" );
+
+ dev->link_active = state;
++ if (!state)
++ dev->auth_status = false;
+ device_broadcast_event(dev, state ? DEV_EVENT_LINK_UP : DEV_EVENT_LINK_DOWN);
+ }
+
+@@ -1091,6 +1122,7 @@ device_dump_status(struct blob_buf *b, struct device *dev)
+
+ blobmsg_add_u8(b, "up", !!dev->active);
+ blobmsg_add_u8(b, "carrier", !!dev->link_active);
++ blobmsg_add_u8(b, "auth_status", !!dev->auth_status);
+
+ if (dev->type->dump_info)
+ dev->type->dump_info(dev, b);
+@@ -1157,6 +1189,8 @@ device_dump_status(struct blob_buf *b, struct device *dev)
+ blobmsg_add_u8(b, "drop_unsolicited_na", st.drop_unsolicited_na);
+ if (st.flags & DEV_OPT_ARP_ACCEPT)
+ blobmsg_add_u8(b, "arp_accept", st.arp_accept);
++ if (st.flags & DEV_OPT_AUTH)
++ blobmsg_add_u8(b, "auth", st.auth);
+ }
+
+ s = blobmsg_open_table(b, "statistics");
+diff --git a/device.h b/device.h
+index f6eaf275e18c..ed07791ba458 100644
+--- a/device.h
++++ b/device.h
+@@ -59,6 +59,7 @@ enum {
+ DEV_ATTR_DROP_GRATUITOUS_ARP,
+ DEV_ATTR_DROP_UNSOLICITED_NA,
+ DEV_ATTR_ARP_ACCEPT,
++ DEV_ATTR_AUTH,
+ __DEV_ATTR_MAX,
+ };
+
+@@ -100,7 +101,7 @@ enum {
+ DEV_OPT_MLDVERSION = (1 << 8),
+ DEV_OPT_NEIGHREACHABLETIME = (1 << 9),
+ DEV_OPT_DEFAULT_MACADDR = (1 << 10),
+- /* 1 bit hole */
++ DEV_OPT_AUTH = (1 << 11),
+ DEV_OPT_MTU6 = (1 << 12),
+ DEV_OPT_DADTRANSMITS = (1 << 13),
+ DEV_OPT_MULTICAST_TO_UNICAST = (1 << 14),
+@@ -134,6 +135,7 @@ enum device_event {
+ DEV_EVENT_UP,
+ DEV_EVENT_DOWN,
+
++ DEV_EVENT_AUTH_UP,
+ DEV_EVENT_LINK_UP,
+ DEV_EVENT_LINK_DOWN,
+
+@@ -192,6 +194,7 @@ struct device_settings {
+ bool drop_gratuitous_arp;
+ bool drop_unsolicited_na;
+ bool arp_accept;
++ bool auth;
+ };
+
+ /*
+@@ -220,6 +223,7 @@ struct device {
+ int active;
+ /* DEV_EVENT_LINK_UP */
+ bool link_active;
++ bool auth_status;
+
+ bool external;
+ bool disabled;
+@@ -324,6 +328,8 @@ struct device *get_vlan_device_chain(const char *ifname, bool create);
+ void alias_notify_device(const char *name, struct device *dev);
+ struct device *device_alias_get(const char *name);
+
++void device_set_auth_status(struct device *dev, bool value);
++
+ static inline void
+ device_set_deferred(struct device *dev, bool value)
+ {
+@@ -338,6 +344,15 @@ device_set_disabled(struct device *dev, bool value)
+ device_refresh_present(dev);
+ }
+
++static inline bool
++device_link_active(struct device *dev)
++{
++ if (dev->settings.auth && !dev->auth_status)
++ return false;
++
++ return dev->link_active;
++}
++
+ bool device_check_ip6segmentrouting(void);
+
+ #endif
+diff --git a/interface.c b/interface.c
+index 2a8f604207c3..a91246a1ae03 100644
+--- a/interface.c
++++ b/interface.c
+@@ -99,6 +99,17 @@ interface_error_flush(struct interface *iface)
+ }
+ }
+
++static bool
++interface_force_link(struct interface *iface)
++{
++ struct device *dev = iface->main_dev.dev;
++
++ if (dev && dev->settings.auth)
++ return false;
++
++ return iface->force_link;
++}
++
+ static void
+ interface_clear_errors(struct interface *iface)
+ {
+@@ -344,7 +355,7 @@ __interface_set_up(struct interface *iface)
+ static void
+ interface_check_state(struct interface *iface)
+ {
+- bool link_state = iface->link_state || iface->force_link;
++ bool link_state = iface->link_state || interface_force_link(iface);
+
+ switch (iface->state) {
+ case IFS_UP:
+@@ -390,7 +401,8 @@ interface_set_link_state(struct interface *iface, bool new_state)
+ iface->link_state = new_state;
+ interface_check_state(iface);
+
+- if (new_state && iface->force_link && iface->state == IFS_UP && !iface->link_up_event) {
++ if (new_state && interface_force_link(iface) &&
++ iface->state == IFS_UP && !iface->link_up_event) {
+ interface_event(iface, IFEV_LINK_UP);
+ iface->link_up_event = true;
+ }
+@@ -424,11 +436,10 @@ interface_main_dev_cb(struct device_user *dep, enum device_event ev)
+ case DEV_EVENT_DOWN:
+ interface_set_enabled(iface, false);
+ break;
++ case DEV_EVENT_AUTH_UP:
+ case DEV_EVENT_LINK_UP:
+- interface_set_link_state(iface, true);
+- break;
+ case DEV_EVENT_LINK_DOWN:
+- interface_set_link_state(iface, false);
++ interface_set_link_state(iface, device_link_active(dep->dev));
+ break;
+ case DEV_EVENT_TOPO_CHANGE:
+ interface_proto_event(iface->proto, PROTO_CMD_RENEW, false);
+diff --git a/ubus.c b/ubus.c
+index 9098c662cc41..be150626bc02 100644
+--- a/ubus.c
++++ b/ubus.c
+@@ -298,12 +298,14 @@ error:
+ enum {
+ DEV_STATE_NAME,
+ DEV_STATE_DEFER,
++ DEV_STATE_AUTH_STATUS,
+ __DEV_STATE_MAX,
+ };
+
+ static const struct blobmsg_policy dev_state_policy[__DEV_STATE_MAX] = {
+ [DEV_STATE_NAME] = { .name = "name", .type = BLOBMSG_TYPE_STRING },
+ [DEV_STATE_DEFER] = { .name = "defer", .type = BLOBMSG_TYPE_BOOL },
++ [DEV_STATE_AUTH_STATUS] = { .name = "auth_status", .type = BLOBMSG_TYPE_BOOL },
+ };
+
+ static int
+@@ -329,6 +331,10 @@ netifd_handle_set_state(struct ubus_context *ctx, struct ubus_object *obj,
+ if (cur)
+ device_set_deferred(dev, !!blobmsg_get_u8(cur));
+
++ cur = tb[DEV_STATE_AUTH_STATUS];
++ if (cur)
++ device_set_auth_status(dev, !!blobmsg_get_u8(cur));
++
+ return 0;
+ }
+
+--
+2.30.1
+
--
2.25.1

View File

@@ -1,257 +0,0 @@
From 0bdafa77ec675b81d9254cb4ce429e76ca84fcea Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 1 Apr 2021 09:31:19 +0200
Subject: [PATCH 1/2] hostapd: add a pile of new options
Signed-off-by: John Crispin <john@phrozen.org>
---
.../network/services/hostapd/files/hostapd.sh | 84 +++++++++++++------
1 file changed, 60 insertions(+), 24 deletions(-)
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 45a49b8faa..05b901fb6b 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -311,12 +311,12 @@ hostapd_common_add_bss_config() {
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
- config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa
+ config_add_boolean interworking iw_internet iw_asra iw_esr iw_uesa
config_add_int iw_access_network_type iw_venue_group iw_venue_type
config_add_int iw_ipaddr_type_availability iw_gas_address3
config_add_string iw_hessid iw_network_auth_type iw_qos_map_set
config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
- config_add_array iw_anqp_elem
+ config_add_array iw_anqp_elem iw_venue_name iw_venue_url
config_add_boolean hs20 disable_dgaf osen
config_add_int anqp_domain_id
@@ -327,12 +327,20 @@ hostapd_common_add_bss_config() {
config_add_array hs20_conn_capab
config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
+ config_add_boolean interworking
+ config_add_string hs20_t_c_server_url
+
config_add_array airtime_sta_weight
config_add_int airtime_bss_weight airtime_bss_limit
config_add_boolean multicast_to_unicast per_sta_vif
config_add_array hostapd_bss_options
+
+ config_add_boolean request_cui
+ config_add_array radius_auth_req_attr
+ config_add_array radius_acct_req_attr
+ config_add_int rts_threshold
}
hostapd_set_vlan_file() {
@@ -396,12 +404,20 @@ append_iw_nai_realm() {
[ -n "$1" ] && append bss_conf "nai_realm=$1" "$N"
}
+append_iw_venue_name() {
+ [ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
+}
+
+append_iw_venue_url() {
+ [ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
+}
+
append_hs20_oper_friendly_name() {
- append bss_conf "hs20_oper_friendly_name=$1" "$N"
+ [ -n "$1" ] && append bss_conf "hs20_oper_friendly_name=$1" "$N"
}
append_osu_provider_service_desc() {
- append bss_conf "osu_service_desc=$1" "$N"
+ [ -n "$1" ] && append bss_conf "osu_service_desc=$1" "$N"
}
append_hs20_icon() {
@@ -421,15 +437,15 @@ append_hs20_icons() {
}
append_operator_icon() {
- append bss_conf "operator_icon=$1" "$N"
+ [ -n "$1" ] && append bss_conf "operator_icon=$1" "$N"
}
append_osu_icon() {
- append bss_conf "osu_icon=$1" "$N"
+ [ -n "$1" ] && append bss_conf "osu_icon=$1" "$N"
}
append_osu_provider() {
- local cfgtype osu_server_uri osu_friendly_name osu_nai osu_nai2 osu_method_list
+ local cfgtype osu_server_uri osu_nai osu_nai2 osu_method_list
config_load wireless
config_get cfgtype "$1" TYPE
@@ -441,12 +457,13 @@ append_osu_provider() {
config_get osu_nai2 "$1" osu_nai2
config_get osu_method_list "$1" osu_method
- append bss_conf "osu_server_uri=$osu_server_uri" "$N"
- append bss_conf "osu_nai=$osu_nai" "$N"
- append bss_conf "osu_nai2=$osu_nai2" "$N"
- append bss_conf "osu_method_list=$osu_method_list" "$N"
+ [ -n "$osu_server_uri" ] && append bss_conf "osu_server_uri=$osu_server_uri" "$N"
+ [ -n "$osu_nai" ] && append bss_conf "osu_nai=$osu_nai" "$N"
+ [ -n "$osu_nai2" ] && append bss_conf "osu_nai2=$osu_nai2" "$N"
+ [ -n "$osu_method_list" ] && append bss_conf "osu_method_list=$osu_method_list" "$N"
config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc
+ config_list_foreach "$1" osu_friendly_name append_osu_friendly_name
config_list_foreach "$1" osu_icon append_osu_icon
append bss_conf "$N"
@@ -456,6 +473,14 @@ append_hs20_conn_capab() {
[ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N"
}
+append_radius_acct_req_attr() {
+ [ -n "$1" ] && append bss_conf "radius_acct_req_attr=$1" "$N"
+}
+
+append_radius_auth_req_attr() {
+ [ -n "$1" ] && append bss_conf "radius_auth_req_attr=$1" "$N"
+}
+
append_airtime_sta_weight() {
[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
}
@@ -482,7 +507,7 @@ hostapd_set_bss_options() {
bss_load_update_period chan_util_avg_period sae_require_mfp \
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \
airtime_bss_weight airtime_bss_limit airtime_sta_weight \
- multicast_to_unicast per_sta_vif
+ multicast_to_unicast per_sta_vif rts_threshold
set_default isolate 0
set_default maxassoc 0
@@ -503,6 +528,7 @@ hostapd_set_bss_options() {
set_default multi_ap 0
set_default airtime_bss_weight 0
set_default airtime_bss_limit 0
+ set_default rts_threshold -1
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -529,6 +555,7 @@ hostapd_set_bss_options() {
append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
append bss_conf "utf8_ssid=$utf8_ssid" "$N"
append bss_conf "multi_ap=$multi_ap" "$N"
+ append bss_conf "rts_threshold=$rts_threshold" "$N"
[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
@@ -547,6 +574,7 @@ hostapd_set_bss_options() {
append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
[ -n "$acct_interval" ] && \
append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
+ json_for_each_item append_radius_acct_req_attr radius_acct_req_attr
}
case "$auth_type" in
@@ -601,7 +629,7 @@ hostapd_set_bss_options() {
auth_server auth_secret auth_port \
dae_client dae_secret dae_port \
ownip radius_client_addr \
- eap_reauth_period
+ eap_reauth_period request_cui
# radius can provide VLAN ID for clients
vlan_possible=1
@@ -613,18 +641,20 @@ hostapd_set_bss_options() {
set_default auth_port 1812
set_default dae_port 3799
-
+ set_default request_cui 0
append bss_conf "auth_server_addr=$auth_server" "$N"
append bss_conf "auth_server_port=$auth_port" "$N"
append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
+ [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N"
[ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
[ -n "$dae_client" -a -n "$dae_secret" ] && {
append bss_conf "radius_das_port=$dae_port" "$N"
append bss_conf "radius_das_client=$dae_client $dae_secret" "$N"
}
+ json_for_each_item append_radius_auth_req_attr radius_auth_req_attr
[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
@@ -871,13 +901,14 @@ hostapd_set_bss_options() {
}
}
- json_get_vars iw_enabled iw_internet iw_asra iw_esr iw_uesa iw_access_network_type
+ json_get_vars interworking iw_internet iw_asra iw_esr iw_uesa iw_access_network_type
json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type
json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
+ json_get_vars iw_venue_name iw_venue_url
- set_default iw_enabled 0
- if [ "$iw_enabled" = "1" ]; then
+ set_default interworking 0
+ if [ "$interworking" = "1" ]; then
append bss_conf "interworking=1" "$N"
set_default iw_internet 1
set_default iw_asra 0
@@ -903,6 +934,8 @@ hostapd_set_bss_options() {
json_for_each_item append_iw_roaming_consortium iw_roaming_consortium
json_for_each_item append_iw_anqp_elem iw_anqp_elem
json_for_each_item append_iw_nai_realm iw_nai_realm
+ json_for_each_item append_iw_venue_name iw_venue_name
+ json_for_each_item append_iw_venue_url iw_venue_url
iw_domain_name_conf=
json_for_each_item append_iw_domain_name iw_domain_name
@@ -917,9 +950,11 @@ hostapd_set_bss_options() {
local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
+ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \
+ hs20_t_c_server_url
json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
+ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \
+ hs20_t_c_server_url
set_default hs20 0
set_default disable_dgaf $hs20
@@ -929,17 +964,18 @@ hostapd_set_bss_options() {
if [ "$hs20" = "1" ]; then
append bss_conf "hs20=1" "$N"
append_hs20_icons
- append bss_conf "disable_dgaf=$disable_dgaf" "$N"
- append bss_conf "osen=$osen" "$N"
- append bss_conf "anqp_domain_id=$anqp_domain_id" "$N"
- append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N"
+ [ -n "$disable_dgaf"] && append bss_conf "disable_dgaf=$disable_dgaf" "$N"
+ [ -n "$osen"] && append bss_conf "osen=$osen" "$N"
+ [ "$anqp_domain_id" -gt 0 ] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N"
+ [ -n "$hs20_deauth_req_timeout"] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N"
[ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N"
[ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N"
[ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N"
[ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N"
[ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N"
- json_for_each_item append_hs20_conn_capab hs20_conn_capab
+ [ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N"
json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name
+ json_for_each_item append_hs20_conn_capab hs20_conn_capab
json_for_each_item append_osu_provider osu_provider
json_for_each_item append_operator_icon operator_icon
fi
--
2.25.1

View File

@@ -1,26 +0,0 @@
From f1bb66dbeb148d3da6481a98433cff5b5ee3ef96 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 6 Apr 2021 13:24:43 +0200
Subject: [PATCH] hostapd: fix civic location option
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/services/hostapd/files/hostapd.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 05b901fb6b..e391aae13b 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -763,7 +763,7 @@ hostapd_set_bss_options() {
append bss_conf "ftm_responder=1" "$N"
[ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N"
[ -n "$lci" ] && append bss_conf "lci=$lci" "$N"
- [ -n "$civic" ] && append bss_conf "lci=$civic" "$N"
+ [ -n "$civic" ] && append bss_conf "civic=$civic" "$N"
}
fi
--
2.25.1

View File

@@ -1,77 +0,0 @@
From 99cffd423352bceb3c2826b4262b575478b0a712 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 6 Apr 2021 14:59:41 +0200
Subject: [PATCH] hostapd: add eap_server support
Signed-off-by: John Crispin <john@phrozen.org>
---
.../network/services/hostapd/files/hostapd.sh | 25 ++++++++++++++++---
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index e391aae13b..a3263ed036 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -341,6 +341,9 @@ hostapd_common_add_bss_config() {
config_add_array radius_auth_req_attr
config_add_array radius_acct_req_attr
config_add_int rts_threshold
+
+ config_add_int eap_server
+ config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id
}
hostapd_set_vlan_file() {
@@ -507,7 +510,8 @@ hostapd_set_bss_options() {
bss_load_update_period chan_util_avg_period sae_require_mfp \
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \
airtime_bss_weight airtime_bss_limit airtime_sta_weight \
- multicast_to_unicast per_sta_vif rts_threshold
+ multicast_to_unicast per_sta_vif rts_threshold \
+ eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id
set_default isolate 0
set_default maxassoc 0
@@ -529,6 +533,7 @@ hostapd_set_bss_options() {
set_default airtime_bss_weight 0
set_default airtime_bss_limit 0
set_default rts_threshold -1
+ set_default eap_server 0
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -643,9 +648,11 @@ hostapd_set_bss_options() {
set_default dae_port 3799
set_default request_cui 0
- append bss_conf "auth_server_addr=$auth_server" "$N"
- append bss_conf "auth_server_port=$auth_port" "$N"
- append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
+ [ "$eap_server" -eq 0 ] && {
+ append bss_conf "auth_server_addr=$auth_server" "$N"
+ append bss_conf "auth_server_port=$auth_port" "$N"
+ append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
+ }
[ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N"
[ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
@@ -980,6 +987,16 @@ hostapd_set_bss_options() {
json_for_each_item append_operator_icon operator_icon
fi
+ if [ "$eap_server" = "1" ]; then
+ append bss_conf "eap_server=1" "$N"
+ [ -n "$eap_user_file" ] && append bss_conf "eap_user_file=$eap_user_file" "$N"
+ [ -n "$ca_cert" ] && append bss_conf "ca_cert=$ca_cert" "$N"
+ [ -n "$server_cert" ] && append bss_conf "server_cert=$server_cert" "$N"
+ [ -n "$private_key" ] && append bss_conf "private_key=$private_key" "$N"
+ [ -n "$private_key_passwd" ] && append bss_conf "private_key_passwd=$private_key_passwd" "$N"
+ [ -n "$server_id" ] && append bss_conf "server_id=$server_id" "$N"
+ fi
+
set_default multicast_to_unicast 0
if [ "$multicast_to_unicast" -gt 0 ]; then
append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N"
--
2.25.1

View File

@@ -1,299 +0,0 @@
From 862774f19f666ddf03ce4d51396a7b6f3ac554ef Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 29 Apr 2021 10:50:06 +0200
Subject: [PATCH 1/2] hostapd: enhance ubus interface
* add a notification to the radar detected event
* fix csa on multi bssid interfaces
Signed-off-by: John Crispin <john@phrozen.org>
---
.../hostapd/patches/600-ubus_support.patch | 103 +++++++++++++-----
.../services/hostapd/src/src/ap/ubus.c | 20 +++-
.../services/hostapd/src/src/ap/ubus.h | 7 ++
3 files changed, 98 insertions(+), 32 deletions(-)
diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
index 938840755a..bd5d13b6ad 100644
--- a/package/network/services/hostapd/patches/600-ubus_support.patch
+++ b/package/network/services/hostapd/patches/600-ubus_support.patch
@@ -1,5 +1,7 @@
---- a/hostapd/Makefile
-+++ b/hostapd/Makefile
+Index: hostapd-2020-06-08-5a8b3662/hostapd/Makefile
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/hostapd/Makefile
++++ hostapd-2020-06-08-5a8b3662/hostapd/Makefile
@@ -171,6 +171,11 @@ OBJS += ../src/common/hw_features_common
OBJS += ../src/eapol_auth/eapol_auth_sm.o
@@ -12,8 +14,10 @@
ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
---- a/src/ap/hostapd.h
-+++ b/src/ap/hostapd.h
+Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.h
++++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h
@@ -17,6 +17,7 @@
#include "utils/list.h"
#include "ap_config.h"
@@ -47,8 +51,10 @@
void hostapd_interface_deinit(struct hostapd_iface *iface);
void hostapd_interface_free(struct hostapd_iface *iface);
struct hostapd_iface * hostapd_alloc_iface(void);
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
+Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c
@@ -395,6 +395,7 @@ void hostapd_free_hapd_data(struct hosta
hapd->beacon_set_done = 0;
@@ -90,8 +96,10 @@
hostapd_interface_deinit(iface);
wpa_printf(MSG_DEBUG, "%s: driver=%p drv_priv=%p -> hapd_deinit",
__func__, driver, drv_priv);
---- a/src/ap/ieee802_11.c
-+++ b/src/ap/ieee802_11.c
+Index: hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ieee802_11.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c
@@ -2327,13 +2327,18 @@ static void handle_auth(struct hostapd_d
u16 auth_alg, auth_transaction, status_code;
u16 resp = WLAN_STATUS_SUCCESS;
@@ -179,8 +187,10 @@
sta = ap_get_sta(hapd, mgmt->sa);
if (sta == NULL) {
wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying "
---- a/src/ap/beacon.c
-+++ b/src/ap/beacon.c
+Index: hostapd-2020-06-08-5a8b3662/src/ap/beacon.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/beacon.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/beacon.c
@@ -814,6 +814,12 @@ void handle_probe_req(struct hostapd_dat
u16 csa_offs[2];
size_t csa_offs_len;
@@ -207,8 +217,10 @@
/* TODO: verify that supp_rates contains at least one matching rate
* with AP configuration */
---- a/src/ap/drv_callbacks.c
-+++ b/src/ap/drv_callbacks.c
+Index: hostapd-2020-06-08-5a8b3662/src/ap/drv_callbacks.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/drv_callbacks.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/drv_callbacks.c
@@ -119,6 +119,10 @@ int hostapd_notif_assoc(struct hostapd_d
u16 reason = WLAN_REASON_UNSPECIFIED;
int status = WLAN_STATUS_SUCCESS;
@@ -233,8 +245,10 @@
#ifdef CONFIG_P2P
if (elems.p2p) {
wpabuf_free(sta->p2p_ie);
---- a/src/ap/sta_info.c
-+++ b/src/ap/sta_info.c
+Index: hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/sta_info.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c
@@ -424,6 +424,7 @@ void ap_handle_timer(void *eloop_ctx, vo
HOSTAPD_LEVEL_INFO, "deauthenticated due to "
"local deauth request");
@@ -259,8 +273,10 @@
if (hapd->msg_ctx_parent &&
hapd->msg_ctx_parent != hapd->msg_ctx)
---- a/src/ap/wpa_auth_glue.c
-+++ b/src/ap/wpa_auth_glue.c
+Index: hostapd-2020-06-08-5a8b3662/src/ap/wpa_auth_glue.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/wpa_auth_glue.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/wpa_auth_glue.c
@@ -259,6 +259,7 @@ static void hostapd_wpa_auth_psk_failure
struct hostapd_data *hapd = ctx;
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR,
@@ -269,8 +285,10 @@
}
---- a/wpa_supplicant/Makefile
-+++ b/wpa_supplicant/Makefile
+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/Makefile
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/Makefile
++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/Makefile
@@ -190,6 +190,12 @@ ifdef CONFIG_EAPOL_TEST
CFLAGS += -Werror -DEAPOL_TEST
endif
@@ -294,8 +312,10 @@
endif
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/wpa_supplicant.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/wpa_supplicant.c
++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/wpa_supplicant.c
@@ -6794,6 +6794,8 @@ struct wpa_supplicant * wpa_supplicant_a
}
#endif /* CONFIG_P2P */
@@ -327,8 +347,10 @@
return 0;
}
---- a/wpa_supplicant/wpa_supplicant_i.h
-+++ b/wpa_supplicant/wpa_supplicant_i.h
+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/wpa_supplicant_i.h
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/wpa_supplicant_i.h
++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/wpa_supplicant_i.h
@@ -17,6 +17,7 @@
#include "wps/wps_defs.h"
#include "config_ssid.h"
@@ -354,8 +376,10 @@
#ifdef CONFIG_MATCH_IFACE
int matched;
#endif /* CONFIG_MATCH_IFACE */
---- a/wpa_supplicant/wps_supplicant.c
-+++ b/wpa_supplicant/wps_supplicant.c
+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/wps_supplicant.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/wps_supplicant.c
++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/wps_supplicant.c
@@ -33,6 +33,7 @@
#include "p2p/p2p.h"
#include "p2p_supplicant.h"
@@ -373,8 +397,10 @@
if (wpa_s->conf->wps_cred_processing == 1)
return 0;
---- a/hostapd/main.c
-+++ b/hostapd/main.c
+Index: hostapd-2020-06-08-5a8b3662/hostapd/main.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/hostapd/main.c
++++ hostapd-2020-06-08-5a8b3662/hostapd/main.c
@@ -896,6 +896,7 @@ int main(int argc, char *argv[])
}
@@ -391,8 +417,10 @@
hostapd_global_ctrl_iface_deinit(&interfaces);
/* Deinitialize all interfaces */
for (i = 0; i < interfaces.count; i++) {
---- a/wpa_supplicant/main.c
-+++ b/wpa_supplicant/main.c
+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/main.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/main.c
++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/main.c
@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
for (;;) {
@@ -412,8 +440,10 @@
case 'o':
params.override_driver = optarg;
break;
---- a/src/ap/rrm.c
-+++ b/src/ap/rrm.c
+Index: hostapd-2020-06-08-5a8b3662/src/ap/rrm.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/rrm.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/rrm.c
@@ -89,6 +89,9 @@ static void hostapd_handle_beacon_report
return;
wpa_msg(hapd->msg_ctx, MSG_INFO, BEACON_RESP_RX MACSTR " %u %02x %s",
@@ -424,3 +454,16 @@
}
+Index: hostapd-2020-06-08-5a8b3662/src/ap/dfs.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/dfs.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/dfs.c
+@@ -1179,6 +1179,8 @@ int hostapd_dfs_radar_detected(struct ho
+ "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
+ freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
+
++ hostapd_ubus_notify_radar_detected(iface->bss[0], freq, cf1, cf2);
++
+ /* Proceed only if DFS is not offloaded to the driver */
+ if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
+ return 0;
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index d03b848f94..92851077ad 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -728,6 +728,7 @@ 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;
+ int i;
blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg));
@@ -752,9 +753,10 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool);
SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool);
+ for (i = 0; i < hapd->iface->num_bss; i++)
+ if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0)
+ return UBUS_STATUS_NOT_SUPPORTED;
- if (hostapd_switch_channel(hapd, &css) != 0)
- return UBUS_STATUS_NOT_SUPPORTED;
return UBUS_STATUS_OK;
#undef SET_CSA_SETTING
}
@@ -1550,3 +1552,17 @@ void hostapd_ubus_notify_beacon_report(
ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1);
}
+
+void hostapd_ubus_notify_radar_detected(struct hostapd_data *hapd, u16 frequency,
+ u16 cf1, u16 cf2)
+{
+ if (!hapd->ubus.obj.has_subscribers)
+ return;
+
+ blob_buf_init(&b, 0);
+ blobmsg_add_u16(&b, "frequency", frequency);
+ blobmsg_add_u16(&b, "center1", cf1);
+ blobmsg_add_u16(&b, "center2", cf2);
+
+ ubus_notify(ctx, &hapd->ubus.obj, "radar-detected", b.head, -1);
+}
diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h
index e16017394f..f84c8a91f5 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.h
+++ b/package/network/services/hostapd/src/src/ap/ubus.h
@@ -50,6 +50,8 @@ void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
const u8 *addr, u8 token, u8 rep_mode,
struct rrm_measurement_beacon_report *rep,
size_t len);
+void hostapd_ubus_notify_radar_detected(struct hostapd_data *hapd,
+ u16 frequency, u16 cf1, u16 cf2);
void hostapd_ubus_add(struct hapd_interfaces *interfaces);
void hostapd_ubus_free(struct hapd_interfaces *interfaces);
@@ -91,6 +93,11 @@ static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
{
}
+static inline void hostapd_ubus_notify_radar_detected(struct hostapd_data *hapd, u16 frequency,
+ u16 cf1, u16 cf2)
+{
+}
+
static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces)
{
}
--
2.25.1

View File

@@ -1,253 +0,0 @@
From 1dc0dfaf92236247d6d0535d56687d7b1aa032c1 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 29 Apr 2021 10:51:46 +0200
Subject: [PATCH 2/2] hostapd: add more options
Signed-off-by: John Crispin <john@phrozen.org>
---
.../network/services/hostapd/files/hostapd.sh | 20 +++-
..._request-ignore-when-rssi-is-too-low.patch | 65 ++++++++++++
.../hostapd/patches/803-max-sta-limit.patch | 100 ++++++++++++++++++
3 files changed, 184 insertions(+), 1 deletion(-)
create mode 100644 package/network/services/hostapd/patches/802-probe_request-ignore-when-rssi-is-too-low.patch
create mode 100644 package/network/services/hostapd/patches/803-max-sta-limit.patch
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index eaff318c97..923f57a33d 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -49,6 +49,7 @@ hostapd_append_wpa_key_mgmt() {
eap192)
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
+ [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
;;
eap-eap192)
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
@@ -344,6 +345,11 @@ hostapd_common_add_bss_config() {
config_add_int eap_server
config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id
+
+ config_add_int beacon_rate
+ config_add_int rssi_reject_assoc_rssi
+ config_add_int rssi_ignore_probe_request
+ config_add_boolean multicast_to_unicast proxy_arp
}
hostapd_set_vlan_file() {
@@ -511,7 +517,9 @@ hostapd_set_bss_options() {
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \
airtime_bss_weight airtime_bss_limit airtime_sta_weight \
multicast_to_unicast per_sta_vif rts_threshold \
- eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id
+ eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
+ rssi_reject_assoc_rssi rssi_ignore_probe_request \
+ beacon_rate proxy_arp multicast_to_unicast
set_default isolate 0
set_default maxassoc 0
@@ -534,6 +542,10 @@ hostapd_set_bss_options() {
set_default airtime_bss_limit 0
set_default rts_threshold -1
set_default eap_server 0
+ set_default proxy_arp 0
+ set_default multicast_to_unicast 0
+ set_default rssi_reject_assoc_rssi 0
+ set_default rssi_ignore_probe_request 0
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -562,6 +574,12 @@ hostapd_set_bss_options() {
append bss_conf "multi_ap=$multi_ap" "$N"
append bss_conf "rts_threshold=$rts_threshold" "$N"
+ [ -n "$rssi_reject_assoc_rssi" ] && append bss_conf "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
+ [ -n "$rssi_ignore_probe_request" ] && append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
+ [ -n "$beacon_rate" ] && append bss_conf "beacon_rate=$beacon_rate" "$N"
+ [ -n "$proxy_arp" ] && append bss_conf "proxy_arp=$proxy_arp" "$N"
+ [ -n "$multicast_to_unicast" ] && append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N"
+
[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
[ "$wpa" -gt 0 ] && {
diff --git a/package/network/services/hostapd/patches/802-probe_request-ignore-when-rssi-is-too-low.patch b/package/network/services/hostapd/patches/802-probe_request-ignore-when-rssi-is-too-low.patch
new file mode 100644
index 0000000000..eecfdcc388
--- /dev/null
+++ b/package/network/services/hostapd/patches/802-probe_request-ignore-when-rssi-is-too-low.patch
@@ -0,0 +1,65 @@
+From e15b04870a7d7517a9b129d8d5cbebe6b8a25cb8 Mon Sep 17 00:00:00 2001
+From: John Crispin <john@phrozen.org>
+Date: Wed, 29 Jul 2020 17:38:15 +0200
+Subject: [PATCH 1/2] probe_request: ignore when rssi is too low
+
+Signed-off-by: John Crispin <john@phrozen.org>
+---
+ hostapd/config_file.c | 2 ++
+ src/ap/ap_config.c | 1 +
+ src/ap/ap_config.h | 1 +
+ src/ap/beacon.c | 4 ++++
+ 4 files changed, 8 insertions(+)
+
+Index: hostapd-2020-06-08-5a8b3662/hostapd/config_file.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/hostapd/config_file.c
++++ hostapd-2020-06-08-5a8b3662/hostapd/config_file.c
+@@ -4552,6 +4552,8 @@ static int hostapd_config_fill(struct ho
+ conf->rssi_reject_assoc_rssi = atoi(pos);
+ } else if (os_strcmp(buf, "rssi_reject_assoc_timeout") == 0) {
+ conf->rssi_reject_assoc_timeout = atoi(pos);
++ } else if (os_strcmp(buf, "rssi_ignore_probe_request") == 0) {
++ conf->rssi_ignore_probe_request = atoi(pos);
+ } else if (os_strcmp(buf, "pbss") == 0) {
+ bss->pbss = atoi(pos);
+ } else if (os_strcmp(buf, "transition_disable") == 0) {
+Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c
+@@ -277,6 +277,7 @@ struct hostapd_config * hostapd_config_d
+
+ conf->rssi_reject_assoc_rssi = 0;
+ conf->rssi_reject_assoc_timeout = 30;
++ conf->rssi_ignore_probe_request = 0;
+
+ #ifdef CONFIG_AIRTIME_POLICY
+ conf->airtime_update_interval = AIRTIME_DEFAULT_UPDATE_INTERVAL;
+Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.h
++++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h
+@@ -1051,6 +1051,7 @@ struct hostapd_config {
+
+ int rssi_reject_assoc_rssi;
+ int rssi_reject_assoc_timeout;
++ int rssi_ignore_probe_request;
+
+ #ifdef CONFIG_AIRTIME_POLICY
+ enum {
+Index: hostapd-2020-06-08-5a8b3662/src/ap/beacon.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/beacon.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/beacon.c
+@@ -821,6 +821,10 @@ void handle_probe_req(struct hostapd_dat
+ .elems = &elems,
+ };
+
++ if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
++ ssi_signal < hapd->iconf->rssi_ignore_probe_request)
++ return;
++
+ if (len < IEEE80211_HDRLEN)
+ return;
+ ie = ((const u8 *) mgmt) + IEEE80211_HDRLEN;
diff --git a/package/network/services/hostapd/patches/803-max-sta-limit.patch b/package/network/services/hostapd/patches/803-max-sta-limit.patch
new file mode 100644
index 0000000000..4c33d7e772
--- /dev/null
+++ b/package/network/services/hostapd/patches/803-max-sta-limit.patch
@@ -0,0 +1,100 @@
+Index: hostapd-2020-06-08-5a8b3662/hostapd/config_file.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/hostapd/config_file.c
++++ hostapd-2020-06-08-5a8b3662/hostapd/config_file.c
+@@ -2909,6 +2909,11 @@ static int hostapd_config_fill(struct ho
+ line);
+ return 1;
+ }
++ } else if (os_strcmp(buf, "global_max_num_sta") == 0) {
++ conf->global_max_num_sta = atoi(pos);
++ if (conf->global_max_num_sta < 0 ||
++ conf->global_max_num_sta > MAX_STA_COUNT)
++ conf->global_max_num_sta = MAX_STA_COUNT;
+ } else if (os_strcmp(buf, "max_num_sta") == 0) {
+ bss->max_num_sta = atoi(pos);
+ if (bss->max_num_sta < 0 ||
+Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c
+@@ -223,6 +223,8 @@ struct hostapd_config * hostapd_config_d
+
+ conf->num_bss = 1;
+
++ conf->global_max_num_sta = 0;
++
+ conf->beacon_int = 100;
+ conf->rts_threshold = -2; /* use driver default: 2347 */
+ conf->fragm_threshold = -2; /* user driver default: 2346 */
+Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.h
++++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h
+@@ -1067,6 +1067,7 @@ struct hostapd_config {
+ char *config_id;
+
+ u8 notify_mgmt_frames;
++ int global_max_num_sta;
+ };
+
+
+Index: hostapd-2020-06-08-5a8b3662/src/ap/beacon.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/beacon.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/beacon.c
+@@ -1030,7 +1030,8 @@ void handle_probe_req(struct hostapd_dat
+ if (hapd->conf->no_probe_resp_if_max_sta &&
+ is_multicast_ether_addr(mgmt->da) &&
+ is_multicast_ether_addr(mgmt->bssid) &&
+- hapd->num_sta >= hapd->conf->max_num_sta &&
++ hapd_check_max_sta(hapd) &&
++// hapd->num_sta >= hapd->conf->max_num_sta &&
+ !ap_get_sta(hapd, mgmt->sa)) {
+ wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR
+ " since no room for additional STA",
+Index: hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/sta_info.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c
+@@ -682,7 +682,8 @@ struct sta_info * ap_sta_add(struct host
+ return sta;
+
+ wpa_printf(MSG_DEBUG, " New STA");
+- if (hapd->num_sta >= hapd->conf->max_num_sta) {
++ if (hapd_check_max_sta(hapd)) {
++// if (hapd->num_sta >= hapd->conf->max_num_sta) {
+ /* FIX: might try to remove some old STAs first? */
+ wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
+ hapd->num_sta, hapd->conf->max_num_sta);
+Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.c
++++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c
+@@ -3776,3 +3776,15 @@ void hostapd_ocv_check_csa_sa_query(void
+ }
+ }
+ #endif /* CONFIG_OCV */
++
++int hapd_check_max_sta(struct hostapd_data *hapd)
++{
++ int cnt = 0, i;
++
++ if (!hapd->iconf->global_max_num_sta)
++ return hapd->num_sta >= hapd->conf->max_num_sta;
++
++ for (i = 0; i < hapd->iface->num_bss; i++)
++ cnt += hapd->iface->bss[i]->num_sta;
++ return cnt >= hapd->iconf->global_max_num_sta;
++}
+Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h
+===================================================================
+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.h
++++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h
+@@ -689,4 +689,6 @@ void fst_hostapd_fill_iface_obj(struct h
+ struct fst_wpa_obj *iface_obj);
+ #endif /* CONFIG_FST */
+
++int hapd_check_max_sta(struct hostapd_data *hapd);
++
+ #endif /* HOSTAPD_H */
--
2.25.1

View File

@@ -1,13 +1,15 @@
From 33334a615a88591e3b1f8954ba5a1122c5a9111d Mon Sep 17 00:00:00 2001
From 4c0d4870b8b7d2d816346b47e9e7f311366dedfc Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sun, 23 May 2021 09:59:53 +0200
Subject: [PATCH] certificates: add ability to persistently store certificates
Subject: [PATCH 1/4] certificates: add ability to persistently store
certificates
Signed-off-by: John Crispin <john@phrozen.org>
---
package/base-files/files/lib/upgrade/nand.sh | 9 +++++++++
.../files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi | 3 +--
2 files changed, 10 insertions(+), 2 deletions(-)
.../linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts | 8 ++++++--
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index ab3db4cdf2..36977244bc 100644
@@ -51,6 +53,28 @@ index 8f971e505c..0f1f083a5b 100644
};
};
};
diff --git a/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts b/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts
index 303b79ac83..7a228aea86 100644
--- a/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts
+++ b/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts
@@ -176,11 +176,15 @@
reg = <0x100000 0x100000>;
read-only;
};
- partition@b260000 {
+ partition@200000 {
label = "firmware";
- reg = <0x200000 0xe00000>;
+ reg = <0x200000 0xdf0000>;
compatible = "openwrt,uimage", "denx,uimage";
};
+ partition@ff0000 {
+ label = "certificates";
+ reg = <0xff0000 0x10000>;
+ };
};
};
};
--
2.25.1

14
profiles/qcom_hk14.yml Normal file
View File

@@ -0,0 +1,14 @@
---
profile: qcom_hk14
target: ipq807x
subtarget: ipq807x
description: Build image for the Qualcom HK14/6E
image: bin/targets/ipq807x/ipq807x/openwrt-ipq807x-edgecore_eap102-squashfs-sysupgrade.tar
feeds:
- name: ipq807x
path: ../../feeds/ipq807x
include:
- wifi-ax
- ucentral-ap
packages:
- kmod-ath11k-pci

View File

@@ -0,0 +1,8 @@
---
profile: tplink_ex228
target: ramips
subtarget: mt7621
description: Build image for the TP-Link EX228
image: bin/targets/ipq807x/ipq807x/openwrt-ipq807x-tplink_ex227-squashfs-sysupgrade.tar
include:
- ucentral-ap