]> code.delx.au - monosys/commitdiff
fix-openwrt-hairpin: error checking
authorJames Bunton <jamesbunton@delx.net.au>
Wed, 22 Jun 2022 11:03:08 +0000 (21:03 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Wed, 22 Jun 2022 11:03:08 +0000 (21:03 +1000)
hacks/fix-openwrt-hairpin

index 43cf0382937bba34b9e1ae498e56860038e7eb49..9403ffee3ff875ccae60126ee40aa6bf32ee0182 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/bash
 
-AP_HOSTS="$(awk '/^Host.*openwrt/ {print $2}' < ~/.ssh/config | grep -v router)"
+AP_HOSTS="$(awk '/^Host.*openwrt/ {print $2}' < ~/.ssh/config)"
 
 for host in $AP_HOSTS; do
-    ssh "$host" 'for f in /sys/devices/virtual/net/*/*wlan*/brport/hairpin_mode; do echo 1 > "$f"; done'
+    ssh "$host" 'for f in /sys/devices/virtual/net/*/*wlan*/brport/hairpin_mode; do [ -f $f ] && echo 1 > "$f"; done'
 done