|
@@ -92,12 +92,49 @@ function status {
|
92
|
92
|
batctl o
|
93
|
93
|
}
|
94
|
94
|
|
|
95
|
+function stop {
|
|
96
|
+ if [ -z "$IFACE" ]; then
|
|
97
|
+ echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
|
98
|
+ return
|
|
99
|
+ fi
|
|
100
|
+ if [ "$EIFACE" ]; then
|
|
101
|
+ brctl delif $BRIDGE bat0
|
|
102
|
+ brctl delif $BRIDGE $EIFACE
|
|
103
|
+ ifconfig $BRIDGE down || true
|
|
104
|
+ brctl delbr $BRIDGE
|
|
105
|
+ ifconfig $EIFACE down -promisc
|
|
106
|
+ fi
|
|
107
|
+
|
|
108
|
+ avahi-autoipd -k $BRIDGE
|
|
109
|
+ avahi-autoipd -k $IFACE
|
|
110
|
+ ifconfig bat0 down -promisc
|
|
111
|
+
|
|
112
|
+ batctl if del $IFACE
|
|
113
|
+ rmmod batman-adv
|
|
114
|
+ ifconfig $IFACE mtu 1500
|
|
115
|
+ ifconfig $IFACE down
|
|
116
|
+ iwconfig $IFACE mode managed
|
|
117
|
+
|
|
118
|
+ iptables -D INPUT -p tcp --dport 548 -j ACCEPT
|
|
119
|
+ iptables -D INPUT -p udp --dport 548 -j ACCEPT
|
|
120
|
+ iptables -D INPUT -p tcp --dport 5353 -j ACCEPT
|
|
121
|
+ iptables -D INPUT -p udp --dport 5353 -j ACCEPT
|
|
122
|
+ iptables -D INPUT -p tcp --dport 5354 -j ACCEPT
|
|
123
|
+ iptables -D INPUT -p udp --dport 5354 -j ACCEPT
|
|
124
|
+ iptables -D INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT
|
|
125
|
+ iptables -D INPUT -p udp --dport $ZERONET_PORT -j ACCEPT
|
|
126
|
+ iptables -D INPUT -p tcp --dport $IPFS_PORT -j ACCEPT
|
|
127
|
+
|
|
128
|
+ systemctl restart network-manager
|
|
129
|
+}
|
|
130
|
+
|
95
|
131
|
function verify {
|
96
|
132
|
tempfile="$(mktemp)"
|
97
|
133
|
batctl o > $tempfile
|
98
|
134
|
if grep -q "disabled" $tempfile; then
|
99
|
135
|
echo $'B.A.T.M.A.N. not enabled'
|
100
|
136
|
rm $tempfile
|
|
137
|
+ stop
|
101
|
138
|
exit 726835
|
102
|
139
|
fi
|
103
|
140
|
echo $'B.A.T.M.A.N. is running'
|
|
@@ -171,42 +208,6 @@ function start {
|
171
|
208
|
verify
|
172
|
209
|
}
|
173
|
210
|
|
174
|
|
-stop() {
|
175
|
|
- if [ -z "$IFACE" ]; then
|
176
|
|
- echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
177
|
|
- return
|
178
|
|
- fi
|
179
|
|
- if [ "$EIFACE" ]; then
|
180
|
|
- brctl delif $BRIDGE bat0
|
181
|
|
- brctl delif $BRIDGE $EIFACE
|
182
|
|
- ifconfig $BRIDGE down || true
|
183
|
|
- brctl delbr $BRIDGE
|
184
|
|
- ifconfig $EIFACE down -promisc
|
185
|
|
- fi
|
186
|
|
-
|
187
|
|
- avahi-autoipd -k $BRIDGE
|
188
|
|
- avahi-autoipd -k $IFACE
|
189
|
|
- ifconfig bat0 down -promisc
|
190
|
|
-
|
191
|
|
- batctl if del $IFACE
|
192
|
|
- rmmod batman-adv
|
193
|
|
- ifconfig $IFACE mtu 1500
|
194
|
|
- ifconfig $IFACE down
|
195
|
|
- iwconfig $IFACE mode managed
|
196
|
|
-
|
197
|
|
- iptables -D INPUT -p tcp --dport 548 -j ACCEPT
|
198
|
|
- iptables -D INPUT -p udp --dport 548 -j ACCEPT
|
199
|
|
- iptables -D INPUT -p tcp --dport 5353 -j ACCEPT
|
200
|
|
- iptables -D INPUT -p udp --dport 5353 -j ACCEPT
|
201
|
|
- iptables -D INPUT -p tcp --dport 5354 -j ACCEPT
|
202
|
|
- iptables -D INPUT -p udp --dport 5354 -j ACCEPT
|
203
|
|
- iptables -D INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT
|
204
|
|
- iptables -D INPUT -p udp --dport $ZERONET_PORT -j ACCEPT
|
205
|
|
- iptables -D INPUT -p tcp --dport $IPFS_PORT -j ACCEPT
|
206
|
|
-
|
207
|
|
- systemctl restart network-manager
|
208
|
|
-}
|
209
|
|
-
|
210
|
211
|
if ! grep -q "$IFACE" /proc/net/dev; then
|
211
|
212
|
echo 'Interface $IFACE was not found'
|
212
|
213
|
stop
|