Project

General

Profile

Actions

Bug #360

open

Batman-adv v2018.1 losst Gateway state after time.

Added by Jan-Tarek Butt over 6 years ago. Updated over 6 years ago.

Status:
Feedback
Priority:
Normal
Target version:
-
Start date:
07/08/2018
Due date:
% Done:

0%

Estimated time:

Description

Hi Together,

Synthom:

After server restart. While some time ago the batman-adv Gateway stop announcing it self.
This results int an emty batman-adv Gateway table (see below). Anything else seems working normal.

System Info:

batctl gwl


[B.A.T.M.A.N. adv 2018.1, MainIF/MAC: mesh-vpn/0a:74:11:ab:7e:27 (bat0/56:1f:85:09:bb:34 BATMAN_IV)]
  Router            ( TQ) Next Hop          [outgoingIf]  Bandwidth

batctl o


[B.A.T.M.A.N. adv 2018.1, MainIF/MAC: mesh-vpn/0a:74:11:ab:7e:27 (bat0/56:1f:85:09:bb:34 BATMAN_IV)]
   Originator        last-seen (#/255) Nexthop           [outgoingIF]
 * 42:de:ae:a6:c4:23    0.787s   (224) 46:56:c7:10:61:f3 [  mesh-vpn]
...

batctl -v

batctl 2018.1 [batman-adv: 2018.1]@

batctl -m bat-default gw_mode

server (announced bw: 279.8/120.8 MBit)

uname -a

Linux default02 4.9.0-7-amd64 #1 SMP Debian 4.9.110-1 (2018-07-05) x86_64 GNU/Linux

Dynamic bandwidth setting

In the background their is a script running which is updating every 30min the (measured - used) bandwidth.
Idea behind that: if more traffic is generated by users on this gateway then less bandwidth will be announced and new incoming clients get other gateways with higher announced bandwidth.

Bandwidth updating is done over following code (using batctl):

#!/bin/bash
gwsel_lockfile="/tmp/gwsel_lockfile"  # lockfile to allow for low bandwidth settings 

if [ -z "$1" ]; then
        echo
        echo "usage: $0 <network-interface> <update_interval [sec]> <total BW up [Mbit/sec]> <total BW down [Mbit/sec]>" 
        echo
        echo "e.g. $0 eth0 60 10 10" 
        echo
        exit
fi

while true
do
    if [ ! -e ${gwsel_lockfile} ]; then    # lockfile not present
        # Bandwidth currently used (time averaged)
        R1=$(cat "/sys/class/net/$1/statistics/rx_bytes")
        T1=$(cat "/sys/class/net/$1/statistics/tx_bytes")
        sleep "$2" 
        R2=$(cat "/sys/class/net/$1/statistics/rx_bytes")
        T2=$(cat "/sys/class/net/$1/statistics/tx_bytes")
        TkbitPS=$(echo "scale=0; ($T2 - $T1) / 1024 * 8 / $2" | bc -l)
        RkbitPS=$(echo "scale=0; ($R2 - $R1) / 1024 * 8 / $2" | bc -l)
#        echo "BW used      -- up $1: $TkbitPS kBit/s; down $1: $RkbitPS kBit/s" 

        # Remaining bandwidth available; cut-off negative values
        Tavail_kbitPS=$(echo "scale=0; if (($3 * 1024 - $TkbitPS) >0) ($3 * 1024 - $TkbitPS) else 0" | bc -l)
        Ravail_kbitPS=$(echo "scale=0; if (($4 * 1024 - $RkbitPS) >0) ($4 * 1024 - $RkbitPS) else 0" | bc -l)
#        echo "BW available -- up $1: $Tavail_kbitPS kBit/s; down $1: $Ravail_kbitPS kBit/s" 
    else                                     # lockfile present
        Tavail_kbitPS=0
        Ravail_kbitPS=0
        sleep "$2" 
    fi

    for bat in /sys/class/net/bat*; do
              iface=${bat##*/}
              batctl -m $iface gw_mode server "${Ravail_kbitPS}kbit/${Tavail_kbitPS}kbit" 
    done
done

Founded errors:

Attached, I have found some Call traces in the kernel logs which may lead into to the above effects.


Files

kern.log.zip (175 KB) kern.log.zip Jan-Tarek Butt, 07/09/2018 01:26 AM
Actions

Also available in: Atom PDF