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