06 Apr, 2019

1 commit


25 Mar, 2019

2 commits

  • All files got a SPDX-License-Identifier with commit 7db7d9f369a4
    ("batman-adv: Add SPDX license identifier above copyright header"). All the
    required information about the license conditions can be found in
    LICENSES/.

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

    Sven Eckelmann
     
  • When CONFIG_CFG80211 isn't enabled the compiler correcly warns about
    'sinfo.pertid' may be unused. It can also happen for other error
    conditions that it not warn about.

    net/batman-adv/bat_v_elp.c: In function ‘batadv_v_elp_get_throughput.isra.0’:
    include/net/cfg80211.h:6370:13: warning: ‘sinfo.pertid’ may be used
    uninitialized in this function [-Wmaybe-uninitialized]
    kfree(sinfo->pertid);
    ~~~~~^~~~~~~~

    Rework so that we only release '&sinfo' if cfg80211_get_station returns
    zero.

    Fixes: 7d652669b61d ("batman-adv: release station info tidstats")
    Signed-off-by: Anders Roxell
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Anders Roxell
     

09 Feb, 2019

1 commit


25 Jan, 2019

1 commit

  • With the addition of TXQ stats in the per-tid statistics the struct
    station_info grew significantly. This resulted in stack size warnings
    due to the structure itself being above the limit for the warnings.

    To work around this, the TID array was allocated dynamically. Also a
    function to free this content was introduced with commit 7ea3e110f2f8
    ("cfg80211: release station info tidstats where needed") but the necessary
    changes were not provided for batman-adv's B.A.T.M.A.N. V implementation.

    Signed-off-by: Felix Fietkau
    Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info")
    [sven@narfation.org: add commit message]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Felix Fietkau
     

04 Jan, 2019

1 commit


12 Nov, 2018

1 commit

  • The announcement messages of batman-adv COMPAT_VERSION 15 have the
    possibility to announce additional information via a dynamic TVLV part.
    This part is optional for the ELP packets and currently not parsed by the
    Linux implementation. Still out-of-tree versions are using it to transport
    things like neighbor hashes to optimize the rebroadcast behavior.

    Since the ELP broadcast packets are smaller than the minimal ethernet
    packet, it often has to be padded. This is often done (as specified in
    RFC894) with octets of zero and thus work perfectly fine with the TVLV
    part (making it a zero length and thus empty). But not all ethernet
    compatible hardware seems to follow this advice. To avoid ambiguous
    situations when parsing the TVLV header, just force the 4 bytes (TVLV
    length + padding) after the required ELP header to zero.

    Fixes: d6f94d91f766 ("batman-adv: ELP - adding basic infrastructure")
    Reported-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

07 Sep, 2018

1 commit


06 Sep, 2018

1 commit

  • The probe ELPs for WiFi interfaces are expanded to contain at least
    BATADV_ELP_MIN_PROBE_SIZE bytes. This is usually a lot more than the
    number of bytes which the template ELP packet requires.

    These extra padding bytes were not initialized and thus could contain data
    which were previously stored at the same location. It is therefore required
    to set it to some predefined or random values to avoid leaking private
    information from the system transmitting these kind of packets.

    Fixes: e4623c913508 ("batman-adv: Avoid probe ELP information leak")
    Signed-off-by: Sven Eckelmann
    Acked-by: Antonio Quartulli
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

14 May, 2018

1 commit

  • Virtual interface drivers such as tun / tap interfaces, VLAN, etc tend
    to initialize the interface throughput with some value for the sake of
    having a throughput number to export via ethtool. This exported
    throughput leaves batman-adv to conclude the interface throughput is
    genuine (reflecting reality), thus no measurements are necessary.

    Based on the observation that those interface types also tend to set
    the link auto-negotiation to 'off', batman-adv shall check this
    setting to differentiate between genuine link throughput information
    and placeholders installed by virtual interfaces.

    The "default throughput" setting exported via sysfs still allows to
    configure the batman-adv throughput for the interface, thus disabling
    the measurements.

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

    Marek Lindner
     

27 Feb, 2018

1 commit


22 Dec, 2017

1 commit

  • The header file is used by different userspace programs to inject packets
    or to decode sniffed packets. It should therefore be available to them as
    userspace header.

    Also other components in the kernel (like the flow dissector) require
    access to the packet definitions to be able to decode ETH_P_BATMAN ethernet
    packets.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: David S. Miller

    Sven Eckelmann
     

16 Dec, 2017

3 commits

  • The documentation describing kernel-doc comments for functions ("How to
    format kernel-doc comments") uses parentheses at the end of the function
    name. Using this format allows to use a consistent style when adding
    documentation to a function and when referencing this function in a
    different kernel-doc section.

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

    Sven Eckelmann
     
  • The linux/gfp.h provides the GFP_ATOMIC and GFP_KERNEL define. It should
    therefore be included instead of linux/fs.h.

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

    Sven Eckelmann
     
  • The "Linux kernel licensing rules" require that each file has a SPDX
    license identifier as first line (and sometimes as second line).

    The FSFE REUSE practices [1] would also require the same tags but have no
    restrictions on the placement in the source file. Using the "Linux kernel
    licensing rules" is therefore also fulfilling the FSFE REUSE practices
    requirements at the same time.

    [1] https://reuse.software/practices/

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

    Sven Eckelmann
     

28 Sep, 2017

1 commit

  • checkpatch introduced with commit 63b7c73ec86b ("checkpatch: add --strict
    check for ifs with unnecessary parentheses") an additional test which
    identifies some unnecessary parentheses.

    Remove these unnecessary parentheses to avoid the warnings and to unify the
    coding style slightly more.

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

    Sven Eckelmann
     

16 Jun, 2017

1 commit

  • There were many places that my previous spatch didn't find,
    as pointed out by yuan linyu in various patches.

    The following spatch found many more and also removes the
    now unnecessary casts:

    @@
    identifier p, p2;
    expression len;
    expression skb;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_zero(skb, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_zero(skb, len);
    )
    ... when != p
    (
    p2 = (t2)p;
    -memset(p2, 0, len);
    |
    -memset(p, 0, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_zero(skb, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_zero(skb, sizeof(t));
    )
    ... when != p
    (
    p2 = (t2)p;
    -memset(p2, 0, sizeof(*p));
    |
    -memset(p, 0, sizeof(*p));
    )

    @@
    expression skb, len;
    @@
    -memset(skb_put(skb, len), 0, len);
    +skb_put_zero(skb, len);

    Apply it to the tree (with one manual fixup to keep the
    comment in vxlan.c, which spatch removed.)

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

13 Jun, 2017

2 commits

  • The wifi driver can decide to not provide parts of the station info. For
    example, the expected throughput of the station can be omitted when the
    used rate control doesn't provide this kind of information.

    The B.A.T.M.A.N. V implementation must therefore check the filled bitfield
    before it tries to access the expected_throughput of the returned
    station_info.

    Reported-by: Alvaro Antelo
    Fixes: c833484e5f38 ("batman-adv: ELP - compute the metric based on the estimated throughput")
    Signed-off-by: Sven Eckelmann
    Reviewed-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • A wifi interface should never be handled like an ethernet devices. The
    parser of the cfg80211 output must therefore skip the ethtool code when
    cfg80211_get_station returned an error.

    Fixes: f44a3ae9a281 ("batman-adv: refactor wifi interface detection")
    Signed-off-by: Sven Eckelmann
    Reviewed-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

26 Jan, 2017

1 commit


09 Nov, 2016

4 commits

  • Signed-off-by: Marek Lindner
    [sven.eckelmann@open-mesh.com: re-add batadv_get_real_netdev to take rtnl
    semaphore for batadv_get_real_netdevice]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Marek Lindner
     
  • batman-adv is requiring the type of wifi device in different contexts. Some
    of them can take the rtnl semaphore and some of them already have the
    semaphore taken. But even others don't allow that the semaphore will be
    taken.

    The data has to be retrieved when the hardif is added to batman-adv because
    some of the wifi information for an hardif will only be available with rtnl
    lock. It can then be cached in the batadv_hard_iface and the functions
    is_wifi_netdev and is_cfg80211_netdev can just compare the correct bits
    without imposing extra locking requirements.

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

    Sven Eckelmann
     
  • The ELP protocol requires cfg80211 to auto-detect the WiFi througput
    to a given neighbor. Use batadv_is_cfg80211_netdev() to determine
    whether or not an interface is eligible.

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

    Marek Lindner
     
  • Receiving functions in Linux consume the supplied skbuff. Doing the same in
    the batadv_rx_handler functions makes the behavior more similar to the rest
    of the Linux network code.

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

    Sven Eckelmann
     

26 Aug, 2016

1 commit

  • The skb_reserve() call only reserved headroom for the mac header, but
    not the elp packet header itself.

    Fixing this by using skb_put()'ing towards the skb tail instead of
    skb_push()'ing towards the skb head.

    Fixes: d6f94d91f766 ("batman-adv: ELP - adding basic infrastructure")
    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     

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


18 May, 2016

1 commit


29 Feb, 2016

6 commits

  • In case of an unused wireless link, the mac80211 throughput estimation
    won't get updated further. Consequently, the reported throughput metric
    will become obsolete.

    With this patch unicast sampling is introduced by periodically sending
    unicast ELP packets to each neighbor on idle WiFi links. These sampling
    packets will fill an entire frame, so that the measurement is as
    reliable as possible

    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
     
  • To enable ELP to send probing packets over wireless links
    only if needed, batman-adv must keep track of the last time
    it sent a unicast packet towards every neighbour.

    For this purpose a 2 main changes are introduced:
    1) a new member of the elp_neigh_node structure stores the
    last time a unicast packet was sent towards this neighbour;
    2) a wrapper function for sending unicast packets is
    implemented. This function will simply update the member
    describe din point 1) and then forward the packet to the
    real sending routine.

    Point 2) implies that any code-path leading to a unicast
    sending now has to use the new wrapper.

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

    Antonio Quartulli
     
  • Add the support for recognising new originators in the
    network and rebroadcast their OGMs.

    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