developer | 98f3c3c | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 1 | diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile |
developer | e7dc049 | 2024-04-08 11:29:40 +0800 | [diff] [blame] | 2 | index 8ecbe304..4d8546ee 100644 |
developer | 98f3c3c | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 3 | --- a/package/kernel/mac80211/Makefile |
| 4 | +++ b/package/kernel/mac80211/Makefile |
developer | d64986d | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 5 | @@ -19,6 +19,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz |
developer | 98f3c3c | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 6 | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) |
| 7 | PKG_BUILD_PARALLEL:=1 |
developer | 293afb5 | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 8 | |
developer | 98f3c3c | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 9 | +SOURCE_PATH:=./src |
| 10 | PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> |
developer | 293afb5 | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 11 | |
developer | 98f3c3c | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 12 | PKG_DRIVERS = \ |
developer | e7dc049 | 2024-04-08 11:29:40 +0800 | [diff] [blame] | 13 | @@ -71,6 +72,12 @@ config-y:= \ |
developer | 9ead8ed | 2022-11-21 18:47:15 +0800 | [diff] [blame] | 14 | WLAN_VENDOR_ST \ |
| 15 | WLAN_VENDOR_TI \ |
| 16 | WLAN_VENDOR_ZYDAS \ |
| 17 | + MAC80211_DEBUG_MENU \ |
| 18 | + MAC80211_MLME_DEBUG \ |
| 19 | + MAC80211_STA_DEBUG \ |
| 20 | + MAC80211_HT_DEBUG \ |
developer | d64986d | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 21 | + MAC80211_PS_DEBUG \ |
developer | e7dc049 | 2024-04-08 11:29:40 +0800 | [diff] [blame] | 22 | + MAC80211_DEBUG_COUNTERS \ |
developer | 9ead8ed | 2022-11-21 18:47:15 +0800 | [diff] [blame] | 23 | |
| 24 | config-$(call config_package,cfg80211) += CFG80211 |
| 25 | config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE |
developer | e7dc049 | 2024-04-08 11:29:40 +0800 | [diff] [blame] | 26 | @@ -296,6 +303,8 @@ define Build/Prepare |
developer | 293afb5 | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 27 | mkdir -p $(PKG_BUILD_DIR) |
| 28 | $(PKG_UNPACK) |
| 29 | $(Build/Patch) |
| 30 | + $(CP) $(SOURCE_PATH)/net $(PKG_BUILD_DIR) 2>/dev/null || : |
| 31 | + $(CP) $(SOURCE_PATH)/include $(PKG_BUILD_DIR) 2>/dev/null || : |
| 32 | rm -rf \ |
| 33 | $(PKG_BUILD_DIR)/include/linux/ssb \ |
| 34 | $(PKG_BUILD_DIR)/include/linux/bcma \ |
developer | 8ac9712 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 35 | diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
developer | e7dc049 | 2024-04-08 11:29:40 +0800 | [diff] [blame] | 36 | index ed280521..797ea8d3 100644 |
developer | 8ac9712 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 37 | --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
| 38 | +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 39 | @@ -27,6 +27,7 @@ drv_mac80211_init_device_config() { |
| 40 | |
| 41 | config_add_string path phy 'macaddr:macaddr' |
| 42 | config_add_string tx_burst |
developer | 6ec07d9 | 2023-09-04 14:43:31 +0800 | [diff] [blame] | 43 | + config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr obss_interval |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 44 | config_add_string distance |
| 45 | config_add_int beacon_int chanbw frag rts |
| 46 | config_add_int rxantenna txantenna antenna_gain txpower min_tx_power |
developer | 13566db | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 47 | @@ -53,7 +54,12 @@ drv_mac80211_init_device_config() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 48 | he_spr_sr_control \ |
| 49 | he_spr_psr_enabled \ |
| 50 | he_bss_color_enabled \ |
| 51 | - he_twt_required |
| 52 | + he_twt_required \ |
| 53 | + he_twt_responder \ |
| 54 | + etxbfen \ |
developer | 13566db | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 55 | + itxbfen \ |
| 56 | + lpi_enable \ |
| 57 | + beacon_dup |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 58 | config_add_int \ |
| 59 | beamformer_antennas \ |
| 60 | beamformee_antennas \ |
developer | 13566db | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 61 | @@ -64,7 +70,8 @@ drv_mac80211_init_device_config() { |
| 62 | rx_stbc \ |
| 63 | tx_stbc \ |
| 64 | he_bss_color \ |
| 65 | - he_spr_non_srg_obss_pd_max_offset |
| 66 | + he_spr_non_srg_obss_pd_max_offset \ |
| 67 | + sku_idx |
| 68 | config_add_boolean \ |
| 69 | ldpc \ |
| 70 | greenfield \ |
| 71 | @@ -140,13 +147,11 @@ mac80211_hostapd_setup_base() { |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 72 | [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && |
| 73 | append base_cfg "acs_exclude_dfs=1" "$N" |
| 74 | |
| 75 | - json_get_vars noscan ht_coex min_tx_power:0 tx_burst |
developer | 6ec07d9 | 2023-09-04 14:43:31 +0800 | [diff] [blame] | 76 | + json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr obss_interval |
developer | 13566db | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 77 | + json_get_vars etxbfen:1 itxbfen:0 lpi_enable:0 sku_idx:0 beacon_dup:1 |
developer | 5f5952d | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 78 | json_get_values ht_capab_list ht_capab |
developer | 8ac9712 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 79 | json_get_values channel_list channels |
| 80 | |
| 81 | - [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ |
| 82 | - channel_list="$channel" |
| 83 | - |
developer | d3c708b | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 84 | [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" |
developer | 8ac9712 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 85 | |
developer | d3c708b | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 86 | set_default noscan 0 |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 87 | @@ -161,20 +166,41 @@ mac80211_hostapd_setup_base() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 88 | ht_capab= |
| 89 | case "$htmode" in |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 90 | VHT20|HT20|HE20) ;; |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 91 | - HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160) |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 92 | + HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160) |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 93 | case "$hwmode" in |
| 94 | a) |
| 95 | case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in |
developer | 8e211e3 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 96 | 1) ht_capab="[HT40+]";; |
| 97 | 0) ht_capab="[HT40-]";; |
| 98 | esac |
| 99 | + case "$htmode" in |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 100 | + HT40-|HE40-) |
developer | 8e211e3 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 101 | + if [ "$auto_channel" -gt 0 ]; then |
| 102 | + ht_capab="[HT40-]" |
| 103 | + fi |
| 104 | + ;; |
| 105 | + esac |
developer | a6e711f | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 106 | ;; |
| 107 | *) |
| 108 | case "$htmode" in |
| 109 | - HT40+) ht_capab="[HT40+]";; |
| 110 | - HT40-) ht_capab="[HT40-]";; |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 111 | + HT40+|HE40+) |
developer | a6e711f | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 112 | + if [ "$channel" -gt 9 ]; then |
| 113 | + echo "Could not set the center freq with this HT mode setting" |
| 114 | + return 1 |
| 115 | + else |
| 116 | + ht_capab="[HT40+]" |
| 117 | + fi |
| 118 | + ;; |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 119 | + HT40-|HE40-) |
developer | 8e211e3 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 120 | + if [ "$channel" -lt 5 -a "$auto_channel" -eq 0 ]; then |
developer | a6e711f | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 121 | + echo "Could not set the center freq with this HT mode setting" |
| 122 | + return 1 |
| 123 | + else |
| 124 | + ht_capab="[HT40-]" |
| 125 | + fi |
| 126 | + ;; |
| 127 | *) |
developer | 8e211e3 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 128 | - if [ "$channel" -lt 7 ]; then |
| 129 | + if [ "$channel" -lt 7 -o "$auto_channel" -gt 0 ]; then |
developer | a6e711f | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 130 | ht_capab="[HT40+]" |
developer | 8e211e3 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 131 | else |
| 132 | ht_capab="[HT40-]" |
developer | 13566db | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 133 | @@ -183,7 +209,6 @@ mac80211_hostapd_setup_base() { |
developer | 8e211e3 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 134 | esac |
| 135 | ;; |
| 136 | esac |
| 137 | - [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]" |
| 138 | ;; |
| 139 | *) ieee80211n= ;; |
| 140 | esac |
developer | 13566db | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 141 | @@ -193,6 +218,10 @@ mac80211_hostapd_setup_base() { |
developer | 6ec07d9 | 2023-09-04 14:43:31 +0800 | [diff] [blame] | 142 | |
| 143 | set_default ht_coex 0 |
| 144 | append base_cfg "ht_coex=$ht_coex" "$N" |
| 145 | + [ "$ht_coex" -eq 1 ] && { |
| 146 | + set_default obss_interval 300 |
| 147 | + append base_cfg "obss_interval=$obss_interval" "$N" |
| 148 | + } |
| 149 | |
| 150 | json_get_vars \ |
| 151 | ldpc:1 \ |
developer | 13566db | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 152 | @@ -205,7 +234,7 @@ mac80211_hostapd_setup_base() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 153 | dsss_cck_40:1 |
| 154 | |
| 155 | ht_cap_mask=0 |
| 156 | - for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do |
| 157 | + for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do |
| 158 | ht_cap_mask="$(($ht_cap_mask | $cap))" |
| 159 | done |
| 160 | |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 161 | @@ -271,6 +300,7 @@ mac80211_hostapd_setup_base() { |
developer | d6cf589 | 2023-05-02 16:25:52 +0800 | [diff] [blame] | 162 | case "$channel" in |
| 163 | 36|40|44|48|52|56|60|64) idx=50;; |
| 164 | 100|104|108|112|116|120|124|128) idx=114;; |
| 165 | + 149|153|157|161|165|169|173|177) idx=163;; |
| 166 | esac |
| 167 | fi |
| 168 | enable_ac=1 |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 169 | @@ -315,7 +345,6 @@ mac80211_hostapd_setup_base() { |
developer | 5af1935 | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 170 | vht_link_adapt:3 \ |
| 171 | vht160:2 |
| 172 | |
| 173 | - set_default tx_burst 2.0 |
| 174 | append base_cfg "ieee80211ac=1" "$N" |
| 175 | vht_cap=0 |
| 176 | for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 177 | @@ -329,6 +358,12 @@ mac80211_hostapd_setup_base() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 178 | [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" |
| 179 | vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" |
| 180 | |
| 181 | + [ "$etxbfen" -eq 0 ] && { |
| 182 | + su_beamformer=0 |
| 183 | + su_beamformee=0 |
| 184 | + mu_beamformer=0 |
| 185 | + } |
| 186 | + |
| 187 | mac80211_add_capabilities vht_capab $vht_cap \ |
| 188 | RXLDPC:0x10::$rxldpc \ |
| 189 | SHORT-GI-80:0x20::$short_gi_80 \ |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 190 | @@ -419,10 +454,11 @@ mac80211_hostapd_setup_base() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 191 | he_su_beamformee:1 \ |
| 192 | he_mu_beamformer:1 \ |
| 193 | he_twt_required:0 \ |
| 194 | + he_twt_responder \ |
| 195 | he_spr_sr_control:3 \ |
| 196 | he_spr_psr_enabled:0 \ |
| 197 | he_spr_non_srg_obss_pd_max_offset:0 \ |
| 198 | - he_bss_color:128 \ |
| 199 | + he_bss_color \ |
| 200 | he_bss_color_enabled:1 |
| 201 | |
| 202 | he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 203 | @@ -436,6 +472,11 @@ mac80211_hostapd_setup_base() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 204 | append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" |
| 205 | } |
| 206 | |
| 207 | + [ "$etxbfen" -eq 0 ] && { |
| 208 | + he_su_beamformer=0 |
| 209 | + he_mu_beamformer=0 |
| 210 | + } |
| 211 | + |
| 212 | mac80211_add_he_capabilities \ |
| 213 | he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \ |
| 214 | he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \ |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 215 | @@ -443,7 +484,14 @@ mac80211_hostapd_setup_base() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 216 | he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \ |
| 217 | he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required |
| 218 | |
| 219 | + if [ -n "$he_twt_responder" ]; then |
| 220 | + append base_cfg "he_twt_responder=$he_twt_responder" "$N" |
| 221 | + fi |
| 222 | if [ "$he_bss_color_enabled" -gt 0 ]; then |
developer | 1a7bd0c | 2023-05-18 19:32:48 +0800 | [diff] [blame] | 223 | + if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 224 | + rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2) |
| 225 | + he_bss_color=$((rand % 63 + 1)) |
| 226 | + fi |
| 227 | append base_cfg "he_bss_color=$he_bss_color" "$N" |
| 228 | [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \ |
| 229 | append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N" |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 230 | @@ -484,12 +532,21 @@ mac80211_hostapd_setup_base() { |
developer | 5af1935 | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 231 | append base_cfg "he_mu_edca_ac_vo_timer=255" "$N" |
| 232 | fi |
| 233 | |
developer | be359a2 | 2023-07-13 13:18:19 +0800 | [diff] [blame] | 234 | + set_default tx_burst 2 |
developer | 5af1935 | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 235 | + |
| 236 | hostapd_prepare_device_config "$hostapd_conf_file" nl80211 |
| 237 | cat >> "$hostapd_conf_file" <<EOF |
| 238 | ${channel:+channel=$channel} |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 239 | ${channel_list:+chanlist=$channel_list} |
| 240 | ${hostapd_noscan:+noscan=1} |
| 241 | ${tx_burst:+tx_queue_data2_burst=$tx_burst} |
| 242 | +${mbssid:+mbssid=$mbssid} |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 243 | +${mu_onoff:+mu_onoff=$mu_onoff} |
| 244 | +${itxbfen:+ibf_enable=$itxbfen} |
developer | 13566db | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 245 | +${lpi_enable:+lpi_enable=$lpi_enable} |
| 246 | +${sku_idx:+sku_idx=$sku_idx} |
| 247 | +${beacon_dup:+beacon_dup=$beacon_dup} |
developer | 599c2a3 | 2023-07-21 11:20:56 +0800 | [diff] [blame] | 248 | +${rnr:+rnr=$rnr} |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 249 | $base_cfg |
| 250 | |
| 251 | EOF |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 252 | @@ -517,7 +574,7 @@ mac80211_hostapd_setup_bss() { |
developer | 8ce7856 | 2023-02-24 16:10:53 +0800 | [diff] [blame] | 253 | append hostapd_cfg "wds_sta=1" "$N" |
| 254 | [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N" |
| 255 | } |
| 256 | - [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" |
| 257 | + [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" |
| 258 | |
| 259 | cat >> /var/run/hostapd-$phy.conf <<EOF |
| 260 | $hostapd_cfg |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 261 | @@ -527,6 +584,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int} |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 262 | EOF |
| 263 | } |
| 264 | |
| 265 | +mac80211_generate_mbssid_mac() { |
| 266 | + local phy="$1" |
| 267 | + local transmitted_bssid="$2" |
developer | 2e5aa0a | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 268 | + local id="${mbssidx:-0}" |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 269 | + |
| 270 | + local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)" |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 271 | + |
| 272 | + if [ -z "$transmitted_bssid" ]; then |
| 273 | + transmitted_bssid=$ref |
| 274 | + fi |
| 275 | + |
| 276 | + if [ $id -eq 0 ]; then |
| 277 | + echo "$transmitted_bssid" |
| 278 | + return |
| 279 | + fi |
| 280 | + |
| 281 | + local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS" |
| 282 | + |
| 283 | + # Calculate nontransmitted bssid |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 284 | + b6="0x$6" |
| 285 | + ref_b6=$(($b6 % $max_mbssid)) |
developer | 2e5aa0a | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 286 | + b6=$(($b6 - $ref_b6 + ($ref_b6 + $id) % $max_mbssid)) |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 287 | + printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6 |
| 288 | +} |
| 289 | + |
| 290 | mac80211_get_addr() { |
| 291 | local phy="$1" |
| 292 | local idx="$(($2 + 1))" |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 293 | @@ -757,7 +839,19 @@ mac80211_prepare_vif() { |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 294 | |
| 295 | json_select .. |
| 296 | |
| 297 | - if [ -z "$macaddr" ]; then |
developer | e49d522 | 2023-06-19 19:48:25 +0800 | [diff] [blame] | 298 | + if [ "$mbssid" -gt 0 ] && [ "$mode" == "ap" ]; then |
developer | 2e5aa0a | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 299 | + [ "$mbssidx" -eq 0 ] && { |
| 300 | + if [ -z $macaddr ]; then |
| 301 | + transmitted_bssid="$(mac80211_generate_mac $phy)" |
| 302 | + else |
| 303 | + # uci set mac address |
| 304 | + transmitted_bssid=$macaddr |
| 305 | + fi |
| 306 | + macidx="$(($macidx + 1))" |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 307 | + } |
| 308 | + macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)" |
developer | 2e5aa0a | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 309 | + mbssidx="$(($mbssidx + 1))" |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 310 | + elif [ -z "$macaddr" ]; then |
| 311 | macaddr="$(mac80211_generate_mac $phy)" |
| 312 | macidx="$(($macidx + 1))" |
| 313 | elif [ "$macaddr" = 'random' ]; then |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 314 | @@ -1058,6 +1152,9 @@ mac80211_setup_vif() { |
developer | b95b0fd | 2022-12-14 23:07:34 +0800 | [diff] [blame] | 315 | |
| 316 | json_select .. |
| 317 | [ -n "$failed" ] || wireless_add_vif "$name" "$ifname" |
| 318 | + |
| 319 | + echo "Setup SMP Affinity" |
| 320 | + /sbin/smp-mt76.sh |
| 321 | } |
| 322 | |
| 323 | get_freq() { |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 324 | @@ -1122,6 +1219,25 @@ drv_mac80211_cleanup() { |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 325 | hostapd_common_cleanup |
| 326 | } |
| 327 | |
| 328 | +mac80211_count_ap() { |
| 329 | + total_num_ap=$(($total_num_ap + 1)) |
| 330 | +} |
| 331 | + |
developer | 96f62da | 2023-11-27 19:34:42 +0800 | [diff] [blame] | 332 | +country_consistent_check() { |
| 333 | + local i |
| 334 | + inconsistent_country=0 |
| 335 | + country_list="$(cat /etc/config/wireless | grep country | cut -d ' ' -f3 | tr -s "'\n" ' ')" |
| 336 | + for i in $country_list |
| 337 | + do |
| 338 | + ret="$(echo $country_list | awk '{print ($2 == "" || $1 == $2)}')" |
| 339 | + [ $ret = '0' ] && { |
| 340 | + inconsistent_country=1 |
| 341 | + return |
| 342 | + } |
| 343 | + country_list="$(echo $country_list | sed -r 's/[A-Z]{2}( )*//')" |
| 344 | + done |
| 345 | +} |
| 346 | + |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 347 | drv_mac80211_setup() { |
| 348 | json_select config |
| 349 | json_get_vars \ |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 350 | @@ -1129,7 +1245,8 @@ drv_mac80211_setup() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 351 | country chanbw distance \ |
| 352 | txpower antenna_gain \ |
| 353 | rxantenna txantenna \ |
| 354 | - frag rts beacon_int:100 htmode |
| 355 | + frag rts beacon_int:100 htmode \ |
| 356 | + sr_enable sr_enhanced |
| 357 | json_get_values basic_rate_list basic_rate |
| 358 | json_get_values scan_list scan_list |
| 359 | json_select .. |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 360 | @@ -1180,6 +1297,7 @@ drv_mac80211_setup() { |
developer | 2e5aa0a | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 361 | no_ap=1 |
| 362 | macidx=0 |
| 363 | staidx=0 |
| 364 | + mbssidx=0 |
| 365 | |
| 366 | [ -n "$chanbw" ] && { |
| 367 | for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 368 | @@ -1219,6 +1337,16 @@ drv_mac80211_setup() { |
developer | 0ef73a6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 369 | for_each_interface "sta adhoc mesh" mac80211_set_noscan |
| 370 | [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy" |
| 371 | |
| 372 | + total_num_ap=0 |
| 373 | + max_mbssid=1 |
| 374 | + for_each_interface "ap" mac80211_count_ap |
| 375 | + total_num_ap=$(($total_num_ap - 1)) |
| 376 | + while [ $total_num_ap -gt 0 ] |
| 377 | + do |
| 378 | + total_num_ap=$(($total_num_ap >> 1)) |
| 379 | + max_mbssid=$(($max_mbssid << 1)) |
| 380 | + done |
| 381 | + |
| 382 | mac80211_prepare_iw_htmode |
| 383 | for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif |
| 384 | NEWAPLIST= |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 385 | @@ -1249,8 +1377,22 @@ drv_mac80211_setup() { |
developer | 96f62da | 2023-11-27 19:34:42 +0800 | [diff] [blame] | 386 | } |
| 387 | fi |
developer | 528f1a9 | 2023-05-02 11:10:08 +0800 | [diff] [blame] | 388 | if [ "$no_reload" != "0" ]; then |
developer | 96f62da | 2023-11-27 19:34:42 +0800 | [diff] [blame] | 389 | + country_consistent_check |
| 390 | + if [ "$inconsistent_country" == "1" ]; then |
| 391 | + echo "ERROR: Please use the same country for all the radios." |
| 392 | + wireless_setup_failed HOSTAPD_START_FAILED |
| 393 | + return |
| 394 | + fi |
developer | 528f1a9 | 2023-05-02 11:10:08 +0800 | [diff] [blame] | 395 | add_ap=1 |
| 396 | ubus wait_for hostapd |
| 397 | + |
| 398 | + # each phy sleeps different times to prevent for ubus race condition. |
| 399 | + if [ "$phy" = "phy1" ]; then |
| 400 | + sleep 1; |
| 401 | + elif [ "$phy" = "phy2" ]; then |
| 402 | + sleep 2; |
| 403 | + fi |
| 404 | + |
| 405 | local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")" |
| 406 | ret="$?" |
| 407 | [ "$ret" != 0 -o -z "$hostapd_res" ] && { |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 408 | @@ -1266,6 +1408,9 @@ drv_mac80211_setup() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 409 | [ "${add_ap}" = 1 ] && sleep 1 |
| 410 | for_each_interface "ap" mac80211_setup_vif |
| 411 | |
| 412 | + [ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable |
| 413 | + [ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable |
| 414 | + |
| 415 | NEWSPLIST= |
| 416 | NEWUMLIST= |
| 417 | |
developer | d3c708b | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 418 | diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | e7dc049 | 2024-04-08 11:29:40 +0800 | [diff] [blame] | 419 | index 3ecd9322..d4b42cee 100644 |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 420 | --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
| 421 | +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 422 | @@ -46,8 +46,13 @@ check_mac80211_device() { |
| 423 | |
| 424 | |
| 425 | __get_band_defaults() { |
| 426 | + local mt7915=0 |
| 427 | local phy="$1" |
| 428 | |
| 429 | + if (lspci | grep -q "7915"); then |
| 430 | + mt7915=1 |
| 431 | + fi |
| 432 | + |
| 433 | ( iw phy "$phy" info; echo ) | awk ' |
| 434 | BEGIN { |
| 435 | bands = "" |
developer | 809fbc9 | 2024-03-06 03:12:09 +0800 | [diff] [blame] | 436 | @@ -58,7 +63,8 @@ BEGIN { |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 437 | mode="NOHT" |
| 438 | if (ht) mode="HT20" |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 439 | if (vht && band != "1:") mode="VHT80" |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 440 | - if (he) mode="HE80" |
| 441 | + if (he) mode="HE160" |
| 442 | + if (he && mt7915) mode="HE80" |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 443 | if (he && band == "1:") mode="HE20" |
developer | 809fbc9 | 2024-03-06 03:12:09 +0800 | [diff] [blame] | 444 | sub("\\[", "", channel) |
| 445 | sub("\\]", "", channel) |
| 446 | @@ -87,6 +93,11 @@ $0 ~ "HE Iftypes" { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 447 | he=1 |
| 448 | } |
| 449 | |
developer | db28f7d | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 450 | +$0 ~ / *HE MAC Capabilities \(0x000000000000\)/ { |
| 451 | + he=0 |
| 452 | +} |
| 453 | + |
developer | db28f7d | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 454 | + |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 455 | $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel { |
| 456 | channel = $4 |
| 457 | } |
developer | 809fbc9 | 2024-03-06 03:12:09 +0800 | [diff] [blame] | 458 | @@ -120,6 +131,20 @@ get_band_defaults() { |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 459 | mode_band="$band" |
| 460 | channel="$chan" |
| 461 | htmode="$mode" |
| 462 | + if [ "$band" = "6g" ] |
| 463 | + then |
| 464 | + encryption=sae |
| 465 | + key=12345678 |
developer | db28f7d | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 466 | + sae_pwe=2 |
| 467 | + ieee80211w=2 |
developer | 20dee59 | 2023-06-09 14:43:01 +0800 | [diff] [blame] | 468 | + channel=37 |
| 469 | + mbssid=1 |
developer | afea3d2 | 2023-11-14 11:11:34 +0800 | [diff] [blame] | 470 | + mbo=1 |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 471 | + else |
developer | 5ec71a1 | 2023-05-25 12:34:13 +0800 | [diff] [blame] | 472 | + noscan=1 |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 473 | + encryption=none |
developer | 599c2a3 | 2023-07-21 11:20:56 +0800 | [diff] [blame] | 474 | + rnr=1 |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 475 | + fi |
| 476 | done |
| 477 | } |
| 478 | |
developer | 809fbc9 | 2024-03-06 03:12:09 +0800 | [diff] [blame] | 479 | @@ -153,6 +178,10 @@ detect_mac80211() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 480 | |
| 481 | json_load_file /etc/board.json |
| 482 | |
| 483 | + # generate random bytes for macaddr |
| 484 | + rand=$(hexdump -C /dev/urandom | head -n 1 &) |
| 485 | + killall hexdump |
| 486 | + |
| 487 | for _dev in /sys/class/ieee80211/*; do |
| 488 | [ -e "$_dev" ] || continue |
| 489 | |
developer | 809fbc9 | 2024-03-06 03:12:09 +0800 | [diff] [blame] | 490 | @@ -162,6 +191,13 @@ detect_mac80211() { |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 491 | channel="" |
| 492 | htmode="" |
| 493 | ht_capab="" |
| 494 | + encryption="" |
developer | 5ec71a1 | 2023-05-25 12:34:13 +0800 | [diff] [blame] | 495 | + noscan="" |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 496 | + key="" |
developer | 6b36db2 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 497 | + sae_pwe="" |
developer | db28f7d | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 498 | + ieee80211w="" |
developer | 20dee59 | 2023-06-09 14:43:01 +0800 | [diff] [blame] | 499 | + mbssid="" |
developer | 599c2a3 | 2023-07-21 11:20:56 +0800 | [diff] [blame] | 500 | + rnr="" |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 501 | |
| 502 | get_band_defaults "$dev" |
| 503 | |
developer | 809fbc9 | 2024-03-06 03:12:09 +0800 | [diff] [blame] | 504 | @@ -192,6 +228,14 @@ detect_mac80211() { |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 505 | ;; |
| 506 | esac |
| 507 | |
developer | 0e58b19 | 2023-07-13 19:41:47 +0800 | [diff] [blame] | 508 | + macaddr="" |
developer | 8c1cf58 | 2023-06-26 13:43:31 +0800 | [diff] [blame] | 509 | + if (dmesg | grep -q "eeprom load fail"); then |
developer | 2e5aa0a | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 510 | + for i in $(seq 2 3); do |
| 511 | + macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i) |
| 512 | + done |
| 513 | + macaddr="00:0$(($devidx - 1)):55:66${macaddr}" |
developer | 2e5aa0a | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 514 | + fi |
developer | f18436f | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 515 | + |
| 516 | uci -q batch <<-EOF |
| 517 | set wireless.${name}=wifi-device |
| 518 | set wireless.${name}.type=mac80211 |
developer | 809fbc9 | 2024-03-06 03:12:09 +0800 | [diff] [blame] | 519 | @@ -199,15 +243,43 @@ detect_mac80211() { |
developer | 6b36db2 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 520 | set wireless.${name}.channel=${channel} |
| 521 | set wireless.${name}.band=${mode_band} |
| 522 | set wireless.${name}.htmode=$htmode |
| 523 | - set wireless.${name}.disabled=1 |
developer | db28f7d | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 524 | + set wireless.${name}.country='US' |
developer | 5ec71a1 | 2023-05-25 12:34:13 +0800 | [diff] [blame] | 525 | + set wireless.${name}.noscan=${noscan} |
developer | 6b36db2 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 526 | + set wireless.${name}.disabled=0 |
developer | 20dee59 | 2023-06-09 14:43:01 +0800 | [diff] [blame] | 527 | +EOF |
| 528 | + [ -n "$mbssid" ] && { |
| 529 | + uci -q set wireless.${name}.mbssid=${mbssid} |
| 530 | + } |
developer | 599c2a3 | 2023-07-21 11:20:56 +0800 | [diff] [blame] | 531 | + [ -n "$rnr" ] && { |
| 532 | + uci -q set wireless.${name}.rnr=${rnr} |
| 533 | + } |
developer | 6b36db2 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 534 | |
developer | 20dee59 | 2023-06-09 14:43:01 +0800 | [diff] [blame] | 535 | + uci -q batch <<-EOF |
developer | 6b36db2 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 536 | set wireless.default_${name}=wifi-iface |
| 537 | set wireless.default_${name}.device=${name} |
developer | 5f5952d | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 538 | set wireless.default_${name}.network=lan |
| 539 | set wireless.default_${name}.mode=ap |
developer | 6b36db2 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 540 | - set wireless.default_${name}.ssid=OpenWrt |
developer | 5f5952d | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 541 | - set wireless.default_${name}.encryption=none |
developer | 6b36db2 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 542 | + set wireless.default_${name}.ssid=OpenWrt-${mode_band} |
developer | 5f5952d | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 543 | + set wireless.default_${name}.encryption=${encryption} |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 544 | EOF |
developer | 0e58b19 | 2023-07-13 19:41:47 +0800 | [diff] [blame] | 545 | + |
| 546 | + # calibrated board will use eeprom macaddress, not ramdom address |
| 547 | + [ -n "$macaddr" ] && { |
| 548 | + uci -q set wireless.default_${name}.macaddr=${macaddr} |
| 549 | + } |
| 550 | + |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 551 | + [ -n "$key" ] && { |
developer | 5f5952d | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 552 | + uci -q set wireless.default_${name}.key=${key} |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 553 | + } |
developer | 6b36db2 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 554 | + [ -n "$sae_pwe" ] && { |
| 555 | + uci -q set wireless.default_${name}.sae_pwe=${sae_pwe} |
| 556 | + } |
developer | db28f7d | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 557 | + [ -n "$ieee80211w" ] && { |
| 558 | + uci -q set wireless.default_${name}.ieee80211w=${ieee80211w} |
| 559 | + } |
developer | afea3d2 | 2023-11-14 11:11:34 +0800 | [diff] [blame] | 560 | + [ -n "$mbo" ] && { |
| 561 | + uci -q set wireless.default_${name}.mbo=${mbo} |
| 562 | + } |
developer | 92f0d54 | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 563 | uci -q commit wireless |
developer | 5f5952d | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 564 | done |
| 565 | } |
developer | f16b916 | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 566 | diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh |
developer | e7dc049 | 2024-04-08 11:29:40 +0800 | [diff] [blame] | 567 | index 28bd2106..723d3874 100644 |
developer | f16b916 | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 568 | --- a/package/network/services/hostapd/files/hostapd.sh |
| 569 | +++ b/package/network/services/hostapd/files/hostapd.sh |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 570 | @@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() { |
| 571 | [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256" |
| 572 | ;; |
| 573 | sae) |
| 574 | - append wpa_key_mgmt "SAE" |
| 575 | + case "$encryption" in |
| 576 | + *sae-ext*) |
| 577 | + append wpa_key_mgmt "SAE-EXT-KEY" |
| 578 | + ;; |
| 579 | + *) |
| 580 | + append wpa_key_mgmt "SAE" |
| 581 | + ;; |
| 582 | + esac |
| 583 | [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-SAE" |
| 584 | ;; |
| 585 | psk-sae) |
| 586 | @@ -115,6 +122,7 @@ hostapd_common_add_device_config() { |
| 587 | config_add_int rts_threshold |
| 588 | config_add_int rssi_reject_assoc_rssi |
| 589 | config_add_int rssi_ignore_probe_request |
| 590 | + config_add_int rssi_reject_assoc_timeout |
| 591 | config_add_int maxassoc |
| 592 | |
| 593 | config_add_string acs_chan_bias |
developer | d64986d | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 594 | @@ -225,8 +233,10 @@ hostapd_prepare_device_config() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 595 | hostapd_add_rate brlist "$br" |
| 596 | done |
| 597 | |
| 598 | + json_get_vars rssi_reject_assoc_timeout |
| 599 | [ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N" |
| 600 | [ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N" |
| 601 | + [ -n "$rssi_reject_assoc_timeout" ] && append base_cfg "rssi_reject_assoc_timeout=$rssi_reject_assoc_timeout" "$N" |
| 602 | [ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N" |
| 603 | [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N" |
| 604 | [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N" |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 605 | @@ -376,6 +386,24 @@ hostapd_common_add_bss_config() { |
developer | 132779d | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 606 | config_add_string fils_dhcp |
| 607 | |
| 608 | config_add_int ocv |
| 609 | + |
developer | 132779d | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 610 | + config_add_int disable_he |
| 611 | + config_add_int disable_vht |
| 612 | + config_add_int disable_ht |
developer | c96c3f2 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 613 | + |
developer | 2b3ebe2 | 2023-05-25 14:40:30 +0800 | [diff] [blame] | 614 | + config_add_boolean beacon_prot interworking |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 615 | + |
| 616 | + config_add_int unsol_bcast_probe_resp_interval |
| 617 | + config_add_int fils_discovery_min_interval |
| 618 | + config_add_int fils_discovery_max_interval |
| 619 | + config_add_boolean rnr |
| 620 | + |
| 621 | + config_add_array sae_groups |
| 622 | + config_add_array owe_groups |
| 623 | + config_add_array pairwise |
| 624 | + config_add_string group_cipher |
developer | 4bfe7d8 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 625 | + config_add_string group_mgmt_cipher |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 626 | + |
developer | 132779d | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 627 | } |
| 628 | |
| 629 | hostapd_set_vlan_file() { |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 630 | @@ -440,11 +468,11 @@ append_iw_nai_realm() { |
developer | 2b3ebe2 | 2023-05-25 14:40:30 +0800 | [diff] [blame] | 631 | } |
| 632 | |
| 633 | append_iw_venue_name() { |
| 634 | - append bss_conf "venue_name=$1" "$N" |
| 635 | + [ -n "$1" ] && append bss_conf "venue_name=$1" "$N" |
| 636 | } |
| 637 | |
| 638 | append_iw_venue_url() { |
| 639 | - append bss_conf "venue_url=$1" "$N" |
| 640 | + [ -n "$1" ] && append bss_conf "venue_url=$1" "$N" |
| 641 | } |
| 642 | |
| 643 | append_hs20_oper_friendly_name() { |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 644 | @@ -562,7 +590,8 @@ hostapd_set_bss_options() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 645 | ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \ |
| 646 | multicast_to_unicast_all proxy_arp per_sta_vif \ |
| 647 | eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ |
| 648 | - vendor_elements fils ocv |
| 649 | + vendor_elements fils ocv unsol_bcast_probe_resp_interval fils_discovery_min_interval \ |
developer | 4bfe7d8 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 650 | + fils_discovery_max_interval rnr group_cipher group_mgmt_cipher |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 651 | |
| 652 | set_default fils 0 |
| 653 | set_default isolate 0 |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 654 | @@ -790,6 +819,36 @@ hostapd_set_bss_options() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 655 | local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))" |
| 656 | append bss_conf "auth_algs=${auth_algs:-1}" "$N" |
| 657 | append bss_conf "wpa=$wpa" "$N" |
| 658 | + |
| 659 | + json_get_values pairwise pairwise |
developer | d11b844 | 2023-10-25 15:01:32 +0800 | [diff] [blame] | 660 | + json_get_vars group_cipher |
developer | ce91704 | 2023-07-19 10:22:24 +0800 | [diff] [blame] | 661 | + if [ -n "$pairwise" ]; then |
| 662 | + case "$pairwise" in |
| 663 | + *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) |
| 664 | + wpa_cipher="CCMP TKIP" |
| 665 | + ;; |
| 666 | + *ccmp256) |
| 667 | + wpa_cipher="CCMP-256" |
| 668 | + ;; |
| 669 | + *aes|*ccmp) |
| 670 | + wpa_cipher="CCMP" |
| 671 | + ;; |
| 672 | + *tkip) |
| 673 | + wpa_cipher="TKIP" |
| 674 | + ;; |
| 675 | + *gcmp256) |
| 676 | + wpa_cipher="GCMP-256" |
| 677 | + ;; |
| 678 | + *gcmp) |
| 679 | + wpa_cipher="GCMP" |
| 680 | + ;; |
| 681 | + *) |
| 682 | + wpa_cipher="" |
| 683 | + ;; |
| 684 | + esac |
| 685 | + fi |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 686 | + [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher" |
| 687 | + |
| 688 | [ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N" |
| 689 | |
| 690 | set_default wps_pushbutton 0 |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 691 | @@ -841,7 +900,7 @@ hostapd_set_bss_options() { |
developer | e1c4f2a | 2023-05-22 19:46:10 +0800 | [diff] [blame] | 692 | } |
| 693 | |
| 694 | append bss_conf "ssid=$ssid" "$N" |
| 695 | - [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N" |
| 696 | + [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=$network_bridge" "$N" |
| 697 | [ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N" |
| 698 | [ -n "$iapp_interface" ] && { |
| 699 | local ifname |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 700 | @@ -954,6 +1013,8 @@ hostapd_set_bss_options() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 701 | fi |
| 702 | |
| 703 | if [ "$wpa" -ge "2" ]; then |
| 704 | + json_get_values sae_groups sae_groups |
| 705 | + json_get_values owe_groups owe_groups |
| 706 | if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then |
| 707 | set_default auth_cache 1 |
| 708 | append bss_conf "rsn_preauth=1" "$N" |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 709 | @@ -972,17 +1033,52 @@ hostapd_set_bss_options() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 710 | append bss_conf "okc=$auth_cache" "$N" |
| 711 | [ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N" |
| 712 | |
| 713 | + [ -z "$group_cipher" ] && group_cipher="$wpa_cipher" |
| 714 | + |
| 715 | + if [ -n "$sae_groups" -o -n "$owe_groups" ]; then |
| 716 | + case "$auth_type" in |
| 717 | + sae*) |
| 718 | + append bss_conf "sae_groups=$sae_groups" "$N" |
| 719 | + append bss_conf "group_cipher=$group_cipher" "$N" |
| 720 | + ;; |
| 721 | + owe) |
| 722 | + append bss_conf "owe_groups=$owe_groups" "$N" |
| 723 | + append bss_conf "group_cipher=$group_cipher" "$N" |
| 724 | + ;; |
| 725 | + esac |
| 726 | + fi |
| 727 | + |
developer | c96c3f2 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 728 | # RSN -> allow management frame protection |
| 729 | case "$ieee80211w" in |
| 730 | [012]) |
| 731 | - json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout |
| 732 | + json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot |
| 733 | append bss_conf "ieee80211w=$ieee80211w" "$N" |
| 734 | [ "$ieee80211w" -gt "0" ] && { |
developer | 4bfe7d8 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 735 | + if [ -z "$group_mgmt_cipher" ]; then |
| 736 | + case "$group_cipher" in |
| 737 | + CCMP-256) |
| 738 | + ieee80211w_mgmt_cipher="BIP-CMAC-256" |
| 739 | + ;; |
| 740 | + CCMP) |
| 741 | + ieee80211w_mgmt_cipher="AES-128-CMAC" |
| 742 | + ;; |
| 743 | + GCMP-256) |
| 744 | + ieee80211w_mgmt_cipher="BIP-GMAC-256" |
| 745 | + ;; |
| 746 | + GCMP) |
| 747 | + ieee80211w_mgmt_cipher="BIP-GMAC-128" |
| 748 | + ;; |
| 749 | + esac |
| 750 | + else |
| 751 | + ieee80211w_mgmt_cipher="$group_mgmt_cipher" |
| 752 | + fi |
developer | c96c3f2 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 753 | if [ "$auth_type" = "eap192" ]; then |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 754 | append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N" |
developer | c96c3f2 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 755 | else |
| 756 | append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" |
| 757 | fi |
| 758 | + [ -n "$beacon_prot" ] && \ |
| 759 | + append bss_conf "beacon_prot=$beacon_prot" "$N" |
| 760 | [ -n "$ieee80211w_max_timeout" ] && \ |
| 761 | append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" |
| 762 | [ -n "$ieee80211w_retry_timeout" ] && \ |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 763 | @@ -1047,9 +1143,10 @@ hostapd_set_bss_options() { |
developer | 2b3ebe2 | 2023-05-25 14:40:30 +0800 | [diff] [blame] | 764 | json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm |
| 765 | json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3 |
| 766 | json_get_vars iw_venue_name iw_venue_url |
| 767 | + json_get_vars interworking |
| 768 | |
| 769 | set_default iw_enabled 0 |
| 770 | - if [ "$iw_enabled" = "1" ]; then |
| 771 | + if [ "$iw_enabled" = "1" ] || [ "$interworking" = "1" ]; then |
| 772 | append bss_conf "interworking=1" "$N" |
| 773 | set_default iw_internet 1 |
| 774 | set_default iw_asra 0 |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 775 | @@ -1156,6 +1253,22 @@ hostapd_set_bss_options() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 776 | append bss_conf "$val" "$N" |
| 777 | done |
| 778 | |
| 779 | + if [ "$unsol_bcast_probe_resp_interval" -gt 0 ]; then |
| 780 | + append bss_conf "unsol_bcast_probe_resp_interval=$unsol_bcast_probe_resp_interval" "$N" |
| 781 | + fi |
| 782 | + |
| 783 | + if [ -n "$fils_discovery_min_interval" ]; then |
| 784 | + append bss_conf "fils_discovery_min_interval=$fils_discovery_min_interval" "$N" |
| 785 | + fi |
| 786 | + |
| 787 | + if [ -n "$fils_discovery_max_interval" ]; then |
| 788 | + append bss_conf "fils_discovery_max_interval=$fils_discovery_max_interval" "$N" |
| 789 | + fi |
| 790 | + |
| 791 | + if [ -n "$rnr" ]; then |
| 792 | + append bss_conf "rnr=$rnr" "$N" |
| 793 | + fi |
| 794 | + |
| 795 | bss_md5sum="$(echo $bss_conf | md5sum | cut -d" " -f1)" |
| 796 | append bss_conf "config_id=$bss_md5sum" "$N" |
| 797 | |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 798 | @@ -1246,6 +1359,7 @@ wpa_supplicant_prepare_interface() { |
developer | be359a2 | 2023-07-13 13:18:19 +0800 | [diff] [blame] | 799 | country_str="country=$country" |
| 800 | } |
| 801 | |
developer | 59f411e | 2023-07-24 16:58:25 +0800 | [diff] [blame] | 802 | + local tx_queue_data2_burst="tx_queue_data2_burst=0" |
developer | be359a2 | 2023-07-13 13:18:19 +0800 | [diff] [blame] | 803 | multiap_flag_file="${_config}.is_multiap" |
| 804 | if [ "$multi_ap" = "1" ]; then |
| 805 | touch "$multiap_flag_file" |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 806 | @@ -1257,6 +1371,7 @@ wpa_supplicant_prepare_interface() { |
developer | be359a2 | 2023-07-13 13:18:19 +0800 | [diff] [blame] | 807 | ${scan_list:+freq_list=$scan_list} |
| 808 | $ap_scan |
| 809 | $country_str |
| 810 | +$tx_queue_data2_burst |
| 811 | EOF |
| 812 | return 0 |
| 813 | } |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 814 | @@ -1528,12 +1643,39 @@ wpa_supplicant_add_network() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 815 | ;; |
| 816 | esac |
| 817 | |
developer | 285ca01 | 2023-07-25 20:41:04 +0800 | [diff] [blame] | 818 | - [ "$wpa_cipher" = GCMP ] && { |
| 819 | - append network_data "pairwise=GCMP" "$N$T" |
| 820 | - append network_data "group=GCMP" "$N$T" |
| 821 | - } |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 822 | + json_get_values pairwise pairwise |
developer | 4bfe7d8 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 823 | + json_get_vars group_cipher group_mgmt_cipher |
developer | ce91704 | 2023-07-19 10:22:24 +0800 | [diff] [blame] | 824 | + if [ -n "$pairwise" ]; then |
| 825 | + case "$pairwise" in |
| 826 | + *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) |
| 827 | + wpa_cipher="CCMP TKIP" |
| 828 | + ;; |
| 829 | + *ccmp256) |
| 830 | + wpa_cipher="CCMP-256" |
| 831 | + ;; |
| 832 | + *aes|*ccmp) |
| 833 | + wpa_cipher="CCMP" |
| 834 | + ;; |
| 835 | + *tkip) |
| 836 | + wpa_cipher="TKIP" |
| 837 | + ;; |
| 838 | + *gcmp256) |
| 839 | + wpa_cipher="GCMP-256" |
| 840 | + ;; |
| 841 | + *gcmp) |
| 842 | + wpa_cipher="GCMP" |
| 843 | + ;; |
| 844 | + *) |
| 845 | + wpa_cipher="" |
| 846 | + ;; |
| 847 | + esac |
| 848 | + fi |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 849 | + [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher" |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 850 | |
| 851 | [ "$mode" = mesh ] || { |
| 852 | + json_get_values sae_groups sae_groups |
| 853 | + json_get_values owe_groups owe_groups |
| 854 | + |
| 855 | case "$wpa" in |
| 856 | 1) |
| 857 | append network_data "proto=WPA" "$N$T" |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 858 | @@ -1543,12 +1685,58 @@ wpa_supplicant_add_network() { |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 859 | ;; |
| 860 | esac |
| 861 | |
| 862 | + [ -n "$wpa_pairwise" ] && append network_data "pairwise=$wpa_pairwise" "$N$T" |
| 863 | + [ -z "$group_cipher" ] && group_cipher="$wpa_cipher" |
| 864 | + |
| 865 | + if [ -n "$sae_groups" -o -n "$owe_groups" ]; then |
| 866 | + case "$auth_type" in |
| 867 | + sae*) |
| 868 | + echo "sae_groups=$sae_groups" >> "$_config" |
| 869 | + append network_data "group=$group_cipher" "$N$T" |
| 870 | + ;; |
| 871 | + owe) |
| 872 | + append network_data "owe_group=$owe_groups" "$N$T" |
| 873 | + append network_data "group=$group_cipher" "$N$T" |
| 874 | + ;; |
| 875 | + esac |
| 876 | + fi |
| 877 | + |
| 878 | + # RSN -> allow management frame protection |
| 879 | case "$ieee80211w" in |
| 880 | [012]) |
| 881 | - [ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T" |
| 882 | + json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot |
| 883 | + append network_data "ieee80211w=$ieee80211w" "$N$T" |
| 884 | + [ "$ieee80211w" -gt "0" ] && { |
developer | 4bfe7d8 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 885 | + if [ -z "$group_mgmt_cipher" ]; then |
| 886 | + case "$group_cipher" in |
| 887 | + CCMP-256) |
| 888 | + ieee80211w_mgmt_cipher="BIP-CMAC-256" |
| 889 | + ;; |
| 890 | + CCMP) |
| 891 | + ieee80211w_mgmt_cipher="AES-128-CMAC" |
| 892 | + ;; |
| 893 | + GCMP-256) |
| 894 | + ieee80211w_mgmt_cipher="BIP-GMAC-256" |
| 895 | + ;; |
| 896 | + GCMP) |
| 897 | + ieee80211w_mgmt_cipher="BIP-GMAC-128" |
| 898 | + ;; |
| 899 | + esac |
| 900 | + else |
| 901 | + ieee80211w_mgmt_cipher="$group_mgmt_cipher" |
| 902 | + fi |
developer | e4e006c | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 903 | + if [ "$auth_type" = "eap192" ]; then |
| 904 | + append network_data "group_mgmt=BIP-GMAC-256" "$N$T" |
| 905 | + else |
| 906 | + append network_data "group_mgmt=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N$T" |
| 907 | + fi |
| 908 | + [ -n "$beacon_prot" ] && \ |
| 909 | + append network_data "beacon_prot=$beacon_prot" "$N$T" |
| 910 | + } |
| 911 | ;; |
| 912 | esac |
| 913 | } |
| 914 | + |
| 915 | [ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T" |
| 916 | [ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T" |
| 917 | |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 918 | @@ -1559,6 +1747,17 @@ wpa_supplicant_add_network() { |
developer | 132779d | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 919 | [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T" |
| 920 | [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T" |
| 921 | |
developer | 132779d | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 922 | + local disable_he |
| 923 | + local disable_vht |
| 924 | + local disable_ht |
developer | 132779d | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 925 | + json_get_vars disable_he |
| 926 | + json_get_vars disable_vht |
| 927 | + json_get_vars disable_ht |
| 928 | + |
developer | 132779d | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 929 | + [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T" |
| 930 | + [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T" |
| 931 | + [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T" |
| 932 | + |
| 933 | [ -n "$basic_rate" ] && { |
| 934 | local br rate_list= |
| 935 | for br in $basic_rate; do |
developer | 38e5a2c | 2024-03-01 08:59:08 +0800 | [diff] [blame] | 936 | @@ -1573,6 +1772,11 @@ wpa_supplicant_add_network() { |
developer | f16b916 | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 937 | append network_data "mcast_rate=$mc_rate" "$N$T" |
| 938 | } |
| 939 | |
| 940 | + if [ "$auth_type" = "sae" ]; then |
| 941 | + json_get_vars sae_pwe sae_pwe |
| 942 | + [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config" |
| 943 | + fi |
| 944 | + |
| 945 | if [ "$key_mgmt" = "WPS" ]; then |
| 946 | echo "wps_cred_processing=1" >> "$_config" |
| 947 | else |