mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
use iw in place of wpa_cli
This commit is contained in:
parent
8190f4b7a9
commit
1b58d712cf
2 changed files with 7 additions and 14 deletions
|
@ -13,7 +13,7 @@ if [ "$interface" = "wlan0" ]; then
|
||||||
FREQ2=$result
|
FREQ2=$result
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "Using $FREQ2 for $SSID"
|
echo "Using $FREQ2 for carrier"
|
||||||
syslog info "50-iiab set channel $FREQ2"
|
syslog info "50-iiab set channel $FREQ2"
|
||||||
HOSTAPD=`grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}'`
|
HOSTAPD=`grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}'`
|
||||||
echo "Hostapd set for $HOSTAPD"
|
echo "Hostapd set for $HOSTAPD"
|
||||||
|
|
|
@ -1,28 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ "$IFACE" == "{{ discovered_wireless_iface }}" ]; then
|
if [ "$IFACE" == "{{ discovered_wireless_iface }}" ]; then
|
||||||
echo "NET-DISP-WiFi $IFACE $STATE"
|
echo "NET-DISP-WiFi $IFACE $STATE"
|
||||||
FREQ=`wpa_cli -i $IFACE scan_results | grep : | awk '{print $2}'`
|
# If we are here we have a dhcp ip address
|
||||||
for result in $FREQ; do
|
CHAN=`iw $IFACE info|grep channel|cut -d' ' -f2`
|
||||||
echo "frequency is $result for carrier"
|
|
||||||
if [ $result -lt 2485 ] && [ ! -z $result ]; then
|
|
||||||
FREQ2=$result
|
|
||||||
else
|
|
||||||
FREQ2="NA"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "Using $FREQ2 for carrier"
|
|
||||||
CHAN=$(($FREQ2 - 2407 ))
|
|
||||||
CHAN=$(($CHAN / 5 ))
|
|
||||||
echo "Using channel $CHAN for carrier"
|
echo "Using channel $CHAN for carrier"
|
||||||
HOSTAPD=`grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}'`
|
HOSTAPD=`grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}'`
|
||||||
echo "Hostapd set for $HOSTAPD"
|
echo "Hostapd set for $HOSTAPD"
|
||||||
if [ $CHAN -ne $HOSTAPD ] && [[ ! $FREQ2 == "NA" ]]; then
|
if [ $CHAN -ne $HOSTAPD ] && [ $CHAN -lt 14 ]; then
|
||||||
echo "Editing Hostapd for channel $CHAN"
|
echo "Editing Hostapd for channel $CHAN"
|
||||||
cp /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
|
cp /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
|
||||||
sed -i -e "s/^channel.*/channel=$CHAN/" /etc/hostapd/hostapd.conf
|
sed -i -e "s/^channel.*/channel=$CHAN/" /etc/hostapd/hostapd.conf
|
||||||
systemctl stop wpa_supplicant
|
systemctl stop wpa_supplicant
|
||||||
systemctl restart hostapd
|
systemctl restart hostapd
|
||||||
systemctl start wpa_supplicant
|
systemctl start wpa_supplicant
|
||||||
|
else
|
||||||
|
echo "Upstream Channel greater than 13 or is the same - not changing hostapd.conf"
|
||||||
fi
|
fi
|
||||||
|
sleep 3
|
||||||
/usr/sbin/ip link set ap0 up
|
/usr/sbin/ip link set ap0 up
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue