19 Aug, 2020

2 commits

  • The commit c0842fbc1b18 ("random32: move the pseudo-random 32-bit
    definitions to prandom.h") introduced a new header for the pseudo random
    functions from (previously) linux/random.h. One future goal of the
    prandom.h change is to make code to switch just the new header file and to
    avoid the implicit include. This would allow the removal of the implicit
    include from random.h

    Signed-off-by: Sven Eckelmann

    Sven Eckelmann
     
  • checkpatch found various instances of "Possible repeated word" in various
    comments.

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

    Sven Eckelmann
     

26 Jun, 2020

1 commit


21 Apr, 2020

1 commit


01 Jan, 2020

1 commit


28 Jun, 2019

1 commit

  • When calling debugfs functions, there is no need to ever check the
    return value. The function can work or not, but the code logic should
    never do something different based on this.

    Because we don't care if debugfs works or not, this trickles back a bit
    so we can clean things up by making some functions return void instead
    of an error value that is never going to fail.

    Cc: Marek Lindner
    Cc: Simon Wunderlich
    Cc: Antonio Quartulli
    Cc: "David S. Miller"
    Cc: b.a.t.m.a.n@lists.open-mesh.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman
    [sven@narfation.org: drop unused variables]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Greg Kroah-Hartman
     

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


06 Sep, 2018

1 commit

  • The function batadv_nc_get_nc_node is responsible for adding new nc_nodes
    to the in_coding_list and out_coding_list. It first checks whether the
    entry already is in the list or not. If it is, then the creation of a new
    entry is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: d56b1705e28c ("batman-adv: network coding - detect coding nodes and remove these after timeout")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

27 Feb, 2018

1 commit


22 Dec, 2017

1 commit

  • The header file is used by different userspace programs to inject packets
    or to decode sniffed packets. It should therefore be available to them as
    userspace header.

    Also other components in the kernel (like the flow dissector) require
    access to the packet definitions to be able to decode ETH_P_BATMAN ethernet
    packets.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: David S. Miller

    Sven Eckelmann
     

16 Dec, 2017

4 commits

  • The documentation describing kernel-doc comments for functions ("How to
    format kernel-doc comments") uses parentheses at the end of the function
    name. Using this format allows to use a consistent style when adding
    documentation to a function and when referencing this function in a
    different kernel-doc section.

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

    Sven Eckelmann
     
  • The linux/net.h provides the net_ratelimited_function. It should
    therefore be included directly before it is used.

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

    Sven Eckelmann
     
  • The linux/gfp.h provides the GFP_ATOMIC and GFP_KERNEL define. It should
    therefore be included instead of linux/fs.h.

    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
     

23 May, 2017

1 commit


26 Jan, 2017

1 commit


09 Nov, 2016

1 commit


30 Oct, 2016

1 commit

  • kfree_skb assumes that an skb is dropped after an failure and notes that.
    consume_skb should be used in non-failure situations. Such information is
    important for dropmonitor netlink which tells how many packets were dropped
    and where this drop happened.

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

    Sven Eckelmann
     

19 Oct, 2016

1 commit

  • Linus prefers to have octal permission numbers instead of combinations of
    macro names ("random line noise"). Also old existing "bad symbolic
    permission bit macro use" should be converted to octal numbers.
    (http://lkml.kernel.org/r/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com)

    Also remove the S_IFREG bit from the octal representation because it is
    filtered out by debugfs_create.

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

    Sven Eckelmann
     

09 Aug, 2016

4 commits

  • The files provided by batman-adv via debugfs are currently converted to
    netlink. Tools which are not yet converted to use the netlink interface may
    still rely on the old debugfs files. But systems which already upgraded
    their tools can save some space by disabling this feature. The default
    configuration of batman-adv on amd64 can reduce the size of the module by
    around 11% when this feature is disabled.

    $ size net/batman-adv/batman-adv.ko*
    text data bss dec hex filename
    150507 10395 4160 165062 284c6 net/batman-adv/batman-adv.ko.y
    137106 7099 2112 146317 23b8d net/batman-adv/batman-adv.ko.n

    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
     

30 Jun, 2016

2 commits

  • There are several places in batman-adv which provide logging related
    functions. These should be grouped together in the log.* files to make them
    easier to find.

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

    Sven Eckelmann
     
  • The tvlv functionality in main.c is mostly unrelated to the rest of the
    content. It still takes up a large portion of this source file (~45%, 588
    lines). Moving it to a separate file makes it better visible as a main
    component of the batman-adv implementation and hides it less in the other
    helper functions in main.c

    Signed-off-by: Markus Pargmann
    [sven@narfation.org: fix conflicts with current version, fix includes,
    rewrote commit message]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Markus Pargmann
     

10 May, 2016

3 commits

  • When comparing Ethernet address it is better to use the more
    generic batadv_compare_eth. The latter is also optimised for
    architectures having a fast unaligned access.

    Signed-off-by: Antonio Quartulli
    [sven@narfation.org: fix conflicts with current version]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • 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
     
  • batadv_nc_get_nc_node requires that the caller already has a valid
    reference for orig_neigh_node. It is therefore not possible that it has an
    reference counter of 0 and was still given to this function

    The kref_get function instead WARNs (with debug information) when the
    reference counter would still be 0. This makes a bug in batman-adv better
    visible because kref_get_unless_zero would have ignored this problem.

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

    Sven Eckelmann
     

04 May, 2016

2 commits


29 Feb, 2016

1 commit

  • 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
     

23 Feb, 2016

7 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