Skip to content
Snippets Groups Projects
Commit bef333c4 authored by Adrian Schmutzler's avatar Adrian Schmutzler Committed by Tim Niemeyer
Browse files

nodewatcher: Fix bugs in gateway list creation


Changes:
- Remove first line (headline) previously parsed as gateway
- Delete leading whitespaces for netif correctly (regex
  "\\[" changed to "\\[ *")
- Remove netif whitespaces first, so they are not changed to
  "false"
- Include trailing whitespace in regex for selection marker
- Remove useless replacement "  " to " "

This is designed to support BATMAN compatibility version 14 AND 15

Signed-off-by: default avatarAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: default avatarAdrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: default avatarTim Niemeyer <tim@tn-x.org>
parent 90c85268
No related branches found
No related tags found
No related merge requests found
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-nodewatcher
PKG_VERSION:=44
PKG_VERSION:=45
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
......
......@@ -2,7 +2,7 @@
# Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
# License; GPL v3
SCRIPT_VERSION="44"
SCRIPT_VERSION="45"
test -f /tmp/started || exit
......@@ -243,15 +243,15 @@ crawl() {
batman_adv_gateway_list=$(awk \
'BEGIN { FS=" "; i=0 }
/B.A.T.M.A.N./ { next }
/Gateway/ { next }
/No gateways/ { next }
{ sub("=>", "true", $0)
sub(" ", "false", $0)
sub("\\(", "", $0)
{ sub("\\(", "", $0)
sub("\\)", "", $0)
sub("\\[", "", $0)
sub("\\[ *", "", $0)
sub("\\]:", "", $0)
sub(" ", " ", $0)
sub("=> ", "true ", $0)
sub(" ", "false ", $0)
printf "<gateway_"i"><selected>"$1"</selected><gateway>"$2"</gateway><link_quality>"$3"</link_quality><nexthop>"$4"</nexthop><outgoing_interface>"$5"</outgoing_interface><gw_class>"$6" "$7" "$8"</gw_class></gateway_"i">"
i++
}' /sys/kernel/debug/batman_adv/bat0/gateways)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment