23 Sep, 2020

1 commit

  • Two minor conflicts:

    1) net/ipv4/route.c, adding a new local variable while
    moving another local variable and removing it's
    initial assignment.

    2) drivers/net/dsa/microchip/ksz9477.c, overlapping changes.
    One pretty prints the port mode differently, whilst another
    changes the driver to try and obtain the port mode from
    the port node rather than the switch node.

    Signed-off-by: David S. Miller

    David S. Miller
     

15 Sep, 2020

3 commits

  • Scenario:
    * Multicast frame send from BLA backbone gateways (multiple nodes
    with their bat0 bridged together, with BLA enabled) sharing the same
    LAN to nodes in the mesh

    Issue:
    * Nodes receive the frame multiple times on bat0 from the mesh,
    once from each foreign BLA backbone gateway which shares the same LAN
    with another

    For multicast frames via batman-adv broadcast packets coming from the
    same BLA backbone but from different backbone gateways duplicates are
    currently detected via a CRC history of previously received packets.

    However this CRC so far was not performed for multicast frames received
    via batman-adv unicast packets. Fixing this by appyling the same check
    for such packets, too.

    Room for improvements in the future: Ideally we would introduce the
    possibility to not only claim a client, but a complete originator, too.
    This would allow us to only send a multicast-in-unicast packet from a BLA
    backbone gateway claiming the node and by that avoid potential redundant
    transmissions in the first place.

    Fixes: 279e89b2281a ("batman-adv: add broadcast duplicate check")
    Signed-off-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     
  • Scenario:
    * Multicast frame send from mesh to a BLA backbone (multiple nodes
    with their bat0 bridged together, with BLA enabled)

    Issue:
    * BLA backbone nodes receive the frame multiple times on bat0,
    once from mesh->bat0 and once from each backbone_gw from LAN

    For unicast, a node will send only to the best backbone gateway
    according to the TQ. However for multicast we currently cannot determine
    if multiple destination nodes share the same backbone if they don't share
    the same backbone with us. So we need to keep sending the unicasts to
    all backbone gateways and let the backbone gateways decide which one
    will forward the frame. We can use the CLAIM mechanism to make this
    decision.

    One catch: The batman-adv gateway feature for DHCP packets potentially
    sends multicast packets in the same batman-adv unicast header as the
    multicast optimizations code. And we are not allowed to drop those even
    if we did not claim the source address of the sender, as for such
    packets there is only this one multicast-in-unicast packet.

    How can we distinguish the two cases?

    The gateway feature uses a batman-adv unicast 4 address header. While
    the multicast-to-unicasts feature uses a simple, 3 address batman-adv
    unicast header. So let's use this to distinguish.

    Fixes: fe2da6ff27c7 ("batman-adv: check incoming packet type for bla")
    Signed-off-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     
  • The fix for receiving (internally generated) bla packets outside the
    interrupt context introduced the usage of in_interrupt(). But this
    functionality is only defined in linux/preempt.h which was not included
    with the same patch.

    Fixes: 279e89b2281a ("batman-adv: bla: use netif_rx_ni when not in interrupt context")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

05 Sep, 2020

1 commit

  • We got slightly different patches removing a double word
    in a comment in net/ipv4/raw.c - picked the version from net.

    Simple conflict in drivers/net/ethernet/ibm/ibmvnic.c. Use cached
    values instead of VNIC login response buffer (following what
    commit 507ebe6444a4 ("ibmvnic: Fix use-after-free of VNIC login
    response buffer") did).

    Signed-off-by: Jakub Kicinski

    Jakub Kicinski
     

27 Aug, 2020

1 commit

  • It seems that due to a copy & paste error the void pointer
    in batadv_choose_backbone_gw() is cast to the wrong type.

    Fixing this by using "struct batadv_bla_backbone_gw" instead of "struct
    batadv_bla_claim" which better matches the caller's side.

    For now it seems that we were lucky because the two structs both have
    their orig/vid and addr/vid in the beginning. However I stumbled over
    this issue when I was trying to add some debug variables in front of
    "orig" in batadv_backbone_gw, which caused hash lookups to fail.

    Fixes: 07568d0369f9 ("batman-adv: don't rely on positions in struct for hashing")
    Signed-off-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann

    Linus Lüssing
     

19 Aug, 2020

2 commits


26 Jun, 2020

1 commit


01 Jan, 2020

1 commit


09 Dec, 2019

1 commit

  • The sparse commit 6002ded74587 ("add a flag to warn on casts to/from
    bitwise pointers") introduced a check for non-direct casts from/to
    restricted datatypes (when -Wbitwise-pointer is enabled).

    This triggered various warnings in batman-adv when some (already big
    endian) buffer content was casted to/from the corresponding big endian
    integer data types. But these were correct and can therefore be marked with
    __force to signalize sparse an intended cast from/to a bitwise type.

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

    Sven Eckelmann
     

06 Apr, 2019

1 commit


25 Mar, 2019

3 commits

  • The sysfs files will be marked as deprecated in the near future. They are
    already replaced by the batadv generic netlink family. Add an Kconfig
    option to disable the sysfs support for users who want to test their tools
    or want to safe some space. This setting should currently still be enabled
    by default to keep backward compatible with legacy tools.

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

    Sven Eckelmann
     
  • 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
     
  • The batadv_hash_remove is a function which searches the hashtable for an
    entry using a needle, a hashtable bucket selection function and a compare
    function. It will lock the bucket list and delete an entry when the compare
    function matches it with the needle. It returns the pointer to the
    hlist_node which matches or NULL when no entry matches the needle.

    The batadv_bla_del_claim is not itself protected in anyway to avoid that
    any other function is modifying the hashtable between the search for the
    entry and the call to batadv_hash_remove. It can therefore happen that the
    entry either doesn't exist anymore or an entry was deleted which is not the
    same object as the needle. In such an situation, the reference counter (for
    the reference stored in the hashtable) must not be reduced for the needle.
    Instead the reference counter of the actually removed entry has to be
    reduced.

    Otherwise the reference counter will underflow and the object might be
    freed before all its references were dropped. The kref helpers reported
    this problem as:

    refcount_t: underflow; use-after-free.

    Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

04 Jan, 2019

1 commit


12 Nov, 2018

2 commits

  • The netlink dump functionality transfers a large number of entries from the
    kernel to userspace. It is rather likely that the transfer has to
    interrupted and later continued. During that time, it can happen that
    either new entries are added or removed. The userspace could than either
    receive some entries multiple times or miss entries.

    Commit 670dc2833d14 ("netlink: advertise incomplete dumps") introduced a
    mechanism to inform userspace about this problem. Userspace can then decide
    whether it is necessary or not to retry dumping the information again.

    The netlink dump functions have to be switched to exclusive locks to avoid
    changes while the current message is prepared. The already existing
    generation sequence counter from the hash helper can be used for this
    simple hash.

    Reported-by: Matthias Schiffer
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The netlink dump functionality transfers a large number of entries from the
    kernel to userspace. It is rather likely that the transfer has to
    interrupted and later continued. During that time, it can happen that
    either new entries are added or removed. The userspace could than either
    receive some entries multiple times or miss entries.

    Commit 670dc2833d14 ("netlink: advertise incomplete dumps") introduced a
    mechanism to inform userspace about this problem. Userspace can then decide
    whether it is necessary or not to retry dumping the information again.

    The netlink dump functions have to be switched to exclusive locks to avoid
    changes while the current message is prepared. The already existing
    generation sequence counter from the hash helper can be used for this
    simple hash.

    Reported-by: Matthias Schiffer
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

07 Sep, 2018

1 commit


23 Jun, 2018

1 commit

  • random_ether_addr is a #define for eth_random_addr which is
    generally preferred in kernel code by ~3:1

    Convert the uses of random_ether_addr to enable removing the #define

    Miscellanea:

    o Convert &vfmac[0] to equivalent vfmac and avoid unnecessary line wrap

    Signed-off-by: Joe Perches
    Acked-by: Jeff Kirsher
    Signed-off-by: David S. Miller

    Joe Perches
     

06 Mar, 2018

1 commit


27 Feb, 2018

1 commit


26 Feb, 2018

2 commits

  • The function batadv_bla_backbone_dump_bucket must be able to handle
    non-complete dumps of a single bucket. It tries to do that by saving the
    latest dumped index in *idx_skip to inform the caller about the current
    state.

    But the caller only assumes that buckets were not completely dumped when
    the return code is non-zero. This function must therefore also return a
    non-zero index when the dumping of an entry failed. Otherwise the caller
    will just skip all remaining buckets.

    And the function must also reset *idx_skip back to zero when it finished a
    bucket. Otherwise it will skip the same number of entries in the next
    bucket as the previous one had.

    Fixes: ea4152e11716 ("batman-adv: add backbone table netlink support")
    Reported-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The function batadv_bla_claim_dump_bucket must be able to handle
    non-complete dumps of a single bucket. It tries to do that by saving the
    latest dumped index in *idx_skip to inform the caller about the current
    state.

    But the caller only assumes that buckets were not completely dumped when
    the return code is non-zero. This function must therefore also return a
    non-zero index when the dumping of an entry failed. Otherwise the caller
    will just skip all remaining buckets.

    And the function must also reset *idx_skip back to zero when it finished a
    bucket. Otherwise it will skip the same number of entries in the next
    bucket as the previous one had.

    Fixes: 04f3f5bf1883 ("batman-adv: add B.A.T.M.A.N. Dump BLA claims via netlink")
    Reported-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

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

3 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/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

  • The function names in batman-adv changed slightly in the past. But some of
    the debug messages were not updated correctly and therefore some messages
    were incorrect. To avoid this in the future, these kind of messages should
    use __func__ to automatically print the correct function name.

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

    Sven Eckelmann
     

22 Mar, 2017

3 commits

  • Consider the following situation which has been found in a test setup:
    Gateway B has claimed client C and gateway A has the same backbone
    network as B. C sends a broad- or multicast to B and directly after
    this packet decides to send another packet to A due to a better TQ
    value. B will forward the broad-/multicast into the backbone as it is
    the responsible gw and after that A will claim C as it has been
    chosen by C as the best gateway. If it now happens that A claims C
    before it has received the broad-/multicast forwarded by B (due to
    backbone topology or due to some delay in B when forwarding the
    packet) we get a critical situation: in the current code A will
    immediately unclaim C when receiving the multicast due to the
    roaming client scenario although the position of C has not changed
    in the mesh. If this happens the multi-/broadcast forwarded by B
    will be sent back into the mesh by A and we have looping packets
    until one of the gateways claims C again.
    In order to prevent this, unclaiming of a client due to the roaming
    client scenario is only done after a certain time is expired after
    the last claim of the client. 100 ms are used here, which should be
    slow enough for big backbones and slow gateways but fast enough not
    to break the roaming client use case.

    Acked-by: Simon Wunderlich
    Signed-off-by: Andreas Pape
    [sven@narfation.org: fix conflicts with current version]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Andreas Pape
     
  • Some of the bla debug messages are extended and additional messages are
    added for easier bla debugging. Some debug messages introduced with the
    dat changes in prior patches of this patch series have been changed to
    be more compliant to other existing debug messages.

    Acked-by: Simon Wunderlich
    Signed-off-by: Andreas Pape
    [sven@narfation.org: fix conflicts with current version]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Andreas Pape
     
  • If dat is enabled it must be made sure that only the backbone gw which has
    claimed the remote destination for the ARP request answers the ARP request
    directly if the MAC address is known due to the local dat table. This
    prevents multiple ARP replies in a common backbone if more than one
    gateway already knows the remote mac searched for in the ARP request.

    Signed-off-by: Andreas Pape
    Acked-by: Simon Wunderlich
    [sven@narfation.org: fix conflicts with current version]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Andreas Pape
     

17 Mar, 2017

1 commit


27 Jan, 2017

1 commit

  • Simon Wunderlich says:

    ====================
    This feature/cleanup patchset includes the following patches:

    - bump version strings, by Simon Wunderlich

    - ignore self-generated loop detect MAC addresses in translation table,
    by Simon Wunderlich

    - install uapi batman_adv.h header, by Sven Eckelmann

    - bump copyright years, by Sven Eckelmann

    - Remove an unused variable in translation table code, by Sven Eckelmann

    - Handle NET_XMIT_CN like NET_XMIT_SUCCESS (revised according to Davids
    suggestion), and a follow up code clean up, by Gao Feng (2 patches)
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

26 Jan, 2017

1 commit


19 Jan, 2017

1 commit

  • The network stack no longer uses the last_rx member of struct net_device
    since the bonding driver switched to use its own private last_rx in
    commit 9f242738376d ("bonding: use last_arp_rx in slave_last_rx()").

    However, some drivers still (ab)use the field for their own purposes and
    some driver just update it without actually using it.

    Previously, there was an accompanying comment for the last_rx member
    added in commit 4dc89133f49b ("net: add a comment on netdev->last_rx")
    which asked drivers not to update is, unless really needed. However,
    this commend was removed in commit f8ff080dacec ("bonding: remove
    useless updating of slave->dev->last_rx"), so some drivers added later
    on still did update last_rx.

    Remove all usage of last_rx and switch three drivers (sky2, atp and
    smc91c92_cs) which actually read and write it to use their own private
    copy in netdev_priv.

    Compile-tested with allyesconfig and allmodconfig on x86 and arm.

    Cc: Eric Dumazet
    Cc: Jay Vosburgh
    Cc: Veaceslav Falico
    Cc: Andy Gospodarek
    Cc: Mirko Lindner
    Cc: Stephen Hemminger
    Signed-off-by: Tobias Klauser
    Acked-by: Eric Dumazet
    Reviewed-by: Jay Vosburgh
    Signed-off-by: David S. Miller

    Tobias Klauser
     

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
     
  • 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