3 .
/usr
/share
/libubox
/jshn.sh
11 while value
="$( uci -q get $config.@LoadPlugin[$i].library )"; do {
14 file="$( uci -q get $config.@LoadPlugin[$i].hosts_file )"
22 echo "${file:-/var/run/hosts_olsr}"
27 local file_list
=" $( hostsfile_getname 'olsrd' ) $(hostsfile_getname 'olsrd6' ) "
28 local line ip hostname
file file_list_uniq
30 for file in $file_list; do {
31 case " $file_list_uniq " in
35 file_list_uniq
="$file_list_uniq $file"
40 for file in $file_list_uniq; do {
41 [ -e "$file" ] ||
continue
43 while read -r line
; do {
46 # 2001:bf7:820:901::1 stuttgarter-core.olsr # myself
47 # 10.63.160.161 AlexLaterne # 10.63.160.161
54 # IP_1_2_3_4='foo' or IP_2001_bf7_820_901__1='bar'
55 eval IP_
${ip//[.:]/_}="$hostname"
64 VARS
='localIP:Local remoteIP:Remote validityTime:vTime linkQuality:LQ'
65 VARS
="$VARS neighborLinkQuality:NLQ linkCost:Cost remoteHostname:Host"
67 for HOST
in '127.0.0.1' '::1';do
69 json_load
"$( echo /links | nc $HOST 9090 | sed -n '/^[}{ ]/p' )" # remove header/non-json
71 if json_is_a links array
;then
79 eval printf \"%-\
${_${v%:*}}s \" ${v#*:}
83 i
=1;while json_is_a
${i} object
;do
85 json_get_vars $
(for v
in ${VARS};do echo ${v%:*};done)
88 eval "test \${_${v%:*}} -lt \${#${v%:*}} && _${v%:*}=\${#${v%:*}}"
92 eval printf \"%-\
${_${v%:*}}s \" \$${v%:*}
93 eval remoteHostname
="\$IP_${remoteIP//[.:]/_}"