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