09 Aug, 2016

40 commits

  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

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

    Sven Eckelmann
     
  • Set the netnsof flag on the family structure, indicating it can
    be used with different network name spaces.

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

    Andrew Lunn
     
  • Dump the list of bridge loop avoidance backbones via the netlink socket.

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

    Simon Wunderlich
     
  • The bridge loop avoidange is the main information for the debugging of of
    bridge loop detection problems. It is therefore necessary when comparing
    the bla claim tables.

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

    Sven Eckelmann
     
  • Dump the list of bridge loop avoidance claims via the netlink socket.

    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: add policy for attributes, fix includes, fix
    soft_iface reference leak]
    Signed-off-by: Sven Eckelmann
    [sw@simonwunderlich.de: fix kerneldoc, fix error reporting]
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

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

    Sven Eckelmann
     
  • Dump the list of gateways via the netlink socket.

    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: integrate in batadv_algo_ops]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Andrew Lunn
     
  • Add BATADV_CMD_GET_GATEWAYS commands, using handlers bat_gw_dump in
    batadv_algo_ops. Will always return -EOPNOTSUPP for now, as no
    implementations exist yet.

    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
     
  • Signed-off-by: Matthias Schiffer
    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: Fix function parameter alignments,
    add policy for attributes, fix includes, fix algo_ops integration]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Matthias Schiffer
     
  • Add BATADV_CMD_GET_ORIGINATORS and BATADV_CMD_GET_NEIGHBORS commands,
    using handlers bat_orig_dump and bat_neigh_dump in batadv_algo_ops. Will
    always return -EOPNOTSUPP for now, as no implementations exist yet.

    Signed-off-by: Matthias Schiffer
    Signed-off-by: Andrew Lunn
    [sven@narfation.org: Rewrite based on new algo_ops structures]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Matthias Schiffer
     
  • The TTVN is the main information for the debugging of translation table
    problems. It is therefore necessary when comparing the global translation
    tables.

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

    Sven Eckelmann
     
  • This adds the commands BATADV_CMD_GET_TRANSTABLE_LOCAL and
    BATADV_CMD_GET_TRANSTABLE_GLOBAL, which correspond to the transtable_local
    and transtable_global debugfs files.

    The batadv_tt_client_flags enum is moved to the UAPI to expose it as part
    of the netlink API.

    Signed-off-by: Matthias Schiffer
    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: add policy for attributes, fix includes]
    Signed-off-by: Sven Eckelmann
    [sw@simonwunderlich.de: fix VID attributes content]
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Matthias Schiffer
     
  • BATADV_CMD_GET_HARDIFS will return the list of hardifs (including index,
    name and MAC address) of all hardifs for a given softif.

    Signed-off-by: Matthias Schiffer
    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: Reduce the number of changes to
    BATADV_CMD_GET_HARDIFS, add policy for attributes]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Matthias Schiffer
     
  • BATADV_CMD_GET_ROUTING_ALGOS is used to get the list of supported routing
    algorithms.

    Signed-off-by: Matthias Schiffer
    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: Reduce the number of changes to
    BATADV_CMD_GET_ROUTING_ALGOS, fix includes]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Matthias Schiffer
     
  • Debugfs is not netns aware. It thus has problems when the same
    interface name exists in multiple network name spaces.

    Work around this by not creating entries for interfaces in name spaces
    other than the default name space. This means meshes in network
    namespaces cannot be managed via debugfs, but there will soon be a
    netlink interface which is netns aware.

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

    Andrew Lunn
     
  • batman-adv tries to prevent the user from placing a batX soft
    interface into another batman mesh as a hard interface. It does this
    by walking up the devices list of parents and ensures they are all
    none batX interfaces. iflink can point to an interface in a different
    namespace, so also retrieve the parents name space when finding the
    parent and use it when doing the comparison.

    Signed-off-by: Andrew Lunn
    [sven@narfation.org: Fix alignments, simplify parent netns retrieval]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Andrew Lunn
     
  • The debug messages of _batadv_update_route were printed before the actual
    route change is done. At this point it is not really known which
    curr_router will be replaced. Thus the messages could print the wrong
    operation.

    Printing the debug messages after the operation was done avoids this
    problem.

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

    Sven Eckelmann
     
  • This silences the following coccinelle warning:

    "WARNING: sum of probable bitmasks, consider |"

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     
  • The function batadv_send_skb_unicast is not acquiring a reference for an
    orig_node nor removing it from any datastructure. It still reduces the
    reference counter for an object which is still in the hands of the caller.

    This is confusing and can lead in the future to problems in the reference
    handling of the caller function.

    Signed-off-by: Sven Eckelmann
    Acked-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The translation table (global, local) is usually the part of batman-adv
    which has the most dynamical allocated objects. Most of them
    (tt_local_entry, tt_global_entry, tt_orig_list_entry, tt_change_node,
    tt_req_node, tt_roam_node) are equally sized. So it makes sense to have
    them allocated from a kmem_cache for each type.

    This approach allowed a small wireless router (TP-Link TL-841NDv8; SLUB
    allocator) to store 34% more translation table entries compared to the
    current implementation.

    [1] https://open-mesh.org/projects/batman-adv/wiki/Kmalloc-kmem-cache-tests

    Reported-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • This patch abstracts the forward packet creation into the new function
    batadv_forw_packet_alloc().

    The queue counting and interface reference counters are now handled
    internally within batadv_forw_packet_alloc() and its
    batadv_forw_packet_free() counterpart. This should reduce the risk of
    having reference/queue counting bugs again and should increase
    code readibility.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     
  • net/batman-adv/bridge_loop_avoidance.c:1105:9-10: WARNING: return of 0/1 in function 'batadv_bla_process_claim' with return type bool

    Return statements in functions returning bool should use
    true/false instead of 1/0.
    Generated by: scripts/coccinelle/misc/boolreturn.cocci

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

    kbuild test robot
     
  • The difference between tq1 and tq2 are calculated the same way in two
    separate functions.

    This patch moves the common code to a separate function
    'batadv_iv_ogm_neigh_diff' which handles everything necessary. The other
    two functions can then handle errors and use the difference directly.

    Signed-off-by: Markus Pargmann
    [sven@narfation.org: rebased on current version, initialize return variable
    in batadv_iv_ogm_neigh_diff, add kerneldoc, convert to bool return type]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Markus Pargmann
     
  • Now that the GW-mode code is algorithm specific, batman-adv expects the
    routing algorithm to implement some APIs to make it work.

    However, such APIs are not mandatory, therefore we might have algorithms
    not providing them. In this case all the sysfs knobs related to GW-mode
    should be deactivated to make sure that settings injected by the user
    for this feature are rejected.

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

    Antonio Quartulli
     
  • 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
     
  • Each routing protocol may have its own specific logic about
    gateway election which is potentially based on the metric being
    used.

    Create two GW specific API functions and move the current election
    logic in the B.A.T.M.A.N. IV specific code.

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

    Antonio Quartulli