mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 19:52:06 +00:00
43 lines
1.7 KiB
Text
43 lines
1.7 KiB
Text
if [ "$interface" = "br0" ] && [ $if_up = "true" ]; then
|
|
syslog info "50-iiab IF_UP br0 restarting dnsmasq"
|
|
sleep 2
|
|
systemctl --no-block restart dnsmasq
|
|
fi
|
|
|
|
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`
|
|
FREQ2=""
|
|
for result in $FREQ; do
|
|
echo "frequency is $result for carrier"
|
|
if [ $result -lt 13 ]; then
|
|
FREQ2=$result
|
|
else
|
|
syslog info "50-iiab channel $FREQ2 is 5Ghz NOT CHANGING HOSTAPD"
|
|
fi
|
|
done
|
|
echo "Using $FREQ2 for carrier"
|
|
syslog info "50-iiab set channel $FREQ2"
|
|
HOSTAPD=`grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}'`
|
|
echo "Hostapd set for $HOSTAPD"
|
|
if [ $FREQ2 -ne $HOSTAPD ] && [ ! -z $FREQ2 ]; then
|
|
echo "Editing Hostapd for channel $FREQ2"
|
|
cp /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
|
|
sed -i -e "s/^channel.*/channel=$FREQ /" /etc/hostapd/hostapd.conf
|
|
echo "THIS MACHINE SHOULD BE REBOOTED"
|
|
syslog info "THIS MACHINE SHOULD BE REBOOTED"
|
|
# systemctl restart hostapd
|
|
fi
|
|
fi
|
|
# spams the logging
|
|
#syslog info "50-iiab set ap0 spam $REASON"
|
|
if [ -e /sys/class/net/ap0 ] && ([ "$reason" = "CARRIER" ] || [ "$reason" = "NOCARRIER" ] || [ "$reason" = "BOUND" ]); then
|
|
syslog info "50-iiab set ap0 up $REASON"
|
|
# keeps ap0 up so hostapd works
|
|
ip link set ap0 up
|
|
fi
|
|
fi
|