Configurable wifi interface

This commit is contained in:
Bob Mottram 2015-08-09 14:39:22 +01:00
parent a31acc3353
commit c37f537d39
1 changed files with 12 additions and 8 deletions

View File

@ -368,6 +368,7 @@ EXTERNAL_IP_SERVICES=( \
'http://httpbin.org/ip')
WIFI_CHANNEL=2
WIFI_INTERFACE=wlan0
# cjdns settings
ENABLE_CJDNS="no"
@ -750,6 +751,9 @@ function read_configuration {
fi
if [ -f $CONFIGURATION_FILE ]; then
if grep -q "WIFI_INTERFACE" $CONFIGURATION_FILE; then
WIFI_INTERFACE=$(grep "WIFI_INTERFACE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "IRC_PORT" $CONFIGURATION_FILE; then
IRC_PORT=$(grep "IRC_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -1161,8 +1165,8 @@ function install_not_on_BBB {
echo '#iface eth1 inet dhcp' >> /etc/network/interfaces
echo '' >> /etc/network/interfaces
echo '# WiFi Example' >> /etc/network/interfaces
echo '#auto wlan0' >> /etc/network/interfaces
echo '#iface wlan0 inet dhcp' >> /etc/network/interfaces
echo "#auto $WIFI_INTERFACE" >> /etc/network/interfaces
echo "#iface $WIFI_INTERFACE inet dhcp" >> /etc/network/interfaces
echo '# wpa-ssid "essid"' >> /etc/network/interfaces
echo '# wpa-psk "password"' >> /etc/network/interfaces
echo '' >> /etc/network/interfaces
@ -1728,7 +1732,7 @@ function mesh_babel {
echo ' fi' >> $babel_script
echo 'fi' >> $babel_script
echo '' >> $babel_script
echo 'IFACE=wlan0' >> $babel_script
echo "IFACE=$WIFI_INTERFACE" >> $babel_script
echo 'if grep -q "wlan1" /proc/net/dev; then' >> $babel_script
echo ' IFACE=wlan1' >> $babel_script
echo 'fi' >> $babel_script
@ -1821,7 +1825,7 @@ function mesh_batman_bridge {
echo '' >> $batman_script
echo '# Ethernet bridge definition (bridged to bat0)' >> $batman_script
echo 'BRIDGE=br-mesh' >> $batman_script
echo 'IFACE=wlan0' >> $batman_script
echo "IFACE=$WIFI_INTERFACE" >> $batman_script
echo 'EIFACE=eth0' >> $batman_script
echo '' >> $batman_script
echo 'if grep -q "wlan1" /proc/net/dev; then' >> $batman_script
@ -5824,8 +5828,8 @@ function configure_firewall_for_batman {
fi
# DHCP
iptables -A INPUT -i eth0 -p udp --dport 547 -j ACCEPT
iptables -A INPUT -i wlan0 -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
ip6tables -A INPUT -i wlan0 -p udp --dport 5353 -j ACCEPT
iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
ip6tables -A INPUT -i $WIFI_INTERFACE -p udp --dport 5353 -j ACCEPT
save_firewall_settings
echo 'configure_firewall_for_batman' >> $COMPLETION_FILE
@ -5838,8 +5842,8 @@ function configure_firewall_for_babel {
if [[ $ENABLE_BABEL != "yes" ]]; then
return
fi
iptables -A INPUT -i wlan0 -p udp --dport $BABEL_PORT -j ACCEPT
iptables -A INPUT -i wlan0 -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport $BABEL_PORT -j ACCEPT
iptables -A INPUT -i $WIFI_INTERFACE -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
save_firewall_settings
echo 'configure_firewall_for_babel' >> $COMPLETION_FILE
}