13 Dec, 2018

1 commit

  • [ Upstream commit f4156f9656feac21f4de712fac94fae964c5d402 ]

    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
    Signed-off-by: Sasha Levin

    Sven Eckelmann
     

20 Oct, 2018

2 commits

  • [ Upstream commit 4c4af6900844ab04c9434c972021d7b48610e06a ]

    The hardif_neigh refcounter is to be decreased by the queued work and
    currently is never decreased if the queue_work() call fails.
    Fix by checking the queue_work() return value and decrease refcount
    if necessary.

    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Marek Lindner
     
  • [ Upstream commit 88d0895d0ea9d4431507d576c963f2ff9918144d ]

    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
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    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