[rdkb][common][app][Refactor hostapd-init.sh]
[Description]
Refactor hostapd-init.sh
1. support tri-band
[Release-log]
diff --git a/recipes-connectivity/hostapd/files/hostapd-6G.conf b/recipes-connectivity/hostapd/files/hostapd-6G.conf
index 874ef7e..cb0576b 100644
--- a/recipes-connectivity/hostapd/files/hostapd-6G.conf
+++ b/recipes-connectivity/hostapd/files/hostapd-6G.conf
@@ -7,11 +7,10 @@
beacon_int=100
dtim_period=2
-country_code=DE
+country_code=US
ieee80211d=1
ieee80211h=1
channel=37
-chanlist=37
tx_queue_data2_burst=2.0
ieee80211n=1
diff --git a/recipes-connectivity/hostapd/files/hostapd-init.sh b/recipes-connectivity/hostapd/files/hostapd-init.sh
index f65152b..c49bb5f 100644
--- a/recipes-connectivity/hostapd/files/hostapd-init.sh
+++ b/recipes-connectivity/hostapd/files/hostapd-init.sh
@@ -2,32 +2,35 @@
create_hostapdConf() {
devidx=0
-
+ phyidx=0
for _dev in /sys/class/ieee80211/*; do
[ -e "$_dev" ] || continue
dev="${_dev##*/}"
- band="$(uci get wireless.radio${devidx}.band)"
- channel="$(uci get wireless.radio${devidx}.channel)"
- MAC="$(cat /sys/class/net/wlan${devidx}/address)"
+ band="$(uci get wireless.radio${phyidx}.band)"
+ channel="$(uci get wireless.radio${phyidx}.channel)"
+ MAC="$(cat /sys/class/net/wlan${phyidx}/address)"
NEW_MAC=$(echo 0x$MAC| awk -F: '{printf "%02x:%s:%s:%s:%s:%s", strtonum($1)+2, $2, $3, $4 ,$5, $6}')
chip="$(cat /sys/class/ieee80211/"$dev"/device/device)"
- if [ "$(uci get wireless.radio${devidx}.disabled)" == "1" ]; then
- devidx=$(($devidx + 1))
+ if [ "$(uci get wireless.radio${phyidx}.disabled)" == "1" ]; then
+ phyidx=$(($phyidx + 1))
continue
fi
if [ ! -f /nvram/hostapd"$devidx".conf ]; then
touch /nvram/hostapd"$devidx".conf
else
- iw dev wlan$devidx interface add wifi$devidx type __ap
+ iw dev wlan$phyidx interface add wifi$devidx type __ap
touch /tmp/hostapd-acl$devidx
touch /tmp/hostapd$devidx.psk
+ touch /tmp/hostapd-deny$devidx
+ touch /tmp/$dev-wifi$devidx
hostapd_cli -i global raw ADD bss_config=$dev:/nvram/hostapd"$devidx".conf
devidx=$(($devidx + 1))
+ phyidx=$(($phyidx + 1))
continue
fi
@@ -54,11 +57,14 @@
sed -i "/^interface=.*/c\interface=wifi$devidx" /nvram/hostapd"$devidx".conf
sed -i "/^bssid=/c\bssid=$NEW_MAC" /nvram/hostapd"$devidx".conf
echo "wpa_psk_file=/tmp/hostapd$devidx.psk" >> /nvram/hostapd"$devidx".conf
- iw dev wlan$devidx interface add wifi$devidx type __ap
+ iw dev wlan$phyidx interface add wifi$devidx type __ap
touch /tmp/hostapd-acl$devidx
touch /tmp/hostapd$devidx.psk
+ touch /tmp/hostapd-deny$devidx
+ touch /tmp/$dev-wifi$devidx
hostapd_cli -i global raw ADD bss_config=$dev:/nvram/hostapd"$devidx".conf
- devidx=$(($devidx + 1))
+ devidx=$(($devidx + 1))
+ phyidx=$(($phyidx + 1))
done
}