|
| 1 | +SOURCE:RDKM |
| 2 | +--- ./hostapd-init-EHT.sh 2025-10-22 11:15:20.021034563 +0100 |
| 3 | ++++ ./hostapd-init-EHT.sh 2025-10-22 13:30:43.085766313 +0100 |
| 4 | +@@ -157,7 +157,11 @@ |
| 5 | + iw wlan$phyidx del > /dev/null |
| 6 | + elif [ -e /sys/class/net/wifi$phyidx ]; then |
| 7 | + for((i=0;i<$vap_per_radio;i++)); do |
| 8 | +- ifidx=$(($phyidx+$i*$radio_num)) |
| 9 | ++ if [ $phyidx -lt 2 ]; then |
| 10 | ++ ifidx=$(($phyidx+($i*2))) |
| 11 | ++ elif [ $phyidx -eq 2 ]; then |
| 12 | ++ ifidx=$(($i+16)) |
| 13 | ++ fi |
| 14 | + ifname="$(cat /nvram/hostapd"$ifidx".conf | grep ^interface= | cut -d '=' -f2 | tr -d '\n')" |
| 15 | + if [ -n $ifname ]; then |
| 16 | + hostapd_cli -i global raw REMOVE wifi$ifidx > /dev/null |
| 17 | +@@ -173,14 +177,24 @@ |
| 18 | + continue |
| 19 | + fi |
| 20 | + |
| 21 | +- if [ ! -f /nvram/hostapd"$devidx".conf ]; then |
| 22 | +- touch /nvram/hostapd"$devidx".conf |
| 23 | ++ if [ $devidx -eq 2 ]; then |
| 24 | ++ real_idx=16 |
| 25 | ++ else |
| 26 | ++ real_idx=$devidx |
| 27 | ++ fi |
| 28 | ++ |
| 29 | ++ if [ ! -f /nvram/hostapd"$real_idx".conf ]; then |
| 30 | ++ touch /nvram/hostapd"$real_idx".conf |
| 31 | + else |
| 32 | + for((i=0;i<$vap_per_radio;i++)); do |
| 33 | +- ifidx=$(($phyidx+$i*$radio_num)) |
| 34 | ++ if [ $phyidx -lt 2 ]; then |
| 35 | ++ ifidx=$(($phyidx+($i*2))) |
| 36 | ++ elif [ $phyidx -eq 2 ]; then |
| 37 | ++ ifidx=$(($i+16)) |
| 38 | ++ fi |
| 39 | + ifname="$(cat /nvram/hostapd"$ifidx".conf | grep ^interface= | cut -d '=' -f2 | tr -d '\n')" |
| 40 | +- vapstat="$(cat /nvram/vap-status | grep wifi"$ifidx"= | cut -d'=' -f2)" |
| 41 | +- if [ -n $ifname ] && [[ $vapstat -eq "1" ]]; then |
| 42 | ++ vapstat="$(cat /nvram/vap-status | grep wifi"$ifidx"= | cut -d'=' -f2 | head -n 1)" |
| 43 | ++ if [ -n "$ifname" ] && [ "$vapstat" == "1" ]; then |
| 44 | + if [ $i = 0 ]; then |
| 45 | + ## first interface in this phy |
| 46 | + iw phy phy0 interface add $ifname type __ap radios $radio_idx > /dev/null |
| 47 | +@@ -188,9 +202,7 @@ |
| 48 | + touch /nvram/hostapd-acl$ifidx |
| 49 | + touch /nvram/hostapd$ifidx.psk |
| 50 | + touch /nvram/hostapd-deny$ifidx |
| 51 | +- if [ $phyidx = $ifidx ]; then |
| 52 | +- touch /tmp/phy0-wifi$ifidx |
| 53 | +- fi |
| 54 | ++ touch /tmp/phy0-wifi$ifidx |
| 55 | + hostapd_cli -i global raw ADD bss_config=phy0.$radio_idx:/nvram/hostapd"$ifidx".conf |
| 56 | + fi |
| 57 | + done |
| 58 | +@@ -213,28 +213,28 @@ |
| 59 | + |
| 60 | + |
| 61 | + if [ "$band" == "2g" ]; then |
| 62 | +- cp -f /etc/hostapd-2G.conf /nvram/hostapd"$devidx".conf |
| 63 | ++ cp -f /etc/hostapd-2G.conf /nvram/hostapd"$real_idx".conf |
| 64 | + fi |
| 65 | + |
| 66 | + if [ "$band" == "5g" ]; then |
| 67 | + gen_vht_cap |
| 68 | +- cp -f /etc/hostapd-5G.conf /nvram/hostapd"$devidx".conf |
| 69 | ++ cp -f /etc/hostapd-5G.conf /nvram/hostapd"$real_idx".conf |
| 70 | + fi |
| 71 | + |
| 72 | + if [ "$band" == "6g" ]; then |
| 73 | + gen_he_6ghz_reg_pwr_type /etc/hostapd-6G.conf |
| 74 | +- cp -f /etc/hostapd-6G.conf /nvram/hostapd"$devidx".conf |
| 75 | ++ cp -f /etc/hostapd-6G.conf /nvram/hostapd"$real_idx".conf |
| 76 | + fi |
| 77 | + |
| 78 | +- sed -i "/^interface=.*/c\interface=wifi$devidx" /nvram/hostapd"$devidx".conf |
| 79 | +- sed -i "/^bssid=/c\bssid=$MAC" /nvram/hostapd"$devidx".conf |
| 80 | +- echo "wpa_psk_file=/nvram/hostapd$devidx.psk" >> /nvram/hostapd"$devidx".conf |
| 81 | +- iw phy phy0 interface add wifi$devidx type __ap radios $radio_idx > /dev/null |
| 82 | +- touch /nvram/hostapd-acl$devidx |
| 83 | +- touch /nvram/hostapd$devidx.psk |
| 84 | +- touch /nvram/hostapd-deny$devidx |
| 85 | +- touch /tmp/phy0-wifi$devidx |
| 86 | +- hostapd_cli -i global raw ADD bss_config=phy0.$radio_idx:/nvram/hostapd"$devidx".conf && echo -e "wifi"$devidx"=1" >> /nvram/vap-status |
| 87 | ++ sed -i "/^interface=.*/c\interface=wifi$real_idx" /nvram/hostapd"$real_idx".conf |
| 88 | ++ sed -i "/^bssid=/c\bssid=$MAC" /nvram/hostapd"$real_idx".conf |
| 89 | ++ echo "wpa_psk_file=/nvram/hostapd$real_idx.psk" >> /nvram/hostapd"$real_idx".conf |
| 90 | ++ iw phy phy0 interface add wifi$real_idx type __ap radios $radio_idx > /dev/null |
| 91 | ++ touch /nvram/hostapd-acl$real_idx |
| 92 | ++ touch /nvram/hostapd$real_idx.psk |
| 93 | ++ touch /nvram/hostapd-deny$real_idx |
| 94 | ++ touch /tmp/phy0-wifi$real_idx |
| 95 | ++ hostapd_cli -i global raw ADD bss_config=phy0.$radio_idx:/nvram/hostapd"$real_idx".conf && echo -e "wifi"$real_idx"=1" >> /nvram/vap-status |
| 96 | + devidx=$(($devidx + 1)) |
| 97 | + phyidx=$(($phyidx + 1)) |
| 98 | + |
0 commit comments