浏览代码

Install horst for wifi network monitoring

Bob Mottram 8 年前
父节点
当前提交
c6ab0b0cb7
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 36 次插入1 次删除
  1. 3
    0
      src/freedombone-image-customise
  2. 33
    1
      src/freedombone-mesh-batman

+ 3
- 0
src/freedombone-image-customise 查看文件

735
     # a sane editor
735
     # a sane editor
736
     chroot "$rootdir" apt-get -y install emacs24
736
     chroot "$rootdir" apt-get -y install emacs24
737
 
737
 
738
+    # for wifi monitoring
739
+    chroot "$rootdir" apt-get -y install horst
740
+
738
     # for sound level control
741
     # for sound level control
739
     chroot "$rootdir" apt-get -y install alsa-utils
742
     chroot "$rootdir" apt-get -y install alsa-utils
740
 
743
 

+ 33
- 1
src/freedombone-mesh-batman 查看文件

260
     verify
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
 if ! grep -q "$IFACE" /proc/net/dev; then
295
 if ! grep -q "$IFACE" /proc/net/dev; then
264
     echo 'Interface $IFACE was not found'
296
     echo 'Interface $IFACE was not found'
265
     stop
297
     stop
267
 fi
299
 fi
268
 
300
 
269
 case "$1" in
301
 case "$1" in
270
-    start|stop|status)
302
+    start|stop|status|monitor)
271
         $1
303
         $1
272
         ;;
304
         ;;
273
     restart)
305
     restart)