1. 26 1月, 2017 1 次提交
  2. 09 11月, 2016 1 次提交
    • L
      batman-adv: fix rare race conditions on interface removal · 9b4aec64
      Linus Lüssing 提交于
      In rare cases during shutdown the following general protection fault can
      happen:
      
        general protection fault: 0000 [#1] SMP
        Modules linked in: batman_adv(O-) [...]
        CPU: 3 PID: 1714 Comm: rmmod Tainted: G           O    4.6.0-rc6+ #1
        [...]
        Call Trace:
         [<ffffffffa0363294>] batadv_hardif_disable_interface+0x29a/0x3a6 [batman_adv]
         [<ffffffffa0373db4>] batadv_softif_destroy_netlink+0x4b/0xa4 [batman_adv]
         [<ffffffff813b52f3>] __rtnl_link_unregister+0x48/0x92
         [<ffffffff813b9240>] rtnl_link_unregister+0xc1/0xdb
         [<ffffffff8108547c>] ? bit_waitqueue+0x87/0x87
         [<ffffffffa03850d2>] batadv_exit+0x1a/0xf48 [batman_adv]
         [<ffffffff810c26f9>] SyS_delete_module+0x136/0x1b0
         [<ffffffff8144dc65>] entry_SYSCALL_64_fastpath+0x18/0xa8
         [<ffffffff8108aaca>] ? trace_hardirqs_off_caller+0x37/0xa6
        Code: 89 f7 e8 21 bd 0d e1 4d 85 e4 75 0e 31 f6 48 c7 c7 50 d7 3b a0 e8 50 16 f2 e0 49 8b 9c 24 28 01 00 00 48 85 db 0f 84 b2 00 00 00 <48> 8b 03 4d 85 ed 48 89 45 c8 74 09 4c 39 ab f8 00 00 00 75 1c
        RIP  [<ffffffffa0371852>] batadv_purge_outstanding_packets+0x1c8/0x291 [batman_adv]
         RSP <ffff88001da5fd78>
        ---[ end trace 803b9bdc6a4a952b ]---
        Kernel panic - not syncing: Fatal exception in interrupt
        Kernel Offset: disabled
        ---[ end Kernel panic - not syncing: Fatal exception in interrupt
      
      It does not happen often, but may potentially happen when frequently
      shutting down and reinitializing an interface. With some carefully
      placed msleep()s/mdelay()s it can be reproduced easily.
      
      The issue is, that on interface removal, any still running worker thread
      of a forwarding packet will race with the interface purging routine to
      free a forwarding packet. Temporarily giving up a spin-lock to be able
      to sleep in the purging routine is not safe.
      
      Furthermore, there is a potential general protection fault not just for
      the purging side shown above, but also on the worker side: Temporarily
      removing a forw_packet from the according forw_{bcast,bat}_list will make
      it impossible for the purging routine to catch and cancel it.
      
       # How this patch tries to fix it:
      
      With this patch we split the queue purging into three steps: Step 1),
      removing forward packets from the queue of an interface and by that
      claim it as our responsibility to free.
      
      Step 2), we are either lucky to cancel a pending worker before it starts
      to run. Or if it is already running, we wait and let it do its thing,
      except two things:
      
      Through the claiming in step 1) we prevent workers from a) re-arming
      themselves. And b) prevent workers from freeing packets which we still
      hold in the interface purging routine.
      
      Finally, step 3, we are sure that no forwarding packets are pending or
      even running anymore on the interface to remove. We can then safely free
      the claimed forwarding packets.
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      9b4aec64
  3. 30 10月, 2016 2 次提交
    • S
      batman-adv: use consume_skb for non-dropped packets · bd687fe4
      Sven Eckelmann 提交于
      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: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      bd687fe4
    • L
      batman-adv: Simple (re)broadcast avoidance · 3111beed
      Linus Lüssing 提交于
      With this patch, (re)broadcasting on a specific interfaces is avoided:
      
      * No neighbor: There is no need to broadcast on an interface if there
        is no node behind it.
      
      * Single neighbor is source: If there is just one neighbor on an
        interface and if this neighbor is the one we actually got this
        broadcast packet from, then we do not need to echo it back.
      
      * Single neighbor is originator: If there is just one neighbor on
        an interface and if this neighbor is the originator of this
        broadcast packet, then we do not need to echo it back.
      
      Goodies for BATMAN V:
      
      ("Upgrade your BATMAN IV network to V now to get these for free!")
      
      Thanks to the split of OGMv1 into two packet types, OGMv2 and ELP
      that is, we can now apply the same optimizations stated above to OGMv2
      packets, too.
      
      Furthermore, with BATMAN V, rebroadcasts can be reduced in certain
      multi interface cases, too, where BATMAN IV cannot. This is thanks to
      the removal of the "secondary interface originator" concept in BATMAN V.
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      3111beed
  4. 09 8月, 2016 1 次提交
  5. 30 6月, 2016 1 次提交
  6. 29 2月, 2016 1 次提交
    • A
      batman-adv: keep track of when unicast packets are sent · 95d39278
      Antonio Quartulli 提交于
      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: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      95d39278
  7. 02 2月, 2016 2 次提交
  8. 25 8月, 2015 2 次提交
  9. 07 6月, 2015 1 次提交
    • S
      batman-adv: Add required includes to all files · 1e2c2a4f
      Sven Eckelmann 提交于
      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: NMarkus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      1e2c2a4f
  10. 29 5月, 2015 1 次提交
  11. 22 3月, 2014 2 次提交
  12. 12 1月, 2014 1 次提交
  13. 09 1月, 2014 2 次提交
  14. 19 10月, 2013 2 次提交
  15. 12 10月, 2013 1 次提交
  16. 29 5月, 2013 1 次提交
  17. 19 1月, 2013 1 次提交
  18. 21 11月, 2012 1 次提交
  19. 02 7月, 2012 1 次提交
  20. 21 6月, 2012 2 次提交
  21. 17 2月, 2012 1 次提交
  22. 08 9月, 2011 2 次提交
  23. 05 7月, 2011 1 次提交
  24. 20 6月, 2011 2 次提交
    • A
      batman-adv: improved client announcement mechanism · a73105b8
      Antonio Quartulli 提交于
      The client announcement mechanism informs every mesh node in the network
      of any connected non-mesh client, in order to find the path towards that
      client from any given point in the mesh.
      
      The old implementation was based on the simple idea of appending a data
      buffer to each OGM containing all the client MAC addresses the node is
      serving. All other nodes can populate their global translation tables
      (table which links client MAC addresses to node addresses) using this
      MAC address buffer and linking it to the node's address contained in the
      OGM. A node that wants to contact a client has to lookup the node the
      client is connected to and its address in the global translation table.
      
      It is easy to understand that this implementation suffers from several
      issues:
       - big overhead (each and every OGM contains the entire list of
         connected clients)
       - high latencies for client route updates due to long OGM trip time and
         OGM losses
      
      The new implementation addresses these issues by appending client
      changes (new client joined or a client left) to the OGM instead of
      filling it with all the client addresses each time. In this way nodes
      can modify their global tables by means of "updates", thus reducing the
      overhead within the OGMs.
      
      To keep the entire network in sync each node maintains a translation
      table version number (ttvn) and a translation table checksum. These
      values are spread with the OGM to allow all the network participants to
      determine whether or not they need to update their translation table
      information.
      
      When a translation table lookup is performed in order to send a packet
      to a client attached to another node, the destination's ttvn is added to
      the payload packet. Forwarding nodes can compare the packet's ttvn with
      their destination's ttvn (this node could have a fresher information
      than the source) and re-route the packet if necessary. This greatly
      reduces the packet loss of clients roaming from one AP to the next.
      Signed-off-by: NAntonio Quartulli <ordex@autistici.org>
      Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      a73105b8
    • S
      batman-adv: Reduce usage of char · b4e17054
      Sven Eckelmann 提交于
      char was used in different places to store information without really
      using the characteristics of that data type or by ignoring the fact that
      char has not a well defined signedness.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      b4e17054
  25. 30 5月, 2011 1 次提交
  26. 08 5月, 2011 1 次提交
  27. 05 3月, 2011 1 次提交
  28. 12 2月, 2011 1 次提交
  29. 31 1月, 2011 1 次提交
  30. 17 12月, 2010 1 次提交
  31. 05 9月, 2010 1 次提交