Skip to content
Snippets Groups Projects
Commit d7a05715 authored by Bob Mottram's avatar Bob Mottram
Browse files

Stop if batman verify fails

parent 0425e7ea
No related branches found
No related tags found
No related merge requests found
......@@ -92,12 +92,49 @@ function status {
batctl o
}
function stop {
if [ -z "$IFACE" ]; then
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
return
fi
if [ "$EIFACE" ]; then
brctl delif $BRIDGE bat0
brctl delif $BRIDGE $EIFACE
ifconfig $BRIDGE down || true
brctl delbr $BRIDGE
ifconfig $EIFACE down -promisc
fi
avahi-autoipd -k $BRIDGE
avahi-autoipd -k $IFACE
ifconfig bat0 down -promisc
batctl if del $IFACE
rmmod batman-adv
ifconfig $IFACE mtu 1500
ifconfig $IFACE down
iwconfig $IFACE mode managed
iptables -D INPUT -p tcp --dport 548 -j ACCEPT
iptables -D INPUT -p udp --dport 548 -j ACCEPT
iptables -D INPUT -p tcp --dport 5353 -j ACCEPT
iptables -D INPUT -p udp --dport 5353 -j ACCEPT
iptables -D INPUT -p tcp --dport 5354 -j ACCEPT
iptables -D INPUT -p udp --dport 5354 -j ACCEPT
iptables -D INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT
iptables -D INPUT -p udp --dport $ZERONET_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport $IPFS_PORT -j ACCEPT
systemctl restart network-manager
}
function verify {
tempfile="$(mktemp)"
batctl o > $tempfile
if grep -q "disabled" $tempfile; then
echo $'B.A.T.M.A.N. not enabled'
rm $tempfile
stop
exit 726835
fi
echo $'B.A.T.M.A.N. is running'
......@@ -171,42 +208,6 @@ function start {
verify
}
stop() {
if [ -z "$IFACE" ]; then
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
return
fi
if [ "$EIFACE" ]; then
brctl delif $BRIDGE bat0
brctl delif $BRIDGE $EIFACE
ifconfig $BRIDGE down || true
brctl delbr $BRIDGE
ifconfig $EIFACE down -promisc
fi
avahi-autoipd -k $BRIDGE
avahi-autoipd -k $IFACE
ifconfig bat0 down -promisc
batctl if del $IFACE
rmmod batman-adv
ifconfig $IFACE mtu 1500
ifconfig $IFACE down
iwconfig $IFACE mode managed
iptables -D INPUT -p tcp --dport 548 -j ACCEPT
iptables -D INPUT -p udp --dport 548 -j ACCEPT
iptables -D INPUT -p tcp --dport 5353 -j ACCEPT
iptables -D INPUT -p udp --dport 5353 -j ACCEPT
iptables -D INPUT -p tcp --dport 5354 -j ACCEPT
iptables -D INPUT -p udp --dport 5354 -j ACCEPT
iptables -D INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT
iptables -D INPUT -p udp --dport $ZERONET_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport $IPFS_PORT -j ACCEPT
systemctl restart network-manager
}
if ! grep -q "$IFACE" /proc/net/dev; then
echo 'Interface $IFACE was not found'
stop
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment