/etc/init.d/S33hostapd: initialize all available ap interfaces

This commit is contained in:
Calin Crisan 2020-05-29 23:41:12 +03:00
parent c1184428d8
commit e95375e5ce
5 changed files with 12 additions and 19 deletions

View File

@ -37,20 +37,17 @@ watch() {
done
}
prepare_ap_iface() {
# Only prepare AP interfaces of format "apX"
if ! [[ "${OS_AP}" =~ ap([[:digit:]]) ]]; then
return
fi
wlan_iface=wlan${BASH_REMATCH[1]}
if ! iw dev ${wlan_iface} info &>/dev/null; then
return # No wlan interface
fi
msg_begin "Preparing AP interface"
iw dev ${wlan_iface} interface add ${OS_AP} type __ap &>/dev/null
test $? == 0 && msg_done || msg_fail
prepare_ap_ifaces() {
wifi_ifaces=$(ip link | grep -oE 'wlan[[:digit:]]')
msg_begin "Preparing AP interfaces"
ap_ifaces=""
for iface in ${wifi_ifaces}; do
ap_iface=ap${iface: -1}
if iw dev ${iface} interface add ${ap_iface} type __ap &>/dev/null; then
ap_ifaces+="${ap_iface} "
fi
done
msg_done "${ap_ifaces:-none}"
}
start_hostapd() {
@ -88,7 +85,7 @@ stop_hostapd() {
}
start() {
prepare_ap_iface
prepare_ap_ifaces
if [[ -s ${CONF} ]]; then
start_hostapd

View File

@ -1 +0,0 @@
OS_AP="ap0"

View File

@ -1 +0,0 @@
OS_AP="ap0"

View File

@ -1 +0,0 @@
OS_AP="ap0"

View File

@ -1 +0,0 @@
OS_AP="ap0"