fff-web-ui: Add more information in ssl about babel peers

Add more information in the routing field about babel peers

Signed-off-by: Christian Dresel <freifunk@dresel.systems>
This commit is contained in:
Christian Dresel 2022-04-30 13:14:13 +02:00
parent 7c04935465
commit 6be3fce0a2
1 changed files with 29 additions and 0 deletions

View File

@ -96,6 +96,35 @@ fi
<tr><th>Bekannte Knoten:</th><td><%= $(($(batctl tg -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null)+1)) %></td></tr>
<tr><th>Nachbarknoten:</th><td><%= $(batctl o -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null) %></td></tr>
<% fi %>
<% if birdc show status >/dev/null 2>&1 || pgrep babeld >/dev/null; then %>
<tr><td><table border="1">
<tr><th style="text-align:center">IP</th><th style="text-align:center">Interface</th><th style="text-align:center">Kosten</th></tr>
<% if birdc show status >/dev/null 2>&1; then
neighbours="$(birdc -r show babel neighbors | tail -n +5 | awk '{ printf "<tr><td>%s</td><td>%s</td><td>%s</td></tr>", $1, $2, $3 }')"
fi
if
pgrep babeld >/dev/null; then
lockfile="/tmp/fff-web-ui.babel.lock"
if [ -e $lockfile ] && [ 30 -gt $(( $(date +%s) - $(date -r $lockfile +%s) )) ] ; then
neighbours=$(cat /tmp/fff-web-ui.babel)
else
neighbours="$(echo dump | nc ::1 33123 | grep '^add neighbour' |
awk '{
for (i=2; i < NF; i += 2) {
vars[$i] = $(i+1)
}
}
{
printf "<tr><td style="text-align:center">%s</td><td style="text-align:center">%s</td><td style="text-align:center">%s</td></tr>", vars["address"], vars["if"], vars["cost"]
}')"
echo "$neighbours" > /tmp/fff-web-ui.babel
touch $lockfile
fi
fi
echo -n "$neighbours"
%>
</table></td></tr>
<% fi %>
</table>
</fieldset>
<fieldset style="padding-bottom:12px">