25 May, 2019

1 commit

  • While it can be slightly beneficial for the build performance to use
    forward declarations instead of includes, the handling of them together
    with changes in the included headers makes it unnecessary complicated and
    fragile. Just replace them with actual includes since some parts (hwmon,
    ..) of the kernel even request avoidance of forward declarations and net/
    is mostly not using them in *.c file.

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

    Sven Eckelmann
     

25 Mar, 2019

1 commit

  • 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
     

04 Jan, 2019

1 commit


15 Sep, 2018

1 commit

  • B.A.T.M.A.N. IV requires the number of rebroadcast from a neighboring
    originator. These statistics are gathered per interface which transmitted
    the OGM (and then received it again). Since an originator is not interface
    specific, a resizable array was used in each originator.

    This resizable array had an entry for each interface and had to be resizes
    (for all OGMs) when the number of active interface was modified. This could
    cause problems when a large number of interface is added and not enough
    continuous memory is available to allocate the array.

    There is already a per interface originator structure "batadv_orig_ifinfo"
    which can be used to store this information.

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

    Sven Eckelmann
     

06 Mar, 2018

1 commit


27 Feb, 2018

1 commit


26 Feb, 2018

1 commit

  • batman-adv uses internal indices for each enabled and active interface.
    It is currently used by the B.A.T.M.A.N. IV algorithm to identifify the
    correct position in the ogm_cnt bitmaps.

    The type for the number of enabled interfaces (which defines the next
    interface index) was set to char. This type can be (depending on the
    architecture) either signed (limiting batman-adv to 127 active slave
    interfaces) or unsigned (limiting batman-adv to 255 active slave
    interfaces).

    This limit was not correctly checked when an interface was enabled and thus
    an overflow happened. This was only catched on systems with the signed char
    type when the B.A.T.M.A.N. IV code tried to resize its counter arrays with
    a negative size.

    The if_num interface index was only a s16 and therefore significantly
    smaller than the ifindex (int) used by the code net code.

    Both &batadv_hard_iface->if_num and &batadv_priv->num_ifaces must be
    (unsigned) int to support the same number of slave interfaces as the net
    core code. And the interface activation code must check the number of
    active slave interfaces to avoid integer overflows.

    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

16 Dec, 2017

2 commits

  • Externally visible functions should be documented with kernel-doc. This
    usually refers to non-static functions but also static inline files in
    headers are visible in other files and should therefore be documented.

    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
     

04 Dec, 2017

1 commit

  • This function compiles to 288 bytes of machine code for Linux 4.14 on
    Debian Stretch amd64 and (6.3.0-18) with the default configuration. 27
    callsites (25 used in default config).

    text data bss dec hex filename
    179291 10317 4416 194024 2f5e8 batman-adv.ko.pre
    171952 10317 4416 186685 2d93d batman-adv.ko.post

    Signed-off-by: Denys Vlasenko
    [sven@narfation.org: Fix includes, correct sizes+counts in commit message]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Denys Vlasenko
     

26 Jan, 2017

1 commit


09 Aug, 2016

1 commit

  • 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
     

30 Jun, 2016

1 commit


10 May, 2016

1 commit

  • It is easier to understand that the returned value of a specific function
    doesn't have to be 0 when the functions was successful when the actual
    return type is bool. This is especially true when all surrounding functions
    with return type int use negative values to return the error code.

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

    Sven Eckelmann
     

23 Feb, 2016

6 commits


10 Feb, 2016

1 commit

  • batman-adv uses a self-written reference implementation which is just based
    on atomic_t. This is less obvious when reading the code than kref and
    therefore increases the change that the reference counting will be missed.

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

    Sven Eckelmann
     

02 Feb, 2016

1 commit


16 Jan, 2016

1 commit

  • It is not allowed to free the memory of an object which is part of a list
    which is protected by rcu-read-side-critical sections without making sure
    that no other context is accessing the object anymore. This usually happens
    by removing the references to this object and then waiting until the rcu
    grace period is over and no one (allowedly) accesses it anymore.

    But the _now functions ignore this completely. They free the object
    directly even when a different context still tries to access it. This has
    to be avoided and thus these functions must be removed and all functions
    have to use batadv_orig_node_free_ref.

    Fixes: 72822225bd41 ("batman-adv: Fix rcu_barrier() miss due to double call_rcu() in TT code")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

16 Dec, 2015

2 commits


28 Aug, 2015

2 commits


25 Aug, 2015

1 commit


07 Jun, 2015

2 commits

  • The header files could not be build indepdent from each other. This is
    happened because headers didn't include the files for things they've used.
    This was problematic because the success of a build depended on the
    knowledge about the right order of local includes.

    Also source files were not including everything they've used explicitly.
    Instead they required that transitive includes are always stable. This is
    problematic because some transitive includes are not obvious, depend on
    config settings and may not be stable in the future.

    The order for include blocks are:

    * primary headers (main.h and the *.h file of a *.c file)
    * global linux headers
    * required local headers
    * extra forward declarations for pointers in function/struct declarations

    The only exceptions are linux/bitops.h and linux/if_ether.h in packet.h.
    This header file is shared with userspace applications like batctl and must
    therefore build together with userspace applications. The header
    linux/bitops.h is not part of the uapi headers and linux/if_ether.h
    conflicts with the musl implementation of netinet/if_ether.h. The
    maintainers rejected the use of __KERNEL__ preprocessor checks and thus
    these two headers are only in main.h. All files using packet.h first have
    to include main.h to work correctly.

    Reported-by: Markus Pargmann
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner

    Sven Eckelmann
     
  • An unoptimized version of the Jenkins one-at-a-time hash function is used
    and partially copied all over the code wherever an hashtable is used.
    Instead the optimized version shared between the whole kernel should be
    used to reduce code duplication and use better optimized code.

    Only the DAT code must use the old implementation because it is used as
    distributed hash function which has to be common for all nodes.

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

    Sven Eckelmann
     

29 May, 2015

1 commit


08 Jan, 2015

1 commit


18 Feb, 2014

1 commit


12 Jan, 2014

4 commits

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

    Simon Wunderlich
     
  • Show tables for the multi interface operation. Originator tables
    are added per hard interface.

    This patch also changes the API by adding the interface to the
    bat_orig_print() parameters.

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

    Simon Wunderlich
     
  • For the network wide multi interface optimization there are different
    routers for each outgoing interface (outgoing from the OGM perspective,
    incoming for payload traffic). To reflect this, change the router and
    associated data to a list of routers.

    While at it, rename batadv_orig_node_get_router() to
    batadv_orig_router_get() to follow the new naming scheme.

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

    Simon Wunderlich
     
  • For the network wide multi interface optimization it is required to save
    metrics per outgoing interface in one neighbor. Therefore a new type is
    introduced to keep interface-specific information. This also requires
    some changes in access and list management.

    The compare and equiv_or_better API calls are changed to take the
    outgoing interface into consideration.

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

    Simon Wunderlich
     

09 Jan, 2014

1 commit


23 Oct, 2013

2 commits