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