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 | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 2 | index 02cf715d..d878cb2a 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 | f0de14b | 2022-12-14 23:07:34 +0800 | [diff] [blame] | 5 | @@ -20,6 +20,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 | f0de14b | 2022-12-14 23:07:34 +0800 | [diff] [blame] | 13 | @@ -72,6 +73,10 @@ 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 \ |
| 21 | |
| 22 | config-$(call config_package,cfg80211) += CFG80211 |
| 23 | config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE |
developer | f0de14b | 2022-12-14 23:07:34 +0800 | [diff] [blame] | 24 | @@ -297,6 +302,8 @@ define Build/Prepare |
developer | 356ecec | 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 | 20d6771 | 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 | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 34 | index 5aaba9af..ce30b61d 100644 |
developer | 20d6771 | 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 | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 37 | @@ -27,6 +27,7 @@ drv_mac80211_init_device_config() { |
| 38 | |
| 39 | config_add_string path phy 'macaddr:macaddr' |
| 40 | config_add_string tx_burst |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 41 | + config_add_int mbssid mu_onoff |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 42 | config_add_string distance |
| 43 | config_add_int beacon_int chanbw frag rts |
| 44 | config_add_int rxantenna txantenna antenna_gain txpower min_tx_power |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 45 | @@ -53,7 +54,10 @@ drv_mac80211_init_device_config() { |
| 46 | he_spr_sr_control \ |
| 47 | he_spr_psr_enabled \ |
| 48 | he_bss_color_enabled \ |
| 49 | - he_twt_required |
| 50 | + he_twt_required \ |
| 51 | + he_twt_responder \ |
| 52 | + etxbfen \ |
| 53 | + itxbfen |
| 54 | config_add_int \ |
| 55 | beamformer_antennas \ |
| 56 | beamformee_antennas \ |
| 57 | @@ -140,13 +144,11 @@ mac80211_hostapd_setup_base() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 58 | [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && |
| 59 | append base_cfg "acs_exclude_dfs=1" "$N" |
| 60 | |
| 61 | - json_get_vars noscan ht_coex min_tx_power:0 tx_burst |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 62 | + json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff |
| 63 | + json_get_vars etxbfen:1 itxbfen:1 |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 64 | json_get_values ht_capab_list ht_capab |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 65 | json_get_values channel_list channels |
| 66 | |
| 67 | - [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ |
| 68 | - channel_list="$channel" |
| 69 | - |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 70 | [ "$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] | 71 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 72 | set_default noscan 0 |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 73 | @@ -160,8 +162,8 @@ mac80211_hostapd_setup_base() { |
| 74 | ieee80211n=1 |
| 75 | ht_capab= |
| 76 | case "$htmode" in |
| 77 | - VHT20|HT20|HE20) ;; |
| 78 | - HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160) |
| 79 | + VHT20|HT20|HE20|EHT20) ;; |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 80 | + HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160|EHT40*|EHT80|EHT160|EHT320*) |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 81 | case "$hwmode" in |
| 82 | a) |
| 83 | case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 84 | @@ -171,8 +173,22 @@ mac80211_hostapd_setup_base() { |
| 85 | ;; |
| 86 | *) |
| 87 | case "$htmode" in |
| 88 | - HT40+) ht_capab="[HT40+]";; |
| 89 | - HT40-) ht_capab="[HT40-]";; |
| 90 | + HT40+|HE40+|EHT40+) |
| 91 | + if [ "$channel" -gt 9 ]; then |
| 92 | + echo "Could not set the center freq with this HT mode setting" |
| 93 | + return 1 |
| 94 | + else |
| 95 | + ht_capab="[HT40+]" |
| 96 | + fi |
| 97 | + ;; |
| 98 | + HT40-|HE40-|EHT40-) |
| 99 | + if [ "$channel" -lt 5 ]; then |
| 100 | + echo "Could not set the center freq with this HT mode setting" |
| 101 | + return 1 |
| 102 | + else |
| 103 | + ht_capab="[HT40-]" |
| 104 | + fi |
| 105 | + ;; |
| 106 | *) |
| 107 | if [ "$channel" -lt 7 ]; then |
| 108 | ht_capab="[HT40+]" |
| 109 | @@ -205,7 +221,7 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 110 | dsss_cck_40:1 |
| 111 | |
| 112 | ht_cap_mask=0 |
| 113 | - for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do |
| 114 | + for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do |
| 115 | ht_cap_mask="$(($ht_cap_mask | $cap))" |
| 116 | done |
| 117 | |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 118 | @@ -236,8 +252,8 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 119 | |
| 120 | idx="$channel" |
| 121 | case "$htmode" in |
| 122 | - VHT20|HE20) enable_ac=1;; |
| 123 | - VHT40|HE40) |
| 124 | + VHT20|HE20|EHT20) enable_ac=1;; |
| 125 | + VHT40|HE40|EHT40) |
| 126 | case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in |
| 127 | 1) idx=$(($channel + 2));; |
| 128 | 0) idx=$(($channel - 2));; |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 129 | @@ -245,7 +261,7 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 130 | enable_ac=1 |
| 131 | vht_center_seg0=$idx |
| 132 | ;; |
| 133 | - VHT80|HE80) |
| 134 | + VHT80|HE80|EHT80) |
| 135 | case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in |
| 136 | 1) idx=$(($channel + 6));; |
| 137 | 2) idx=$(($channel + 2));; |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 138 | @@ -256,7 +272,7 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 139 | vht_oper_chwidth=1 |
| 140 | vht_center_seg0=$idx |
| 141 | ;; |
| 142 | - VHT160|HE160) |
| 143 | + VHT160|HE160|EHT160) |
| 144 | if [ "$band" = "6g" ]; then |
| 145 | case "$channel" in |
| 146 | 1|5|9|13|17|21|25|29) idx=15;; |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 147 | @@ -277,6 +293,36 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 148 | vht_oper_chwidth=2 |
| 149 | vht_center_seg0=$idx |
| 150 | ;; |
| 151 | + EHT320*) |
| 152 | + case "$channel" in |
| 153 | + 1|5|9|13|17|21|25|29) idx=31;; |
| 154 | + 33|37|41|45|49|53|57|61| \ |
| 155 | + 65|69|73|77|81|85|89|93) idx=63;; |
| 156 | + 97|101|105|109|113|117|121|125| \ |
| 157 | + 129|133|137|141|145|149|153|157) idx=127;; |
| 158 | + 161|165|169|173|177|181|185|189| \ |
| 159 | + 193|197|201|205|209|213|217|221) idx=191;; |
| 160 | + esac |
| 161 | + if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] || |
| 162 | + [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then |
| 163 | + echo "Could not set the center freq with this EHT setting" |
| 164 | + return 1 |
| 165 | + elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then |
| 166 | + if [ "$channel" -gt $idx ]; then |
| 167 | + idx=$(($idx + 32)) |
| 168 | + else |
| 169 | + idx=$(($idx - 32)) |
| 170 | + fi |
| 171 | + fi |
| 172 | + vht_oper_chwidth=2 |
| 173 | + if [ "$channel" -gt $idx ]; then |
| 174 | + vht_center_seg0=$(($idx + 16)) |
| 175 | + else |
| 176 | + vht_center_seg0=$(($idx - 16)) |
| 177 | + fi |
| 178 | + eht_oper_chwidth=9 |
| 179 | + eht_oper_centr_freq_seg0_idx=$idx |
| 180 | + ;; |
| 181 | esac |
| 182 | [ "$band" = "5g" ] && { |
| 183 | json_get_vars background_radar:0 |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 184 | @@ -286,8 +332,9 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 185 | [ "$band" = "6g" ] && { |
| 186 | op_class= |
| 187 | case "$htmode" in |
| 188 | - HE20) op_class=131;; |
| 189 | - HE*) op_class=$((132 + $vht_oper_chwidth)) |
| 190 | + HE20|EHT20) op_class=131;; |
| 191 | + EHT320*) op_class=137;; |
| 192 | + HE*|EHT*) op_class=$((132 + $vht_oper_chwidth)) |
| 193 | esac |
| 194 | [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N" |
| 195 | } |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 196 | @@ -315,7 +362,6 @@ mac80211_hostapd_setup_base() { |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 197 | vht_link_adapt:3 \ |
| 198 | vht160:2 |
| 199 | |
| 200 | - set_default tx_burst 2.0 |
| 201 | append base_cfg "ieee80211ac=1" "$N" |
| 202 | vht_cap=0 |
| 203 | for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 204 | @@ -329,6 +375,12 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 205 | [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" |
| 206 | vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" |
| 207 | |
| 208 | + [ "$etxbfen" -eq 0 ] && { |
| 209 | + su_beamformer=0 |
| 210 | + su_beamformee=0 |
| 211 | + mu_beamformer=0 |
| 212 | + } |
| 213 | + |
| 214 | mac80211_add_capabilities vht_capab $vht_cap \ |
| 215 | RXLDPC:0x10::$rxldpc \ |
| 216 | SHORT-GI-80:0x20::$short_gi_80 \ |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 217 | @@ -410,7 +462,7 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 218 | # 802.11ax |
| 219 | enable_ax=0 |
| 220 | case "$htmode" in |
| 221 | - HE*) enable_ax=1 ;; |
| 222 | + HE*|EHT*) enable_ax=1 ;; |
| 223 | esac |
| 224 | |
| 225 | if [ "$enable_ax" != "0" ]; then |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 226 | @@ -419,10 +471,11 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 227 | he_su_beamformee:1 \ |
| 228 | he_mu_beamformer:1 \ |
| 229 | he_twt_required:0 \ |
| 230 | + he_twt_responder \ |
| 231 | he_spr_sr_control:3 \ |
| 232 | he_spr_psr_enabled:0 \ |
| 233 | he_spr_non_srg_obss_pd_max_offset:0 \ |
| 234 | - he_bss_color:128 \ |
| 235 | + he_bss_color \ |
| 236 | he_bss_color_enabled:1 |
| 237 | |
| 238 | he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 239 | @@ -436,6 +489,11 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 240 | append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" |
| 241 | } |
| 242 | |
| 243 | + [ "$etxbfen" -eq 0 ] && { |
| 244 | + he_su_beamformer=0 |
| 245 | + he_mu_beamformer=0 |
| 246 | + } |
| 247 | + |
| 248 | mac80211_add_he_capabilities \ |
| 249 | he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \ |
| 250 | he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \ |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 251 | @@ -443,7 +501,14 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 252 | he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \ |
| 253 | he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required |
| 254 | |
| 255 | + if [ -n "$he_twt_responder" ]; then |
| 256 | + append base_cfg "he_twt_responder=$he_twt_responder" "$N" |
| 257 | + fi |
| 258 | if [ "$he_bss_color_enabled" -gt 0 ]; then |
| 259 | + if [ -z "$he_bss_color" ]; then |
| 260 | + rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2) |
| 261 | + he_bss_color=$((rand % 63 + 1)) |
| 262 | + fi |
| 263 | append base_cfg "he_bss_color=$he_bss_color" "$N" |
| 264 | [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \ |
| 265 | append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N" |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 266 | @@ -484,12 +549,46 @@ mac80211_hostapd_setup_base() { |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 267 | append base_cfg "he_mu_edca_ac_vo_timer=255" "$N" |
| 268 | fi |
| 269 | |
developer | 9851a29 | 2022-12-15 17:33:43 +0800 | [diff] [blame] | 270 | + set_default tx_burst 5.9 |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 271 | + |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 272 | + # 802.11be |
| 273 | + enable_be=0 |
| 274 | + case "$htmode" in |
| 275 | + EHT*) enable_be=1 ;; |
| 276 | + esac |
| 277 | + |
| 278 | + if [ "$enable_be" != "0" ]; then |
| 279 | + append base_cfg "ieee80211be=1" "$N" |
| 280 | + if [ "$etxbfen" -eq 0 ]; then |
| 281 | + append base_cfg "eht_su_beamformee=1" "$N" |
| 282 | + else |
| 283 | + append base_cfg "eht_su_beamformer=1" "$N" |
| 284 | + append base_cfg "eht_su_beamformee=1" "$N" |
| 285 | + append base_cfg "eht_mu_beamformer=1" "$N" |
| 286 | + fi |
| 287 | + [ "$hwmode" = "a" ] && { |
| 288 | + case $htmode in |
| 289 | + EHT320*) |
| 290 | + append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N" |
| 291 | + append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N" |
| 292 | + ;; |
| 293 | + *) |
| 294 | + append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N" |
| 295 | + append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" |
| 296 | + ;; |
| 297 | + esac |
| 298 | + } |
| 299 | + fi |
| 300 | + |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 301 | hostapd_prepare_device_config "$hostapd_conf_file" nl80211 |
| 302 | cat >> "$hostapd_conf_file" <<EOF |
| 303 | ${channel:+channel=$channel} |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 304 | ${channel_list:+chanlist=$channel_list} |
| 305 | ${hostapd_noscan:+noscan=1} |
| 306 | ${tx_burst:+tx_queue_data2_burst=$tx_burst} |
| 307 | +${mbssid:+mbssid=$mbssid} |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 308 | +${mu_onoff:+mu_onoff=$mu_onoff} |
| 309 | +${itxbfen:+ibf_enable=$itxbfen} |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 310 | $base_cfg |
| 311 | |
| 312 | EOF |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 313 | @@ -517,7 +616,7 @@ mac80211_hostapd_setup_bss() { |
developer | 093e1a3 | 2023-02-24 16:10:53 +0800 | [diff] [blame] | 314 | append hostapd_cfg "wds_sta=1" "$N" |
| 315 | [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N" |
| 316 | } |
| 317 | - [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" |
| 318 | + [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" |
| 319 | |
| 320 | cat >> /var/run/hostapd-$phy.conf <<EOF |
| 321 | $hostapd_cfg |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 322 | @@ -527,6 +626,34 @@ ${max_listen_int:+max_listen_interval=$m |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 323 | EOF |
| 324 | } |
| 325 | |
| 326 | +mac80211_generate_mbssid_mac() { |
| 327 | + local phy="$1" |
| 328 | + local transmitted_bssid="$2" |
| 329 | + local id="${macidx:-0}" |
| 330 | + |
| 331 | + local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)" |
| 332 | + local mask="$(cat /sys/class/ieee80211/${phy}/address_mask)" |
| 333 | + |
| 334 | + if [ -z "$transmitted_bssid" ]; then |
| 335 | + transmitted_bssid=$ref |
| 336 | + fi |
| 337 | + |
| 338 | + if [ $id -eq 0 ]; then |
| 339 | + echo "$transmitted_bssid" |
| 340 | + return |
| 341 | + fi |
| 342 | + |
| 343 | + local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS" |
| 344 | + |
| 345 | + # Calculate nontransmitted bssid |
| 346 | + macidx=$(($id + 1)) |
| 347 | + mbssid_idx=$(($macidx - 1)) |
| 348 | + b6="0x$6" |
| 349 | + ref_b6=$(($b6 % $max_mbssid)) |
| 350 | + b6=$(($b6 - $ref_b6 + ($ref_b6 + $mbssid_idx) % $max_mbssid)) |
| 351 | + printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6 |
| 352 | +} |
| 353 | + |
| 354 | mac80211_get_addr() { |
| 355 | local phy="$1" |
| 356 | local idx="$(($2 + 1))" |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 357 | @@ -757,7 +884,13 @@ mac80211_prepare_vif() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 358 | |
| 359 | json_select .. |
| 360 | |
| 361 | - if [ -z "$macaddr" ]; then |
| 362 | + if [ "$mbssid" -gt 0 ]; then |
| 363 | + [ "$macidx" -eq 0 ] && { |
| 364 | + transmitted_bssid=$macaddr |
| 365 | + } |
| 366 | + macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)" |
| 367 | + macidx="$(($macidx + 1))" |
| 368 | + elif [ -z "$macaddr" ]; then |
| 369 | macaddr="$(mac80211_generate_mac $phy)" |
| 370 | macidx="$(($macidx + 1))" |
| 371 | elif [ "$macaddr" = 'random' ]; then |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 372 | @@ -1058,6 +1191,9 @@ mac80211_setup_vif() { |
developer | f0de14b | 2022-12-14 23:07:34 +0800 | [diff] [blame] | 373 | |
| 374 | json_select .. |
| 375 | [ -n "$failed" ] || wireless_add_vif "$name" "$ifname" |
| 376 | + |
| 377 | + echo "Setup SMP Affinity" |
| 378 | + /sbin/smp-mt76.sh |
| 379 | } |
| 380 | |
| 381 | get_freq() { |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 382 | @@ -1122,6 +1258,10 @@ drv_mac80211_cleanup() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 383 | hostapd_common_cleanup |
| 384 | } |
| 385 | |
| 386 | +mac80211_count_ap() { |
| 387 | + total_num_ap=$(($total_num_ap + 1)) |
| 388 | +} |
| 389 | + |
| 390 | drv_mac80211_setup() { |
| 391 | json_select config |
| 392 | json_get_vars \ |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 393 | @@ -1219,6 +1359,16 @@ drv_mac80211_setup() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 394 | for_each_interface "sta adhoc mesh" mac80211_set_noscan |
| 395 | [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy" |
| 396 | |
| 397 | + total_num_ap=0 |
| 398 | + max_mbssid=1 |
| 399 | + for_each_interface "ap" mac80211_count_ap |
| 400 | + total_num_ap=$(($total_num_ap - 1)) |
| 401 | + while [ $total_num_ap -gt 0 ] |
| 402 | + do |
| 403 | + total_num_ap=$(($total_num_ap >> 1)) |
| 404 | + max_mbssid=$(($max_mbssid << 1)) |
| 405 | + done |
| 406 | + |
| 407 | mac80211_prepare_iw_htmode |
| 408 | for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif |
| 409 | NEWAPLIST= |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 410 | diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 411 | index e24a2a63..80cd298c 100644 |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 412 | --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
| 413 | +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 414 | @@ -60,6 +60,8 @@ BEGIN { |
| 415 | if (vht && band != "1:") mode="VHT80" |
| 416 | if (he) mode="HE80" |
| 417 | if (he && band == "1:") mode="HE20" |
| 418 | + if (eht) mode="EHT80" |
| 419 | + if (eht && band == "1:") mode="EHT20" |
| 420 | sub("\\[", "", channel) |
| 421 | sub("\\]", "", channel) |
| 422 | bands = bands band channel ":" mode " " |
| 423 | @@ -73,6 +75,7 @@ $1 == "Band" { |
| 424 | vht = "" |
| 425 | ht = "" |
| 426 | he = "" |
| 427 | + eht = "" |
| 428 | } |
| 429 | |
| 430 | $0 ~ "Capabilities:" { |
| 431 | @@ -87,6 +90,10 @@ $0 ~ "HE Iftypes" { |
| 432 | he=1 |
| 433 | } |
| 434 | |
| 435 | +$0 ~ "EHT Iftypes" { |
| 436 | + eht=1 |
| 437 | +} |
| 438 | + |
| 439 | $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel { |
| 440 | channel = $4 |
| 441 | } |
| 442 | @@ -120,6 +127,13 @@ get_band_defaults() { |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 443 | mode_band="$band" |
| 444 | channel="$chan" |
| 445 | htmode="$mode" |
| 446 | + if [ "$band" = "6g" ] |
| 447 | + then |
| 448 | + encryption=sae |
| 449 | + key=12345678 |
| 450 | + else |
| 451 | + encryption=none |
| 452 | + fi |
| 453 | done |
| 454 | } |
| 455 | |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 456 | @@ -153,6 +167,10 @@ detect_mac80211() { |
| 457 | |
| 458 | json_load_file /etc/board.json |
| 459 | |
| 460 | + # generate random bytes for macaddr |
| 461 | + rand=$(hexdump -C /dev/urandom | head -n 1 &) |
| 462 | + killall hexdump |
| 463 | + |
| 464 | for _dev in /sys/class/ieee80211/*; do |
| 465 | [ -e "$_dev" ] || continue |
| 466 | |
| 467 | @@ -162,6 +180,8 @@ detect_mac80211() { |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 468 | channel="" |
| 469 | htmode="" |
| 470 | ht_capab="" |
| 471 | + encryption="" |
| 472 | + key="" |
| 473 | |
| 474 | get_band_defaults "$dev" |
| 475 | |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 476 | @@ -196,6 +216,11 @@ detect_mac80211() { |
| 477 | ;; |
| 478 | esac |
| 479 | |
| 480 | + macaddr="" |
| 481 | + for i in $(seq 2 3); do |
| 482 | + macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i) |
| 483 | + done |
| 484 | + |
| 485 | uci -q batch <<-EOF |
| 486 | set wireless.${name}=wifi-device |
| 487 | set wireless.${name}.type=mac80211 |
| 488 | @@ -210,8 +235,14 @@ detect_mac80211() { |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 489 | set wireless.default_${name}.network=lan |
| 490 | set wireless.default_${name}.mode=ap |
| 491 | set wireless.default_${name}.ssid=OpenWrt |
| 492 | - set wireless.default_${name}.encryption=none |
| 493 | + set wireless.default_${name}.encryption=${encryption} |
| 494 | + |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 495 | + set wireless.default_${name}.macaddr=00:0$(($devidx - 1)):55:66${macaddr} |
| 496 | + |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 497 | EOF |
| 498 | + [ -n "$key" ] && { |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 499 | + uci -q set wireless.default_${name}.key=${key} |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 500 | + } |
| 501 | uci -q commit wireless |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 502 | done |
| 503 | } |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 504 | diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 505 | index 28bd2106..5e21d0d6 100644 |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 506 | --- a/package/network/services/hostapd/files/hostapd.sh |
| 507 | +++ b/package/network/services/hostapd/files/hostapd.sh |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 508 | @@ -376,6 +376,13 @@ hostapd_common_add_bss_config() { |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 509 | config_add_string fils_dhcp |
| 510 | |
| 511 | config_add_int ocv |
| 512 | + |
| 513 | + config_add_int disable_eht |
| 514 | + config_add_int disable_he |
| 515 | + config_add_int disable_vht |
| 516 | + config_add_int disable_ht |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 517 | + |
| 518 | + config_add_boolean beacon_prot |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 519 | } |
| 520 | |
| 521 | hostapd_set_vlan_file() { |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 522 | @@ -975,7 +982,7 @@ hostapd_set_bss_options() { |
| 523 | # RSN -> allow management frame protection |
| 524 | case "$ieee80211w" in |
| 525 | [012]) |
| 526 | - json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout |
| 527 | + json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot |
| 528 | append bss_conf "ieee80211w=$ieee80211w" "$N" |
| 529 | [ "$ieee80211w" -gt "0" ] && { |
| 530 | if [ "$auth_type" = "eap192" ]; then |
| 531 | @@ -983,6 +990,8 @@ hostapd_set_bss_options() { |
| 532 | else |
| 533 | append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" |
| 534 | fi |
| 535 | + [ -n "$beacon_prot" ] && \ |
| 536 | + append bss_conf "beacon_prot=$beacon_prot" "$N" |
| 537 | [ -n "$ieee80211w_max_timeout" ] && \ |
| 538 | append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" |
| 539 | [ -n "$ieee80211w_retry_timeout" ] && \ |
| 540 | @@ -1559,6 +1568,20 @@ wpa_supplicant_add_network() { |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 541 | [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T" |
| 542 | [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T" |
| 543 | |
| 544 | + local disable_eht |
| 545 | + local disable_he |
| 546 | + local disable_vht |
| 547 | + local disable_ht |
| 548 | + json_get_vars disable_eht |
| 549 | + json_get_vars disable_he |
| 550 | + json_get_vars disable_vht |
| 551 | + json_get_vars disable_ht |
| 552 | + |
| 553 | + [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T" |
| 554 | + [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T" |
| 555 | + [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T" |
| 556 | + [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T" |
| 557 | + |
| 558 | [ -n "$basic_rate" ] && { |
| 559 | local br rate_list= |
| 560 | for br in $basic_rate; do |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 561 | @@ -1573,6 +1596,11 @@ wpa_supplicant_add_network() { |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 562 | append network_data "mcast_rate=$mc_rate" "$N$T" |
| 563 | } |
| 564 | |
| 565 | + if [ "$auth_type" = "sae" ]; then |
| 566 | + json_get_vars sae_pwe sae_pwe |
| 567 | + [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config" |
| 568 | + fi |
| 569 | + |
| 570 | if [ "$key_mgmt" = "WPS" ]; then |
| 571 | echo "wps_cred_processing=1" >> "$_config" |
| 572 | else |