1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/network/templates/hostapd/50-hostapd
2020-05-01 10:27:45 -05:00

20 lines
821 B
Text

if [ "$interface" = "wlan0" ]; then
REASON="$reason"
if [ "$reason" = "CARRIER" ]; then
syslog info "50-iiab CARRIER change wlan0"
# wpa_supplicant wants MHz for frequency= while hostapd wants channel..... whatever
# FREQ=`iw wlan0 info|grep channel|cut -d' ' -f9`
FREQ=`iw wlan0 info|grep channel|cut -d' ' -f2`
syslog info "40-iiab set channel $FREQ"
sed -i -e "s/^channel.*/channel=$FREQ /" /etc/hostapd/hostapd.conf
# will need a reboot for hostapd if the channel changed
fi
# spams the logging
#syslog info "50-iiab set ap0 spam $REASON"
if [ -e /sys/class/net/ap0 ] && ! [ "$reason" = "ROUTERADVERT" ]; then
syslog info "50-iiab set ap0 up $REASON"
# keeps ap0 up so hostapd works
ip link set ap0 up
fi
fi