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 | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 2 | index b7059fe6..62c13eb2 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 | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 34 | index 5aaba9af..6d051038 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 |
| 41 | + config_add_int mbssid |
| 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 |
| 45 | @@ -140,13 +141,10 @@ mac80211_hostapd_setup_base() { |
| 46 | [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && |
| 47 | append base_cfg "acs_exclude_dfs=1" "$N" |
| 48 | |
| 49 | - json_get_vars noscan ht_coex min_tx_power:0 tx_burst |
| 50 | + json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 51 | json_get_values ht_capab_list ht_capab |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 52 | json_get_values channel_list channels |
| 53 | |
| 54 | - [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ |
| 55 | - channel_list="$channel" |
| 56 | - |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 57 | [ "$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] | 58 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 59 | set_default noscan 0 |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 60 | @@ -315,7 +313,6 @@ mac80211_hostapd_setup_base() { |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 61 | vht_link_adapt:3 \ |
| 62 | vht160:2 |
| 63 | |
| 64 | - set_default tx_burst 2.0 |
| 65 | append base_cfg "ieee80211ac=1" "$N" |
| 66 | vht_cap=0 |
| 67 | for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 68 | @@ -484,12 +481,15 @@ mac80211_hostapd_setup_base() { |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 69 | append base_cfg "he_mu_edca_ac_vo_timer=255" "$N" |
| 70 | fi |
| 71 | |
developer | 9851a29 | 2022-12-15 17:33:43 +0800 | [diff] [blame] | 72 | + set_default tx_burst 5.9 |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 73 | + |
| 74 | hostapd_prepare_device_config "$hostapd_conf_file" nl80211 |
| 75 | cat >> "$hostapd_conf_file" <<EOF |
| 76 | ${channel:+channel=$channel} |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 77 | ${channel_list:+chanlist=$channel_list} |
| 78 | ${hostapd_noscan:+noscan=1} |
| 79 | ${tx_burst:+tx_queue_data2_burst=$tx_burst} |
| 80 | +${mbssid:+mbssid=$mbssid} |
| 81 | $base_cfg |
| 82 | |
| 83 | EOF |
| 84 | @@ -517,7 +517,7 @@ mac80211_hostapd_setup_bss() { |
developer | 093e1a3 | 2023-02-24 16:10:53 +0800 | [diff] [blame] | 85 | append hostapd_cfg "wds_sta=1" "$N" |
| 86 | [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N" |
| 87 | } |
| 88 | - [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" |
| 89 | + [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" |
| 90 | |
| 91 | cat >> /var/run/hostapd-$phy.conf <<EOF |
| 92 | $hostapd_cfg |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 93 | @@ -527,6 +527,34 @@ ${max_listen_int:+max_listen_interval=$max_listen_int} |
| 94 | EOF |
| 95 | } |
| 96 | |
| 97 | +mac80211_generate_mbssid_mac() { |
| 98 | + local phy="$1" |
| 99 | + local transmitted_bssid="$2" |
| 100 | + local id="${macidx:-0}" |
| 101 | + |
| 102 | + local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)" |
| 103 | + local mask="$(cat /sys/class/ieee80211/${phy}/address_mask)" |
| 104 | + |
| 105 | + if [ -z "$transmitted_bssid" ]; then |
| 106 | + transmitted_bssid=$ref |
| 107 | + fi |
| 108 | + |
| 109 | + if [ $id -eq 0 ]; then |
| 110 | + echo "$transmitted_bssid" |
| 111 | + return |
| 112 | + fi |
| 113 | + |
| 114 | + local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS" |
| 115 | + |
| 116 | + # Calculate nontransmitted bssid |
| 117 | + macidx=$(($id + 1)) |
| 118 | + mbssid_idx=$(($macidx - 1)) |
| 119 | + b6="0x$6" |
| 120 | + ref_b6=$(($b6 % $max_mbssid)) |
| 121 | + b6=$(($b6 - $ref_b6 + ($ref_b6 + $mbssid_idx) % $max_mbssid)) |
| 122 | + printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6 |
| 123 | +} |
| 124 | + |
| 125 | mac80211_get_addr() { |
| 126 | local phy="$1" |
| 127 | local idx="$(($2 + 1))" |
| 128 | @@ -757,7 +785,13 @@ mac80211_prepare_vif() { |
| 129 | |
| 130 | json_select .. |
| 131 | |
| 132 | - if [ -z "$macaddr" ]; then |
| 133 | + if [ "$mbssid" -gt 0 ]; then |
| 134 | + [ "$macidx" -eq 0 ] && { |
| 135 | + transmitted_bssid=$macaddr |
| 136 | + } |
| 137 | + macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)" |
| 138 | + macidx="$(($macidx + 1))" |
| 139 | + elif [ -z "$macaddr" ]; then |
| 140 | macaddr="$(mac80211_generate_mac $phy)" |
| 141 | macidx="$(($macidx + 1))" |
| 142 | elif [ "$macaddr" = 'random' ]; then |
| 143 | @@ -1058,6 +1092,9 @@ mac80211_setup_vif() { |
developer | f0de14b | 2022-12-14 23:07:34 +0800 | [diff] [blame] | 144 | |
| 145 | json_select .. |
| 146 | [ -n "$failed" ] || wireless_add_vif "$name" "$ifname" |
| 147 | + |
| 148 | + echo "Setup SMP Affinity" |
| 149 | + /sbin/smp-mt76.sh |
| 150 | } |
| 151 | |
| 152 | get_freq() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 153 | @@ -1122,6 +1159,10 @@ drv_mac80211_cleanup() { |
| 154 | hostapd_common_cleanup |
| 155 | } |
| 156 | |
| 157 | +mac80211_count_ap() { |
| 158 | + total_num_ap=$(($total_num_ap + 1)) |
| 159 | +} |
| 160 | + |
| 161 | drv_mac80211_setup() { |
| 162 | json_select config |
| 163 | json_get_vars \ |
| 164 | @@ -1219,6 +1260,16 @@ drv_mac80211_setup() { |
| 165 | for_each_interface "sta adhoc mesh" mac80211_set_noscan |
| 166 | [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy" |
| 167 | |
| 168 | + total_num_ap=0 |
| 169 | + max_mbssid=1 |
| 170 | + for_each_interface "ap" mac80211_count_ap |
| 171 | + total_num_ap=$(($total_num_ap - 1)) |
| 172 | + while [ $total_num_ap -gt 0 ] |
| 173 | + do |
| 174 | + total_num_ap=$(($total_num_ap >> 1)) |
| 175 | + max_mbssid=$(($max_mbssid << 1)) |
| 176 | + done |
| 177 | + |
| 178 | mac80211_prepare_iw_htmode |
| 179 | for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif |
| 180 | NEWAPLIST= |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 181 | diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 182 | index e24a2a63..10a3f8b4 100644 |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 183 | --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
| 184 | +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 185 | @@ -120,6 +120,13 @@ get_band_defaults() { |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 186 | mode_band="$band" |
| 187 | channel="$chan" |
| 188 | htmode="$mode" |
| 189 | + if [ "$band" = "6g" ] |
| 190 | + then |
| 191 | + encryption=sae |
| 192 | + key=12345678 |
| 193 | + else |
| 194 | + encryption=none |
| 195 | + fi |
| 196 | done |
| 197 | } |
| 198 | |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 199 | @@ -162,6 +169,8 @@ detect_mac80211() { |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 200 | channel="" |
| 201 | htmode="" |
| 202 | ht_capab="" |
| 203 | + encryption="" |
| 204 | + key="" |
| 205 | |
| 206 | get_band_defaults "$dev" |
| 207 | |
developer | 093e1a3 | 2023-02-24 16:10:53 +0800 | [diff] [blame] | 208 | @@ -210,8 +219,12 @@ detect_mac80211() { |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 209 | set wireless.default_${name}.network=lan |
| 210 | set wireless.default_${name}.mode=ap |
| 211 | set wireless.default_${name}.ssid=OpenWrt |
| 212 | - set wireless.default_${name}.encryption=none |
| 213 | + set wireless.default_${name}.encryption=${encryption} |
| 214 | + |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 215 | EOF |
| 216 | + [ -n "$key" ] && { |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 217 | + uci -q set wireless.default_${name}.key=${key} |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 218 | + } |
| 219 | uci -q commit wireless |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 220 | done |
| 221 | } |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 222 | 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] | 223 | index 28bd2106..5e21d0d6 100644 |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 224 | --- a/package/network/services/hostapd/files/hostapd.sh |
| 225 | +++ b/package/network/services/hostapd/files/hostapd.sh |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 226 | @@ -376,6 +376,13 @@ hostapd_common_add_bss_config() { |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 227 | config_add_string fils_dhcp |
| 228 | |
| 229 | config_add_int ocv |
| 230 | + |
| 231 | + config_add_int disable_eht |
| 232 | + config_add_int disable_he |
| 233 | + config_add_int disable_vht |
| 234 | + config_add_int disable_ht |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 235 | + |
| 236 | + config_add_boolean beacon_prot |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | hostapd_set_vlan_file() { |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 240 | @@ -975,7 +982,7 @@ hostapd_set_bss_options() { |
| 241 | # RSN -> allow management frame protection |
| 242 | case "$ieee80211w" in |
| 243 | [012]) |
| 244 | - json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout |
| 245 | + json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot |
| 246 | append bss_conf "ieee80211w=$ieee80211w" "$N" |
| 247 | [ "$ieee80211w" -gt "0" ] && { |
| 248 | if [ "$auth_type" = "eap192" ]; then |
| 249 | @@ -983,6 +990,8 @@ hostapd_set_bss_options() { |
| 250 | else |
| 251 | append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" |
| 252 | fi |
| 253 | + [ -n "$beacon_prot" ] && \ |
| 254 | + append bss_conf "beacon_prot=$beacon_prot" "$N" |
| 255 | [ -n "$ieee80211w_max_timeout" ] && \ |
| 256 | append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" |
| 257 | [ -n "$ieee80211w_retry_timeout" ] && \ |
| 258 | @@ -1559,6 +1568,20 @@ wpa_supplicant_add_network() { |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 259 | [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T" |
| 260 | [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T" |
| 261 | |
| 262 | + local disable_eht |
| 263 | + local disable_he |
| 264 | + local disable_vht |
| 265 | + local disable_ht |
| 266 | + json_get_vars disable_eht |
| 267 | + json_get_vars disable_he |
| 268 | + json_get_vars disable_vht |
| 269 | + json_get_vars disable_ht |
| 270 | + |
| 271 | + [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T" |
| 272 | + [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T" |
| 273 | + [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T" |
| 274 | + [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T" |
| 275 | + |
| 276 | [ -n "$basic_rate" ] && { |
| 277 | local br rate_list= |
| 278 | for br in $basic_rate; do |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 279 | @@ -1573,6 +1596,11 @@ wpa_supplicant_add_network() { |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 280 | append network_data "mcast_rate=$mc_rate" "$N$T" |
| 281 | } |
| 282 | |
| 283 | + if [ "$auth_type" = "sae" ]; then |
| 284 | + json_get_vars sae_pwe sae_pwe |
| 285 | + [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config" |
| 286 | + fi |
| 287 | + |
| 288 | if [ "$key_mgmt" = "WPS" ]; then |
| 289 | echo "wps_cred_processing=1" >> "$_config" |
| 290 | else |