瀏覽代碼

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,6 +735,9 @@ function configure_user_interface {
735 735
     # a sane editor
736 736
     chroot "$rootdir" apt-get -y install emacs24
737 737
 
738
+    # for wifi monitoring
739
+    chroot "$rootdir" apt-get -y install horst
740
+
738 741
     # for sound level control
739 742
     chroot "$rootdir" apt-get -y install alsa-utils
740 743
 

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

@@ -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)