22 Mar, 2014

16 commits

  • Signed-off-by: Simon Wunderlich
    Signed-off-by: Antonio Quartulli

    Simon Wunderlich
     
  • Add missing documentation for BATADV_DAT_ADDR_MAX and
    convert an existing documentation to kerneldoc

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

    Antonio Quartulli
     
  • Convert the current documentation for the TT flags in proper
    kerneldoc and improve it by adding an explanation for each
    of the flags.

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

    Antonio Quartulli
     
  • With this patch a node sends IPv4 multicast packets to nodes which
    have a BATADV_MCAST_WANT_ALL_IPV4 flag set and IPv6 multicast packets
    to nodes which have a BATADV_MCAST_WANT_ALL_IPV6 flag set, too.

    Why is this needed? There are scenarios involving bridges where
    multicast report snooping and multicast TT announcements are not
    sufficient, which would lead to packet loss for some nodes otherwise:

    MLDv1 and IGMPv1/IGMPv2 have a suppression mechanism
    for multicast listener reports. When we have an MLDv1/IGMPv1/IGMPv2
    querier behind a bridge then our snooping bridge is potentially not
    going to see any reports even though listeners exist because according
    to RFC4541 such reports are only forwarded to multicast routers:

    -----------------------------------------------------------
    ---------------
    {Querier}---|Snoop. Switch|----{Listener}
    ---------------
    \ ^
    -------
    | br0 | < ???
    -------
    \
    _-~---~_
    _-~/ ~-_
    ~ batman-adv \-----{Sender}
    \~_ cloud ~/
    -~~__-__-~_/

    I) MLDv1 Query: {Querier} -> flooded
    II) MLDv1 Report: {Listener} -> {Querier}

    -> br0 cannot detect the {Listener}
    => Packets from {Sender} need to be forwarded to all
    detected listeners and MLDv1/IGMPv1/IGMPv2 queriers.

    -----------------------------------------------------------

    Note that we do not need to explicitly forward to MLDv2/IGMPv3 queriers,
    because these protocols have no report suppression: A bridge has no
    trouble detecting MLDv2/IGMPv3 listeners.

    Even though we do not support bridges yet we need to provide the
    according infrastructure already to not break compatibility later.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     
  • With this patch a node may additionally perform the dropping or
    unicasting behaviour for a link-local IPv4 and link-local-all-nodes
    IPv6 multicast packet, too.

    The extra counter and BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag is needed
    because with a future bridge snooping support integration a node with a
    bridge on top of its soft interface is not able to reliably detect its
    multicast listeners for IPv4 link-local and the IPv6
    link-local-all-nodes addresses anymore (see RFC4541, section 2.1.2.2
    and section 3).

    Even though this new flag does make "no difference" now, it'll ensure
    a seamless integration of multicast bridge support without needing to
    break compatibility later.

    Also note, that even with multicast bridge support it won't be possible
    to optimize 224.0.0.x and ff02::1 towards nodes with bridges, they will
    always receive these ranges.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     
  • With this patch a multicast packet is not always simply flooded anymore,
    the behaviour for the following cases is changed to reduce
    unnecessary overhead:

    If all nodes within the horizon of a certain node have signalized
    multicast listener announcement capability then an IPv6 multicast packet
    with a destination of IPv6 link-local scope (excluding ff02::1) coming
    from the upstream of this node...

    * ...is dropped if there is no according multicast listener in the
    translation table,
    * ...is forwarded via unicast if there is a single node with interested
    multicast listeners
    * ...and otherwise still gets flooded.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     
  • If the soft interface of a node is not part of a bridge then a node
    announces a new multicast TVLV: The existence of this TVLV
    signalizes that this node is announcing all of its multicast listeners
    via the translation table infrastructure.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     
  • The new bitfield allows us to keep track whether capability subsets of
    an originator have gone through their initialization phase yet.

    The translation table is the only user right now, but a new one will be
    added soon.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     
  • With this patch a node which has no bridge interface on top of its soft
    interface announces its local multicast listeners via the translation
    table.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     
  • Some helper functions used along the TX path have now a new
    "dst_hint" argument but the kerneldoc was missing.

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

    Antonio Quartulli
     
  • Reported-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Marek Lindner
     
  • Reported-by: Antonio Quartulli
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Simon Wunderlich
     
  • On some architectures ether_addr_copy() is slightly faster
    than memcpy() therefore use the former when possible.

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

    Antonio Quartulli
     
  • Our .ndo_start_xmit handler (batadv_interface_tx()) can rely on having
    the skb mac header pointer set correctly since the following commit
    present in kernels >= 3.9:

    "net: reset mac header in dev_start_xmit()" (6d1ccff627)

    Therefore this commit removes the according, now redundant,
    skb_reset_mac_header() call in batadv_bla_tx().

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     
  • Our .ndo_start_xmit handler (batadv_interface_tx()) can rely on having
    the skb mac header pointer set correctly since the following commit
    present in kernels >= 3.9:

    "net: reset mac header in dev_start_xmit()" (6d1ccff627)

    Therefore we can safely use eth_hdr() and vlan_eth_hdr() instead of
    skb->data now, which spares us some ugly type casts.

    At the same time set the mac_header in batadv_dat_snoop_incoming_arp_request()
    before sending the skb along the TX path.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     
  • net/batman-adv/network-coding.c:1535:1-7: Replace memcpy with struct assignment

    Generated by: coccinelle/misc/memcpy-assign.cocci
    Signed-off-by: Fengguang Wu
    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Fengguang Wu
     

19 Feb, 2014

1 commit


18 Feb, 2014

10 commits

  • batadv_send_skb_prepare_unicast(_4addr) might reallocate the
    skb's data. If it does then our ethhdr pointer is not valid
    anymore in batadv_send_skb_unicast(), resulting in a kernel
    paging error.

    Fixing this by refetching the ethhdr pointer after the
    potential reallocation.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Antonio Quartulli

    Antonio Quartulli
     
  • In the failure path of the orig_node initialization routine
    the orig_node->bat_iv.bcast_own field is free'd twice: first
    in batadv_iv_ogm_orig_get() and then later in
    batadv_orig_node_free_rcu().

    Fix it by removing the kfree in batadv_iv_ogm_orig_get().

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

    Antonio Quartulli
     
  • When the TVLV parsing routine succeed the skb is left
    untouched thus leading to a memory leak.

    Fix this by consuming the skb in case of success.

    Introduced by ef26157747d42254453f6b3ac2bd8bd3c53339c3
    ("batman-adv: tvlv - basic infrastructure")

    Reported-by: Russel Senior
    Signed-off-by: Antonio Quartulli
    Tested-by: Russell Senior
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • When computing the CRC on a 2byte variable the order of
    the bytes obviously alters the final result. This means
    that computing the CRC over the same value on two archs
    having different endianess leads to different numbers.

    The global and local translation table CRC computation
    routine makes this mistake while processing the clients
    VIDs. The result is a continuous CRC mismatching between
    nodes having different endianess.

    Fix this by converting the VID to Network Order before
    processing it. This guarantees that every node uses the same
    byte order.

    Introduced by 7ea7b4a142758deaf46c1af0ca9ceca6dd55138b
    ("batman-adv: make the TT CRC logic VLAN specific")

    Reported-by: Russel Senior
    Signed-off-by: Antonio Quartulli
    Tested-by: Russell Senior
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • Since batadv_orig_node_new() sets the refcount to two, assuming that
    the calling function will use a reference for putting the orig_node into
    a hash or similar, both references must be freed if initialization of
    the orig_node fails. Otherwise that object may be leaked in that error
    case.

    Reported-by: Antonio Quartulli
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Simon Wunderlich
     
  • When adding a new neighbour it is important to atomically
    perform the following:
    - check if the neighbour already exists
    - append the neighbour to the proper list

    If the two operations are not performed in an atomic context
    it is possible that two concurrent insertions add the same
    neighbour twice.

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

    Antonio Quartulli
     
  • pskb_may_pull() returns 1 on success and 0 in case of failure,
    therefore checking for the return value being negative does
    not make sense at all.

    This way if the function fails we will probably read beyond the current
    skb data buffer. Fix this by doing the proper check.

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

    Antonio Quartulli
     
  • There is a refcounter unbalance in the CRC checking routine
    invoked on OGM reception. A vlan object is retrieved (thus
    its refcounter is increased by one) but it is never properly
    released. This leads to a memleak because the vlan object
    will never be free'd.

    Fix this by releasing the vlan object after having read the
    CRC.

    Reported-by: Russell Senior
    Reported-by: Daniel
    Reported-by: cmsv
    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • When accessing a TT-TVLV container in the OGM RX path
    the variable pointing to the list of changes to apply is
    altered by mistake.

    This makes the TT component read data at the wrong position
    in the OGM packet buffer.

    Fix it by removing the bogus pointer alteration.

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

    Antonio Quartulli
     
  • The current MTU computation always returns a value
    smaller than 1500bytes even if the real interfaces
    have an MTU large enough to compensate the batman-adv
    overhead.

    Fix the computation by properly returning the highest
    admitted value.

    Introduced by a19d3d85e1b854e4a483a55d740a42458085560d
    ("batman-adv: limit local translation table max size")

    Reported-by: Russell Senior
    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     

14 Feb, 2014

1 commit

  • One of my pet coding style peeves is the practice of
    adding extra return; at the end of function.
    Kill several instances of this in network code.

    I suppose some coccinelle wizardy could do this automatically.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

18 Jan, 2014

1 commit


17 Jan, 2014

1 commit


16 Jan, 2014

3 commits


15 Jan, 2014

1 commit

  • The following call chains indicate that batadv_is_on_batman_iface()
    is always under rtnl_lock protection as call_netdevice_notifier()
    is protected by rtnl_lock. So if __dev_get_by_index() rather than
    dev_get_by_index() is used to find interface handler in it, this
    would help us avoid to change interface reference counter.

    call_netdevice_notifier()
    batadv_hard_if_event()
    batadv_hardif_add_interface()
    batadv_is_valid_iface()
    batadv_is_on_batman_iface()

    Cc: Antonio Quartulli
    Signed-off-by: Ying Xue
    Acked-by: Antonio Quartulli
    Signed-off-by: David S. Miller

    Ying Xue
     

12 Jan, 2014

6 commits