10 Jun, 2013

3 commits

  • The bridge loop avoidance has a hook to handle address updates of the
    originator. These should not be handled when bridge loop avoidance is
    disabled - it might send some bridge loop avoidance packets which should
    not appear if bla is disabled.

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

    Simon Wunderlich
     
  • When a packet is received from another node first and later from the
    best next hop, this packet is dropped. However the first OGM was sent
    with the BATADV_NOT_BEST_NEXT_HOP flag and thus dropped by neighbors.
    The late OGM from the best neighbor is then dropped because it is a
    duplicate.

    If this situation happens constantly, a node might end up not forwarding
    the "valid" OGMs anymore, and nodes behind will starve from not getting
    valid OGMs.

    Fix this by refining the duplicate checking behaviour: The actions
    should depend on whether it was a duplicate for a neighbor only or for
    the originator. OGMs which are not duplicates for a specific neighbor
    will now be considered in batadv_iv_ogm_forward(), but only actually
    forwarded for the best next hop. Therefore, late OGMs from the best
    next hop are forwarded now and not dropped as duplicates anymore.

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

    Simon Wunderlich
     
  • The rtnl_lock in batadv_store_mesh_iface has been converted to a rtnl_trylock
    some time ago to avoid a possible deadlock between rtnl and s_active on removal
    of the sysfs nodes.

    The behaviour introduced by that was quite confusing as it could lead to the
    sysfs store to fail, making batman-adv setup scripts unreliable. As recently the
    sysfs removal was postponed to a worker not running with the rtnl taken, the
    deadlock can't occur any more and it is safe to change the trylock back to a
    lock to make the sysfs store reliable again.

    Signed-off-by: Matthias Schiffer
    Reviewed-by: Simon Wunderlich
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Matthias Schiffer
     

22 May, 2013

1 commit

  • On errors in batadv_mesh_init(), bat_counters will be freed in both
    batadv_mesh_free() and batadv_softif_init_late(). This patch fixes this
    by returning earlier from batadv_softif_init_late() in case of errors in
    batadv_mesh_init() and by setting bat_counters to NULL after freeing.

    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     

17 May, 2013

1 commit

  • rcu_barrier() only waits for the currently scheduled rcu functions
    to finish - it won't wait for any function scheduled via another
    call_rcu() within an rcu scheduled function.

    Unfortunately our batadv_tt_orig_list_entry_free_ref() does just that,
    via a batadv_orig_node_free_ref() call, leading to our rcu_barrier()
    call potentially missing such a batadv_orig_node_free_ref().

    This patch fixes this issue by calling the batadv_orig_node_free_rcu()
    directly from the rcu callback, removing the unnecessary, additional
    call_rcu() layer here.

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

    Linus Lüssing
     

09 May, 2013

4 commits


30 Apr, 2013

1 commit


23 Apr, 2013

2 commits

  • batadv_mesh_free() schedules some RCU callbacks which need the bat_priv struct
    to do their jobs, while free_netdev(), which is called immediately after, is
    destroying the private data.

    Put an rcu_barrier() in the middle so that free_netdev() is invoked only after
    all the callbacks returned.

    This bug has been introduced by ab8f433dd39be94e8617cff2dfe9f7eca162eb15
    ("batman-adv: Move deinitialization of soft-interface to destructor")

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner
    Signed-off-by: David S. Miller

    Antonio Quartulli
     
  • Conflicts:
    drivers/net/ethernet/emulex/benet/be_main.c
    drivers/net/ethernet/intel/igb/igb_main.c
    drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
    include/net/scm.h
    net/batman-adv/routing.c
    net/ipv4/tcp_input.c

    The e{uid,gid} --> {uid,gid} credentials fix conflicted with the
    cleanup in net-next to now pass cred structs around.

    The be2net driver had a bug fix in 'net' that overlapped with the VLAN
    interface changes by Patrick McHardy in net-next.

    An IGB conflict existed because in 'net' the build_skb() support was
    reverted, and in 'net-next' there was a comment style fix within that
    code.

    Several batman-adv conflicts were resolved by making sure that all
    calls to batadv_is_my_mac() are changed to have a new bat_priv first
    argument.

    Eric Dumazet's TS ECR fix in TCP in 'net' conflicted with the F-RTO
    rewrite in 'net-next', mostly overlapping changes.

    Thanks to Stephen Rothwell and Antonio Quartulli for help with several
    of these merge resolutions.

    Signed-off-by: David S. Miller

    David S. Miller
     

22 Apr, 2013

1 commit

  • Unicast packet might be of type either UNICAST or
    UNICAST4ADDR.
    In the two cases the header size is different, but the
    mechanism checking the TTVN field was assuming it to be
    always of the same type (UNICAST), so failing to access the
    inner Ethernet header in case of UNICAST4ADDR.

    Fix this by passing the real header length as argument.

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

    Antonio Quartulli
     

20 Apr, 2013

1 commit


18 Apr, 2013

1 commit


27 Mar, 2013

11 commits

  • As reported by checkpatch, seq_puts has to be preferred with
    respect to seq_printf when the format is a constant string
    (no va_args)

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

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

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

    Simon Wunderlich
     
  • When adding a new hard interface (e.g. wlan0) to a soft interface (e.g. bat0)
    and the former is already enslaved in another virtual interface (e.g. a software
    bridge) batman-adv has to free it first and then continue with the adding
    mechanism.

    In this way the behaviour becomes consistent with what "ip link set master"
    does. At the moment batman-adv enslaves the hard interface without checking for
    the master device, possibly causing strange behaviours which are never wanted by
    the users.

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

    Antonio Quartulli
     
  • The sysfs configuration interface of batman-adv to add/remove slaves of an
    soft-iface is not deadlock free and doesn't follow the currently common way to
    modify slaves of an interface.

    An additional configuration interface though rtnl_link is introduced which
    provides easy device adding/removing with tools like "ip":
    $ ip link set dev eth0 master bat0
    $ ip link set dev eth0 nomaster

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

    Sven Eckelmann
     
  • The sysfs configuration interface of batman-adv to add/remove soft-interfaces
    is not deadlock free and doesn't follow the currently common way to create new
    virtual interfaces.

    An additional interface though rtnl_link is introduced which provides easy device
    creation/deletion with tools like "ip":

    $ ip link add dev bat0 type batadv
    $ ip link del dev bat0

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

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

    Marek Lindner
     
  • batman-adv has an unusual way to manage softinterfaces. These will be created
    automatically when a user writes to the batman-adv/mesh_iface file in sysfs and
    removed when no slave device exists anymore.

    This behaviour cannot be changed without breaking compatibility with existing
    code. Instead other interfaces should be able to slightly reduce this behaviour
    and provide a more common reaction to a removal of a slave interface.

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

    Sven Eckelmann
     
  • The deinitialization of the soft-interface created in ndo_init/constructor
    should be done in the destructor and not directly before calling
    unregister_netdevice

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

    Sven Eckelmann
     
  • The initialization of an net_device object should be done in the
    init/constructor function and not from the outside after the register_netdevice
    was done to avoid race conditions.

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

    Sven Eckelmann
     
  • Add a htonl() in network_coding.c when reading the sequence number
    from received ogm_packet, to avoid wrong byte ordering when comparing
    with a host value. This bug was introduced in
    3ed7ada3f0bbcd058567bc0a8f9729a73eba7db6 ("batman-adv: network coding -
    detect coding nodes and remove these after timeout").

    Change the type of coded_packet->coded_len from uint16 to __be16 to
    avoid wrong assumptions about endianness in later uses. Introduced in
    c3289f3650d34b60296000a629c99f2488f7c3dd ("batman-adv: network coding -
    code and transmit packets if possible").

    Reported-by: Fengguang Wu
    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     

14 Mar, 2013

9 commits

  • When receiving a network coded packet, the decoding buffer is searched
    for a packet to use for decoding. The source, destination, and crc32 from
    the coded packet is used to identify the wanted packet. The decoded
    packet is passed to the usual unicast receiver function, as had it never
    been network coded.

    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     
  • To be able to decode a network coded packet, a node must already know
    one of the two coded packets. This is done by buffering skbs before
    transmission and buffering packets sniffed with promiscuous mode from
    other hosts.

    Packets are kept in a buffer similar to the one with forward-skbs: A
    hash table, where each entry, which corresponds to a src-dst pair, has a
    linked list packets.

    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     
  • Before adding forward-skbs to the coding buffer, the buffer is searched
    for a potential coding opportunity. If one is found, the two packets are
    network coded and transmitted right away. If not, the forward-skb is
    added to the buffer.

    Network coded packets are transmitted with information about the two
    receivers and the two coded packets. The first receiver is given by the
    MAC header, while the second is given in the payload/bat-header. The
    second receiver uses promiscuous mode to receive the packet and check
    the second destination.

    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     
  • Two be able to network code two packets, one packet must be buffered
    until the next is available. This is done in a "coding buffer", which is
    essentially a hash table with lists of packets. Each entry in the hash
    table corresponds to a specific src-dst pair, which has a linked list of
    packets that are buffered.

    This patch adds skbs to the buffer just before forwarding them. The
    buffer is traversed every 10 ms, where timed skbs are removed from the
    buffer and transmitted. To allow experiments with the network coding
    scheme, the timeout is tunable through a file in debugfs.

    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     
  • To use network coding efficiently, a relay must know when neighbor nodes
    are likely to have enough information to be able to decode a network
    coded packet. This is detected by using OGMs from batman-adv to discover
    when one neighbor is in range of another neighbor. The relay check the
    TLL to detect when an OGM is forwarded from one neighbor by another
    neighbor, and thereby knows that the two neighbors are in range and thus
    overhear packets sent by each other.

    This information is saved in the orig_node struct to be used when
    searching for coding opportunities. Two lists are added to the
    orig_node struct: One for neighbors that can hear the orig_node
    (outgoing nc_nodes) and one for neighbors that the orig_node can hear
    (incoming nc_nodes).

    Information about nc_nodes is kept for 10 seconds and is available
    through debugfs in batman_adv/nc_nodes to use when debugging network
    coding.

    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     
  • Network coding exploits the 802.11 shared medium to allow multiple
    packets to be sent in a single transmission. In brief, a relay can XOR
    two packets, and send the coded packet to two destinations. The
    receivers can decode one of the original packets by XOR'ing the coded
    packet with the other original packet. This will lead to increased
    throughput in topologies where two packets cross one relay.

    In a simple topology with three nodes, it takes four transmissions
    without network coding to get one packet from Node A to Node B and one
    from Node B to Node A:

    1. Node A ---- p1 ---> Node R Node B
    2. Node A Node R Node B

    With network coding, the relay only needs one transmission, which saves
    us one slot of valuable airtime:

    1. Node A ---- p1 ---> Node R Node B
    2. Node A Node R Node B

    The same principle holds for a topology including five nodes. Here the
    packets from Node A and Node B are overheard by Node C and Node D,
    respectively. This allows Node R to send a network coded packet to save
    one transmission:

    Node A Node B

    | \ / |
    | p1 p2 |
    | \ / |
    p1 > Node R < p2
    | |
    | / \ |
    | p1 x p2 p1 x p2 |
    v / \ v
    / \
    Node C < > Node D

    More information is available on the open-mesh.org wiki[1].

    This patch adds the initial code to support network coding in
    batman-adv. It sets up a worker thread to do house keeping and adds a
    sysfs file to enable/disable network coding. The feature is disabled by
    default, as it requires a wifi-driver with working promiscuous mode, and
    also because it adds a small delay at each hop.

    [1] http://www.open-mesh.org/projects/batman-adv/wiki/Catwoman

    Signed-off-by: Martin Hundebøll
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     
  • In C standard any expression different from 0 will be converted to
    'true' when casting to bool (whatever is the length of the value).
    Therefore all the "!!" conversions can be removed.

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

    Antonio Quartulli
     
  • batadv_check_unicast_packet() is changed to return a value based on the
    reason to drop the packet, which will be useful information for
    future users of batadv_check_unicast_packet().

    Signed-off-by: Martin Hundebøll
    Acked-by: Antonio Quartulli
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Martin Hundebøll
     
  • The batadv_priv struct carries a pointer to its own interface
    struct. Therefore, it is not necessary to retrieve the soft_iface
    via the primary interface.

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

    Marek Lindner
     

12 Mar, 2013

1 commit


28 Feb, 2013

1 commit

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

19 Feb, 2013

1 commit


14 Feb, 2013

1 commit

  • An entry in DAT with the hashed position of 0 can cause a NULL pointer
    dereference when the first entry is checked by batadv_choose_next_candidate.
    This first candidate automatically has the max value of 0 and the max_orig_node
    of NULL. Not checking max_orig_node for NULL in batadv_is_orig_node_eligible
    will lead to a NULL pointer dereference when checking for the lowest address.

    This problem was added in 785ea1144182c341b8b85b0f8180291839d176a8
    ("batman-adv: Distributed ARP Table - create DHT helper functions").

    Signed-off-by: Pau Koning
    Signed-off-by: David S. Miller

    Pau Koning
     

30 Jan, 2013

1 commit