24 Aug, 2018

1 commit

  • [ Upstream commit 9713cb0cf19f1cec6c007e3b37be0697042b6720 ]

    A reference for the best gateway is taken when the list of gateways in the
    mesh is sent via netlink. This is necessary to check whether the currently
    dumped entry is the currently selected gateway or not. This information is
    then transferred as flag BATADV_ATTR_FLAG_BEST.

    After the comparison of the current entry is done,
    batadv_v_gw_dump_entry() has to decrease the reference counter again.
    Otherwise the reference will be held and thus prevents a proper shutdown of
    the batman-adv interfaces (and some of the interfaces enslaved in it).

    Fixes: b71bb6f924fe ("batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     

30 May, 2018

1 commit

  • [ Upstream commit 011c935fceae5252619ef730baa610c655281dda ]

    The function batadv_v_gw_dump stops the processing loop when
    batadv_v_gw_dump_entry returns a non-0 return code. This should only
    happen when the buffer is full. Otherwise, an empty message may be
    returned by batadv_gw_dump. This empty message will then stop the netlink
    dumping of gateway entries. At worst, not a single entry is returned to
    userspace even when plenty of possible gateways exist.

    Fixes: b71bb6f924fe ("batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     

23 May, 2017

1 commit


17 Mar, 2017

1 commit


05 Mar, 2017

1 commit

  • The gateway selection class variable is shared between different algorithm
    versions. But the interpretation of the content is algorithm specific. The
    initialization is therefore also algorithm specific.

    But this was implemented incorrectly and the initialization for BATMAN_V
    always overwrote the value previously written for BATMAN_IV. This could
    only be avoided when BATMAN_V was disabled during compile time.

    Using a special batadv_algo hook for this initialization avoids this
    problem.

    Fixes: 50164d8f500f ("batman-adv: B.A.T.M.A.N. V - implement GW selection logic")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

26 Jan, 2017

1 commit


19 Oct, 2016

2 commits


09 Aug, 2016

5 commits

  • The files provided by batman-adv via debugfs are currently converted to
    netlink. Tools which are not yet converted to use the netlink interface may
    still rely on the old debugfs files. But systems which already upgraded
    their tools can save some space by disabling this feature. The default
    configuration of batman-adv on amd64 can reduce the size of the module by
    around 11% when this feature is disabled.

    $ size net/batman-adv/batman-adv.ko*
    text data bss dec hex filename
    150507 10395 4160 165062 284c6 net/batman-adv/batman-adv.ko.y
    137106 7099 2112 146317 23b8d net/batman-adv/batman-adv.ko.n

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • Dump the algo V originators and neighbours.

    Signed-off-by: Matthias Schiffer
    Signed-off-by: Andrew Lunn
    [sven@narfation.org: Fix includes, fix algo_ops integration]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Matthias Schiffer
     
  • Since the GW selection logic has been made routing protocol specific
    it is now possible for B.A.T.M.A.N V to have its own mechanism by
    providing the API implementation.

    Implement the GW specific API in the B.A.T.M.A.N. V protocol in
    order to provide a working GW selection mechanism.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Antonio Quartulli
     
  • The B.A.T.M.A.N. V algorithm uses a different metric compared to its
    predecessor and for this reason the logic used to compute the best
    Gateway is also changed. This means that the GW selection class
    fed to this logic has a semantics that depends on the algorithm being
    used.

    Make the parsing and printing routine of the GW selection class
    routing algorithm specific. Each algorithm can now parse (and print)
    this value independently.

    If no API is provided by any algorithm, the default is to use the
    current mechanism of considering such value like an integer between
    1 and 255.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Antonio Quartulli
     

04 Jul, 2016

1 commit

  • The routing API data structure contains several function
    pointers that can easily be grouped together based on the
    component they work with.

    Split the API in subobjects in order to improve definition readability.

    At the same time, remove the "bat_" prefix from the API object and
    its fields names. These are batman-adv private structs and there is no
    need to always prepend such prefix, which only makes function invocations
    much much longer.

    Signed-off-by: Antonio Quartulli
    Reviewed-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Antonio Quartulli
     

30 Jun, 2016

3 commits

  • The bat_algo.h had some functions declared which were not part of the
    bat_algo.c file. These are instead stored in bat_v.c and bat_iv_ogm.c. The
    declaration should therefore be also in bat_v.h and bat_iv_ogm,h to make
    them easier to find.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The ELP interval and throughput override interface settings are initialized
    with default settings on every time an interface is added to a mesh.
    This patch prevents this behavior by moving the configuration init to the
    interface detection routine which runs only once per interface.

    Signed-off-by: Marek Lindner
    [a@unstable.cc: move initialization to batadv_v_hardif_init]
    Signed-off-by: Antonio Quartulli
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Marek Lindner
     
  • The ogm_emit and ogm_schedule API calls were rather tight to the
    B.A.T.M.A.N. IV logic and therefore rather difficult to use
    with other algorithm implementations.

    Remove such calls and move the surrounding logic into the
    B.A.T.M.A.N. IV specific code.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Antonio Quartulli
     

18 May, 2016

4 commits

  • This fix prevents nodes to wrongly create a 00:00:00:00:00:00 originator
    which can potentially interfere with the rest of the neighbor statistics.

    Fixes: d6f94d91f766 ("batman-adv: ELP - adding basic infrastructure")
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Marek Lindner
     
  • When the MAC address of the primary interface is changed,
    update the originator address in the ELP and OGM skb buffers as
    well in order to reflect the change.

    Fixes: d6f94d91f766 ("batman-adv: ELP - adding basic infrastructure")
    Reported-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Antonio Quartulli
     
  • The functions batadv_neigh_ifinfo_get increase the reference counter of the
    batadv_neigh_ifinfo. These have to be reduced again when the reference is
    not used anymore to correctly free the objects.

    Fixes: 9786906022eb ("batman-adv: B.A.T.M.A.N. V - implement neighbor comparison API calls")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     
  • batadv_neigh_ifinfo_get can return NULL when it cannot find (even when only
    temporarily) anymore the neigh_ifinfo in the list neigh->ifinfo_list. This
    has to be checked to avoid kernel Oopses when the ifinfo is dereferenced.

    This a situation which isn't expected but is already handled by functions
    like batadv_v_neigh_cmp. The same kind of warning is therefore used before
    the function returns without dereferencing the pointers.

    Fixes: 9786906022eb ("batman-adv: B.A.T.M.A.N. V - implement neighbor comparison API calls")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

05 May, 2016

1 commit


04 May, 2016

1 commit

  • Use a static string when showing table headers rather then
    a nonsense parametric one with fixed arguments.

    It is easier to grep and it does not need to be recomputed
    at runtime each time.

    Reported-by: Joe Perches
    Signed-off-by: Antonio Quartulli
    [sven@narfation.org: fix conflicts with current version]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     

29 Apr, 2016

1 commit

  • At the moment there is no explicit reactivation of an hard-interface
    upon NETDEV_UP event. In case of B.A.T.M.A.N. IV the interface is
    reactivated as soon as the next OGM is scheduled for sending, but this
    mechanism does not work with B.A.T.M.A.N. V. The latter does not rely
    on the same scheduling mechanism as its predecessor and for this reason
    the hard-interface remains deactivated forever after being brought down
    once.

    This patch fixes the reactivation mechanism by adding a new routing API
    which explicitly allows each algorithm to perform any needed operation
    upon interface re-activation.

    Such API is optional and is implemented by B.A.T.M.A.N. V only and it
    just takes care of setting the iface status to ACTIVE

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     

29 Feb, 2016

8 commits

  • Lists all neighbours detected by the Echo Locating Protocol
    (ELP) and their throughput metric.

    Initially Developed by Linus during a 6 months trainee study
    period in Ascom (Switzerland) AG.

    Signed-off-by: Linus Luessing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Luessing
     
  • Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • In case of wireless interface retrieve the throughput by
    querying cfg80211. To perform this call a separate work
    must be scheduled because the function may sleep and this
    is not allowed within an RCU protected context (RCU in this
    case is used to iterate over all the neighbours).

    Use ethtool to retrieve information about an Ethernet link
    like HALF/FULL_DUPLEX and advertised bandwidth (e.g.
    100/10Mbps).

    The metric is updated each time a new ELP packet is sent,
    this way it is possible to timely react to a metric
    variation which can imply (for example) a neighbour
    disconnection.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • This attribute is exported to user space to disable the link
    throughput auto-detection by setting a fixed value.
    The throughput override value is used when batman-adv is
    computing the link throughput towards a neighbour.

    If the value is set to 0 then batman-adv will try to detect
    the throughput by itself.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • This is the initial implementation of the new OGM protocol
    (version 2). It has been designed to work on top of the
    newly added ELP.

    In the previous version the OGM protocol was used to both
    measure link qualities and flood the network with the metric
    information. In this version the protocol is in charge of
    the latter task only, leaving the former to ELP.

    This means being able to decouple the interval used by the
    neighbor discovery from the OGM broadcasting, which revealed
    to be costly in dense networks and needed to be relaxed so
    leading to a less responsive routing protocol.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • Initially developed by Linus during a 6 months trainee study
    period in Ascom (Switzerland) AG.

    Signed-off-by: Linus Luessing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Luessing
     
  • The B.A.T.M.A.N. protocol originally only used a single
    message type (called OGM) to determine the link qualities to
    the direct neighbors and spreading these link quality
    information through the whole mesh. This procedure is
    summarized on the BATMAN concept page and explained in
    details in the RFC draft published in 2008.

    This approach was chosen for its simplicity during the
    protocol design phase and the implementation. However, it
    also bears some drawbacks:

    * Wireless interfaces usually come with some packet loss,
    therefore a higher broadcast rate is desirable to allow
    a fast reaction on flaky connections.
    Other interfaces of the same host might be connected to
    Ethernet LANs / VPNs / etc which rarely exhibit packet
    loss would benefit from a lower broadcast rate to reduce
    overhead.
    * It generally is more desirable to detect local link
    quality changes at a faster rate than propagating all
    these changes through the entire mesh (the far end of
    the mesh does not need to care about local link quality
    changes that much). Other optimizations strategies, like
    reducing overhead, might be possible if OGMs weren't
    used for all tasks in the mesh at the same time.

    As a result detecting local link qualities shall be handled
    by an independent message type, ELP, whereas the OGM message
    type remains responsible for flooding the mesh with these
    link quality information and determining the overall path
    transmit qualities.

    Developed by Linus during a 6 months trainee study period in
    Ascom (Switzerland) AG.

    Signed-off-by: Linus Luessing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Luessing