From 32c290857e2c9669a1d2e38b11a917dc81554a4e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 19 Jul 2015 14:41:51 +0100 Subject: [PATCH] Batman firewall --- src/freedombone | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/freedombone b/src/freedombone index 2ba2eacc..1d7b6636 100755 --- a/src/freedombone +++ b/src/freedombone @@ -1626,25 +1626,30 @@ function mesh_batman { echo '# stop network manager to make the mesh network work' >> /usr/bin/mesh echo 'service networking stop' >> /usr/bin/mesh echo '' >> /usr/bin/mesh - echo '# configure the wlan interface to operate with mtus of 1532(batman requires it) and turn enc off to ensure it works' >> /usr/bin/mesh + echo -n '# configure the wlan interface to operate with ' >> /usr/bin/mesh + echo 'mtus of 1532(batman requires it) and turn enc off ' >> /usr/bin/mesh + echo 'to ensure it works' >> /usr/bin/mesh echo 'ifconfig wlan0 down' >> /usr/bin/mesh echo 'ifconfig wlan0 mtu 1532' >> /usr/bin/mesh echo 'iwconfig wlan0 enc off' >> /usr/bin/mesh echo '' >> /usr/bin/mesh echo '# add the interface to the ad-hoc network - or create it.' >> /usr/bin/mesh - echo "iwconfig wlan0 mode ad-hoc essid mesh-$MESH_ESSID ap $BATMAN_IPV6 channel 2" >> /usr/bin/mesh + echo -n "iwconfig wlan0 mode ad-hoc essid mesh-$MESH_ESSID ap " >> /usr/bin/mesh + echo "$BATMAN_IPV6 channel 2" >> /usr/bin/mesh echo '' >> /usr/bin/mesh - echo '# add wlan0 to the batman-adv virtual interface(so it can communicate with other batman-adv nodes)' >> /usr/bin/mesh + echo -n '# add wlan0 to the batman-adv virtual interface(so it can ' >> /usr/bin/mesh + echo 'communicate with other batman-adv nodes)' >> /usr/bin/mesh echo 'batctl if add wlan0' >> /usr/bin/mesh echo 'ifconfig wlan0 up' >> /usr/bin/mesh echo 'ifconfig bat0 up' >> /usr/bin/mesh echo '' >> /usr/bin/mesh - echo '# make the bridge linking the batman-adv virtual interface to the ethernet port' >> /usr/bin/mesh + echo -n '# make the bridge linking the batman-adv virtual ' >> /usr/bin/mesh + echo 'interface to the ethernet port' >> /usr/bin/mesh echo 'brctl addbr bridge-link' >> /usr/bin/mesh echo 'brctl addif bridge-link bat0' >> /usr/bin/mesh echo 'brctl addif bridge-link eth0' >> /usr/bin/mesh echo '' >> /usr/bin/mesh - echo '#get the ip address for the bridge from the dhcp server' >> /usr/bin/mesh + echo '# get the ip address for the bridge from the dhcp server' >> /usr/bin/mesh echo 'dhclient bridge-link' >> /usr/bin/mesh echo '' >> /usr/bin/mesh echo 'exit 0' >> /usr/bin/mesh @@ -5465,6 +5470,21 @@ function configure_firewall_for_cjdns { echo 'configure_firewall_for_cjdns' >> $COMPLETION_FILE } +function configure_firewall_for_batman { + if grep -Fxq "configure_firewall_for_batman" $COMPLETION_FILE; then + return + fi + if [[ $ENABLE_BATMAN != "yes" ]]; then + return + fi + # DHCP + #iptables -A INPUT -i eth0 -p udp --dport 547 -j ACCEPT + # BATMAN + #iptables -A INPUT -i eth0 -p udp --dport 1966 -j ACCEPT + save_firewall_settings + echo 'configure_firewall_for_batman' >> $COMPLETION_FILE +} + function configure_firewall_for_dlna { if grep -Fxq "configure_firewall_for_dlna" $COMPLETION_FILE; then return @@ -9720,6 +9740,7 @@ configure_firewall_for_dns configure_firewall_for_ftp configure_firewall_for_web_access configure_firewall_for_cjdns +configure_firewall_for_batman configure_firewall_for_voip remove_proprietary_repos change_debian_repos