summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPatrick Grimm <patrick@lunatiki.de>2013-10-14 10:27:09 +0000
committerPatrick Grimm <patrick@lunatiki.de>2013-10-14 10:27:09 +0000
commitd5cd72e0118691aed0aebc025d55877c75a39d49 (patch)
tree95007794bb00e8313549865d41856f02642b1ef6
parent0c1f8b8aa31f34c0036bd798e5949188baa6d5b2 (diff)
package/freifunk-common: neigh.sh use olsr-jsoninfo
-rwxr-xr-xcontrib/package/freifunk-common/files/usr/bin/neigh.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/contrib/package/freifunk-common/files/usr/bin/neigh.sh b/contrib/package/freifunk-common/files/usr/bin/neigh.sh
index ec53a5850..4c734ae22 100755
--- a/contrib/package/freifunk-common/files/usr/bin/neigh.sh
+++ b/contrib/package/freifunk-common/files/usr/bin/neigh.sh
@@ -1,4 +1,22 @@
#!/bin/sh
-wget -q -O - http://localhost:2006/neighbours|sed -e's/LinkQuality/LQ/;s/Hysteresis/Hyst./;s/Willingness/Will./'
-[ -f /proc/net/ipv6_route ] && wget -q -O - http://[::1]:2006/neighbours|sed -e's/LinkQuality/LQ/;s/Hysteresis/Hyst./;s/Willingness/Will./'
+. /usr/share/libubox/jshn.sh
+
+for HOST in 127.0.0.1 ::1;do
+ json_init
+ json_load "$(echo /links|nc ${HOST} 9090)"
+ if json_is_a links array;then
+ echo "LocalIP RemoteIP vTime LQ NLQ Cost"
+ json_select links
+ i=1
+ while json_is_a ${i} object;do
+ json_select ${i}
+ json_get_vars localIP remoteIP validityTime linkQuality neighborLinkQuality linkCost
+ echo "${localIP} ${remoteIP} ${validityTime} ${linkQuality} ${neighborLinkQuality} ${linkCost}"
+ json_select
+ i=$(( i + 1 ))
+ done
+ fi
+ echo
+done
+