[PATCH v3] nodewatcher: only add direct batman originators

Tim Niemeyer tim.niemeyer at mastersword.de
So Okt 11 12:02:17 CEST 2015


Am Sonntag, den 11.10.2015, 11:57 +0200 schrieb Tobias Klaus:
> Danke!
> 
> Dank dieser Erklärung :-) :
> 
> Reviewed-by: Tobias Klaus <tk+ff at meskal.net>
Danke fürs drüber gucken.

Ich hab beim applien die scissors (--- %< ---) um jeweils ein Strich
verkleinert, da diese sonst als Patch Kommentar interpretiert werden und
nicht im Commit-Log landen.

Tim

> 
> Am Samstag, 10. Oktober 2015, 16:46:39 schrieb Tim Niemeyer:
> > This is a normal scenario:
> > --- %< ---
> > originator last-seen (quality) nexthop [interface]: .. possible nexthops ..
> > A    0.270s   (134) A [    w2mesh]: C ( 79) A (134)
> > B    0.170s   (245) B [    w2mesh]: B (245)
> > C    1.850s   (152) C [    w2mesh]: A ( 83) C (152)
> > --- >% ---
> > Nodewatcher will send only the originator, last-seen, quality, nexthop
> > and the interface. Nothing about the possible nexthops. Because Netmon
> > can't show every Originator (to bad performance), we need some filtering,
> > to only see direct neighbors. At the moment Netmon stores only
> > originator == nexthop entries. And there is no other way to filter,
> > because Netmon has only this information.
> > 
> > But this may fail. The problem occurs, if A has a better connection
> > (e.g. via eth0) with leads to an quality of 255:
> > --- %< ---
> > A    0.270s   (255) A [    eth0]: C ( 79) A (255)
> > B    0.170s   (245) B [    w2mesh]: B (245)
> > C    1.850s   (204) A [    eth0]: A (204) C (152)
> > --- >% ---
> > In this example, Netmon wouldn't show the connection to C.
> > 
> > This patch doesn't use the originator == nexthop filter. Instead a
> > filter like "originator is anywhere in the possible nexthops" is used.
> > With this, we can disable the filtering in Netmon and show at least that
> > there is directly connection. With the "batctl o" command it is not
> > possible to show the correct interface for this direct connection.
> > 
> > Signed-off-by: Tim Niemeyer <tim.niemeyer at mastersword.de>
> > ---
> > 
> > Changes in v3:
> > - Add comments to AWK
> > - Add better commit log
> > - Increment the script version
> > 
> >  bsp/default/root_file_system/etc/nodewatcher.sh | 19 ++++++++++++-------
> >  1 file changed, 12 insertions(+), 7 deletions(-)
> > 
> > diff --git a/bsp/default/root_file_system/etc/nodewatcher.sh
> > b/bsp/default/root_file_system/etc/nodewatcher.sh index 1c85cc0..3516a7f
> > 100755
> > --- a/bsp/default/root_file_system/etc/nodewatcher.sh
> > +++ b/bsp/default/root_file_system/etc/nodewatcher.sh
> > @@ -2,7 +2,7 @@
> >  # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
> >  # License; GPL v3
> > 
> > -SCRIPT_VERSION="31"
> > +SCRIPT_VERSION="32"
> > 
> >  test -f /tmp/started || exit
> > 
> > @@ -168,17 +168,22 @@ crawl() {
> >             
> > BATMAN_ADV_INTERFACES=$BATMAN_ADV_INTERFACES"<$iface><name>$iface</name><st
> > atus>$status</status></$iface>" done
> > 
> > +        # Build a list of direct neighbors
> >          batman_adv_originators=$(awk \
> > -            'BEGIN { FS=" "; i=0 }
> > -            /O/ { next }
> > -            /B/ { next }
> > -            {   sub("\\(", "", $0)
> > +            'BEGIN { FS=" "; i=0 } # set the delimiter to " "
> > +            /O/ { next } # ignore lines with O (will remove second line)
> > +            /B/ { next } # ignore line with B (will remove first line)
> > +            {   sub("\\(", "", $0) # remove parentheses
> >                  sub("\\)", "", $0)
> >                  sub("\\[", "", $0)
> >                  sub("\\]:", "", $0)
> >                  sub("  ", " ", $0)
> > -                printf
> > "<originator_"i"><originator>"$1"</originator><link_quality>"$3"</link_qual
> > ity><nexthop>"$4"</nexthop><last_seen>"$2"</last_seen><outgoing_interface>"$
> > 5"</outgoing_interface></originator_"i">" -                i++
> > +                o=$1".*"$1 # build a regex to find lines that contains the
> > $1 (=originator) twice +                if ($0 ~ o) # filter for this regex
> > (will remove entries without direct neighbor) +                {
> > +                    printf
> > "<originator_"i"><originator>"$1"</originator><link_quality>"$3"</link_qual
> > ity><nexthop>"$4"</nexthop><last_seen>"$2"</last_seen><outgoing_interface>"$
> > 5"</outgoing_interface></originator_"i">" +                    i++
> > +                }
> >              }' /sys/kernel/debug/batman_adv/bat0/originators)
> > 
> >  		batman_adv_gateway_mode=$(batctl gw)

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 819 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20151011/dc6fa9bc/attachment-0002.sig>


Mehr Informationen über die Mailingliste franken-dev