Quellcode durchsuchen

use batctl - debugfs has become deprecated in batman-adv

pull/52/head
mart-ffbsee vor 5 Monaten
Ursprung
Commit
1b718aa8ac

+ 1
- 1
files/etc/hotplug.d/net/60-freifunk-ula Datei anzeigen

@@ -9,7 +9,7 @@
if [ "$INTERFACE" = "bat0" ]; then
. /lib/ff_shared.sh

macaddr="$(cat /sys/kernel/debug/batman_adv/bat0/neighbors | awk -F'[/ ]' '{print $7; exit;}')"
macaddr="$(batctl neighbors | awk -F'[/ ]' '{print $7; exit;}')"
prefix="$(uci get network.globals.ula_prefix)"
ipaddr="$(ula_addr $prefix $macaddr)"
ip a a "$ipaddr/64" dev br-freifunk

+ 13
- 6
files/usr/sbin/print_map.sh Datei anzeigen

@@ -14,7 +14,7 @@ memory_usage()

rootfs_usage()
{
df / | awk 'NR>1 {print($5/100); exit;}'
df / | awk 'BEGIN {val=100} NR==2 {val=$5} END { printf("%.2f", val/100) }'
}

print_basic() {
@@ -24,18 +24,24 @@ print_basic() {
local longitude="$(uci -q get freifunk.@settings[0].longitude 2> /dev/null)"
local latitude="$(uci -q get freifunk.@settings[0].latitude 2> /dev/null)"
local contact="$(uci -q get freifunk.@settings[0].contact 2> /dev/null)"
local autoupdater_enabled="$(uci -q get autoupdater.settings.enabled 2> /dev/null)"
local autoupdater_branch="$(uci -q get autoupdater.settings.branch 2> /dev/null)"

[ -n "$contact" ] && echo -n "\"contact\" : \"$contact\", "
[ -n "$name" ] && echo -n "\"name\" : \"$name\", "
[ -n "$version" ] && echo -n "\"firmware\" : \"ffbsee-$version\", "
[ -n "$version" ] && echo -n "\"firmware\" : \"ffulm-$version\", "
[ -n "$community" ] && echo -n "\"community\" : \"$community\", "

if [ "$autoupdater_enabled" = "1" ]; then
echo -n "\"autoupdater\" : \"$autoupdater_branch\", "
fi

if [ -n "$longitude" -a -n "$latitude" ]; then
echo -n "\"longitude\" : $longitude, "
echo -n "\"latitude\" : $latitude, "
fi

echo -n "\"model\" : \"$(cat /tmp/sysinfo/model | sed -e 's/ */ /g')\", "
echo -n "\"model\" : \"$(cat /tmp/sysinfo/model)\", "
echo -n "\"links\" : ["

# Calculate bandwidth as percent value
@@ -44,8 +50,8 @@ print_basic() {
IFS="
"
nd=0
for entry in $(awk -F '[][)( \t]+' '/^[a-f0-9]/{ print($1, $3, $4) }' /sys/kernel/debug/batman_adv/bat0/neighbors 2> /dev/null); do
[ $nd -eq 0 ] && nd=1 || echo -n ", "
for entry in $(batctl neighbors 2> /dev/null | awk -F '[][)( \t]+' '/^[a-f0-9]/{ print($1, $3, $4) }'); do
[ $nd -eq 0 ] && nd=1 || echo -n ", "
IFS=" "
printLink $entry
done
@@ -53,12 +59,13 @@ print_basic() {
echo -n '], '

mac=$(uci -q get network.freifunk.macaddr)
cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | tr '\t/[]()' ' ' | awk -v mac=$mac 'BEGIN{ c=0; } { if($1 == "*" && $2 != mac && $4 ~ /^[.NW]+$/ && $5 < 300) c++;} END{ printf("\"clientcount\" : %d", c);}'
batctl translocal 2> /dev/null | tr '\t/[]()' ' ' | awk -v mac=$mac 'BEGIN{ c=0; } { if($1 == "*" && $2 != mac && $4 ~ /^[.NW]+$/ && $5 < 300) c++;} END{ printf("\"clientcount\" : %d", c);}'
}

print_more() {
echo -n "\"loadavg\" : $(uptime | awk '{print($NF)}'), "
echo -n "\"uptime\" : $(awk '{print(int($1))}' /proc/uptime), "

print_basic
}


+ 4
- 4
files/www/freifunk/cgi-bin/status Datei anzeigen

@@ -49,15 +49,15 @@ fi
<div class="pure-g">
<div class="pure-u-md-1-3">
<h2>Nachbarknoten</h2>
<h3><% (tail -n +3 /sys/kernel/debug/batman_adv/bat0/neighbors 2> /dev/null | grep -v '^No' | cut -c -17 | sort | uniq | wc -l) %></h3>
<h3><% (batctl neighbors 2> /dev/null | tail -n +3 | grep -v '^No' | cut -c -17 | sort | uniq | wc -l) %></h3>
</div>
<div class="pure-u-md-1-3">
<h2>Alle Knoten</h2>
<h3><% echo -n $((`tail -n +3 /sys/kernel/debug/batman_adv/bat0/transtable_global 2> /dev/null | grep '^ [^ ]' | cut -b 39-55 | sort | uniq | wc -l`+1)) %></h3>
<h3><% echo -n $((`batctl transglobal 2> /dev/null | tail -n +3 | grep '^ [^ ]' | cut -b 39-55 | sort | uniq | wc -l`+1)) %></h3>
</div>
<div class="pure-u-md-1-3">
<h2>Lokale Clients</h2>
<h3><% echo -n $(cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | grep -c 'W') %></h3>
<h3><% echo -n $(batctl translocal 2> /dev/null | tail -n +3 | grep -c 'W') %></h3>
</div>
</div>
</div>
@@ -69,7 +69,7 @@ echo '<div class="content">'
echo ' <h2 class="content-subhead">Nachbarknoten:</h2>'
echo ' <ul>'

macs="$(tail -n +3 /sys/kernel/debug/batman_adv/bat0/neighbors 2> /dev/null | grep -v '^No' | cut -c -17 | sort | uniq)"
macs="$(batctl neighbors | tail -n +3 | grep -v '^No' | cut -c -17 | sort | uniq)"
if [ -n "$macs" ]; then
prefix="$(uci get network.globals.ula_prefix)"
i=1

+ 4
- 4
files/www/lan/cgi-bin/home Datei anzeigen

@@ -85,17 +85,17 @@ else
print 'has_internet' 'Nein'
fi

print 'node_count' "$((`cat /sys/kernel/debug/batman_adv/bat0/transtable_global | grep '^ [^ ]' | cut -b 39-55 | sort | uniq | wc -l 2> /dev/null`+1))"
print 'neigh_count' "$(tail -n +3 /sys/kernel/debug/batman_adv/bat0/neighbors 2> /dev/null | grep -v '^No' | cut -c -17 | sort | uniq | wc -l)"
print 'node_count' "$((`batctl transglobal 2> /dev/null | grep '^ [^ ]' | cut -b 39-55 | sort | uniq | wc -l`+1))"
print 'neigh_count' "$(batctl neighbors 2> /dev/null | tail -n +3 | grep -v '^No' | cut -c -17 | sort | uniq | wc -l)"
print 'firmware_version' "$(uci -q get freifunk.@settings[0].version)"
print 'fastd_version' "$(fastd --version 2> /dev/null | cut -d' ' -f 2)"
print 'batman_version' "$(cat /sys/module/batman_adv/version 2> /dev/null)"
print 'batman_version' "$(batctl -v 2> /dev/null | awk -F '[][ \t]+' '{print($4); exit;}')"
print 'routing-algo' "$(cat /sys/module/batman_adv/parameters/routing_algo 2> /dev/null)"
print 'openwrt_version' "$DISTRIB_RELEASE"
name="$(uci -q get freifunk.@settings[0].name)"
print 'name' "${name:--}"
print 'model' "$(cat /tmp/sysinfo/model 2> /dev/null)"
print 'freifunk_user_count' "$(cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | grep -c 'W')"
print 'freifunk_user_count' "$(batctl translocal 2> /dev/null | grep -c 'W')"
print 'lan_user_count' "$(cat /tmp/dhcp.lan.leases 2> /dev/null | sed '/^[0-9][0-9]* .* 192/!d' | wc -l)"

print 'lan_rx_speed' "$(calc_speed.sh $lan rx 2> /dev/null)"

+ 1
- 1
package/freifunk/Makefile Datei anzeigen

@@ -14,7 +14,7 @@ define Package/freifunk-basic
DEFAULT:=y
TITLE:= Freifunk-Bodensee Basic
URL:=http://ffbsee.de
DEPENDS:=+kmod-batman-adv +alfred +sockread \
DEPENDS:=+kmod-batman-adv +batctl +alfred +sockread \
+uhttpd +haserl +px5g +libustream-mbedtls \
+fastd +ip +simple-radvd +@SMALL_FLASH \
+ebtables +kmod-ebtables-ipv4 +kmod-ebtables-ipv6 \

Laden…
Abbrechen
Speichern