|
@@ -260,6 +260,38 @@ function start {
|
260
|
260
|
verify
|
261
|
261
|
}
|
262
|
262
|
|
|
263
|
+function monitor {
|
|
264
|
+ if [ -z "$IFACE" ] ; then
|
|
265
|
+ echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
|
266
|
+ exit 723657
|
|
267
|
+ fi
|
|
268
|
+
|
|
269
|
+ stop
|
|
270
|
+
|
|
271
|
+ echo "info: monitoring mesh network $WIFI_SSID on $IFACE"
|
|
272
|
+
|
|
273
|
+ systemctl stop network-manager
|
|
274
|
+ sleep 5
|
|
275
|
+
|
|
276
|
+ global_rate_limit
|
|
277
|
+
|
|
278
|
+ # Might have to re-enable wifi
|
|
279
|
+ rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true
|
|
280
|
+
|
|
281
|
+ ifconfig $IFACE down
|
|
282
|
+ ifconfig $IFACE mtu 1532
|
|
283
|
+ ifconfig $IFACE hw ether $(assign_peer_address)
|
|
284
|
+ iwconfig $IFACE enc off
|
|
285
|
+ iwconfig $IFACE mode monitor channel $CHANNEL
|
|
286
|
+ sleep 1
|
|
287
|
+ iwconfig $IFACE ap $CELLID
|
|
288
|
+
|
|
289
|
+ modprobe batman-adv
|
|
290
|
+ batctl if add $IFACE
|
|
291
|
+ ifconfig $IFACE up
|
|
292
|
+ horst -i $IFACE
|
|
293
|
+}
|
|
294
|
+
|
263
|
295
|
if ! grep -q "$IFACE" /proc/net/dev; then
|
264
|
296
|
echo 'Interface $IFACE was not found'
|
265
|
297
|
stop
|
|
@@ -267,7 +299,7 @@ if ! grep -q "$IFACE" /proc/net/dev; then
|
267
|
299
|
fi
|
268
|
300
|
|
269
|
301
|
case "$1" in
|
270
|
|
- start|stop|status)
|
|
302
|
+ start|stop|status|monitor)
|
271
|
303
|
$1
|
272
|
304
|
;;
|
273
|
305
|
restart)
|