From ae970828a1b1637c8d956f6bacdb3d25d549468e Mon Sep 17 00:00:00 2001 From: Christian Dresel Date: Sat, 16 Apr 2022 10:37:52 +0200 Subject: [PATCH 1/2] fff-web-ui: Only show batman-adv data if batctl exists To prevent the follow error in logread at layer 3 firmware: uhttpd[1700]: /bin/sh: batctl: not found remove batctl from webui if no batctl exist Signed-off-by: Christian Dresel --- .../fff/fff-web-ui/files/www/public/cgi-bin/status.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/packages/fff/fff-web-ui/files/www/public/cgi-bin/status.html b/src/packages/fff/fff-web-ui/files/www/public/cgi-bin/status.html index aed86b5c..2ae818d8 100755 --- a/src/packages/fff/fff-web-ui/files/www/public/cgi-bin/status.html +++ b/src/packages/fff/fff-web-ui/files/www/public/cgi-bin/status.html @@ -57,6 +57,7 @@ contact="$(uci -q get "fff.system.contact")" + <% if [ -f "$(command -v batctl)" ] ; then %>
Status @@ -66,6 +67,7 @@ contact="$(uci -q get "fff.system.contact")"
Lokale Clients:<% echo -n $(batctl tl -H 2> /dev/null | grep -c 'W') %>
+ <% fi %> -- 2.39.2 From 230c258ca691bfc660328ac1d6c30e595d4168ba Mon Sep 17 00:00:00 2001 From: Christian Dresel Date: Sat, 16 Apr 2022 11:16:55 +0200 Subject: [PATCH 2/2] fff-web-ui: Add more information about babel Add a litte bit morge information about babel on the public page of the router Signed-off-by: Christian Dresel --- .../files/www/public/cgi-bin/status.html | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/packages/fff/fff-web-ui/files/www/public/cgi-bin/status.html b/src/packages/fff/fff-web-ui/files/www/public/cgi-bin/status.html index 2ae818d8..b793b2cb 100755 --- a/src/packages/fff/fff-web-ui/files/www/public/cgi-bin/status.html +++ b/src/packages/fff/fff-web-ui/files/www/public/cgi-bin/status.html @@ -67,6 +67,47 @@ contact="$(uci -q get "fff.system.contact")" Lokale Clients:<% echo -n $(batctl tl -H 2> /dev/null | grep -c 'W') %> + <% fi + if birdc show status >/dev/null 2>&1 || pgrep babeld >/dev/null; then %> +
+ Status + + <% #Count Clients + client_count=$(bridge fdb show br br_client brport $(ls "/sys/class/net/br-client/brif" | grep -v '^bat') | grep -v self | grep -v permanent -c) + %> + +
Lokale Clients:<% echo $client_count %>
+
+
+ Babel Status + + + <% if birdc show status >/dev/null 2>&1; then + neighbours="$(birdc -r show babel neighbors | tail -n +5 | awk '{ printf "", $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 "", vars["address"], vars["if"], vars["cost"] + }')" + echo "$neighbours" > /tmp/fff-web-ui.babel + touch $lockfile + fi + fi + echo -n "$neighbours" + %> +
IPInterfaceKosten
%s%s%s
%s%s%s
+
<% fi %> -- 2.39.2