1. 22 5月, 2019 1 次提交
  2. 25 3月, 2019 4 次提交
    • L
      batman-adv: Add multicast-to-unicast support for multiple targets · 32e72744
      Linus Lüssing 提交于
      With this patch multicast packets with a limited number of destinations
      (current default: 16) will be split and transmitted by the originator as
      individual unicast transmissions.
      
      Wifi broadcasts with their low bitrate are still a costly undertaking.
      In a mesh network this cost multiplies with the overall size of the mesh
      network. Therefore using multiple unicast transmissions instead of
      broadcast flooding is almost always less burdensome for the mesh
      network.
      
      The maximum amount of unicast packets can be configured via the newly
      introduced multicast_fanout parameter. If this limit is exceeded
      distribution will fall back to classic broadcast flooding.
      
      The multicast-to-unicast conversion is performed on the initial
      multicast sender node and counts on a final destination node, mesh-wide
      basis (and not next hop, neighbor node basis).
      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>
      32e72744
    • S
      batman-adv: Drop license boilerplate · 0d5f20c4
      Sven Eckelmann 提交于
      All files got a SPDX-License-Identifier with commit 7db7d9f3
      ("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: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      0d5f20c4
    • S
      batman-adv: Reduce tt_global hash refcnt only for removed entry · f131a568
      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_tt_global_free 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: 7683fdc1 ("batman-adv: protect the local and the global trans-tables with rcu")
      Reported-by: NMartin Weinelt <martin@linuxlounge.net>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Acked-by: NAntonio Quartulli <a@unstable.cc>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      f131a568
    • S
      batman-adv: Reduce tt_local hash refcnt only for removed entry · 3d65b9ac
      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_tt_local_remove 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: ef72706a ("batman-adv: protect tt_local_entry from concurrent delete events")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      3d65b9ac
  3. 04 1月, 2019 1 次提交
  4. 12 11月, 2018 1 次提交
    • S
      batman-adv: Add inconsistent local TT netlink dump detection · 6b7b40aa
      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 670dc283 ("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: NMatthias Schiffer <mschiffer@universe-factory.net>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      6b7b40aa
  5. 06 9月, 2018 1 次提交
    • S
      batman-adv: Prevent duplicated global TT entry · e7136e48
      Sven Eckelmann 提交于
      The function batadv_tt_global_orig_entry_add is responsible for adding new
      tt_orig_list_entry to the orig_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: d657e621 ("batman-adv: add reference counting for type batadv_tt_orig_list_entry")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      e7136e48
  6. 23 6月, 2018 2 次提交
  7. 13 5月, 2018 2 次提交
    • M
      batman-adv: prevent TT request storms by not sending inconsistent TT TLVLs · 16116dac
      Marek Lindner 提交于
      A translation table TVLV changset sent with an OGM consists
      of a number of headers (one per VLAN) plus the changeset
      itself (addition and/or deletion of entries).
      
      The per-VLAN headers are used by OGM recipients for consistency
      checks. Said consistency check might determine that a full
      translation table request is needed to restore consistency. If
      the TT sender adds per-VLAN headers of empty VLANs into the OGM,
      recipients are led to believe to have reached an inconsistent
      state and thus request a full table update. The full table does
      not contain empty VLANs (due to missing entries) the cycle
      restarts when the next OGM is issued.
      
      Consequently, when the translation table TVLV headers are
      composed, empty VLANs are to be excluded.
      
      Fixes: 21a57f6e7a3b ("batman-adv: make the TT CRC logic VLAN specific")
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      16116dac
    • L
      batman-adv: Fix TT sync flags for intermediate TT responses · 7072337e
      Linus Lüssing 提交于
      The previous TT sync fix so far only fixed TT responses issued by the
      target node directly. So far, TT responses issued by intermediate nodes
      still lead to the wrong flags being added, leading to CRC mismatches.
      
      This behaviour was observed at Freifunk Hannover in a 800 nodes setup
      where a considerable amount of nodes were still infected with 'WI'
      TT flags even with (most) nodes having the previous TT sync fix applied.
      
      I was able to reproduce the issue with intermediate TT responses in a
      four node test setup and this patch fixes this issue by ensuring to
      use the per originator instead of the summarized, OR'd ones.
      
      Fixes: e9c00136 ("batman-adv: fix tt_global_entries flags update")
      Reported-by: NLeonardo Mörlein <me@irrelefant.net>
      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>
      7072337e
  8. 10 5月, 2018 1 次提交
    • S
      batman-adv: Avoid race in TT TVLV allocator helper · 8ba0f9bd
      Sven Eckelmann 提交于
      The functions batadv_tt_prepare_tvlv_local_data and
      batadv_tt_prepare_tvlv_global_data are responsible for preparing a buffer
      which can be used to store the TVLV container for TT and add the VLAN
      information to it.
      
      This will be done in three phases:
      
      1. count the number of VLANs and their entries
      2. allocate the buffer using the counters from the previous step and limits
         from the caller (parameter tt_len)
      3. insert the VLAN information to the buffer
      
      The step 1 and 3 operate on a list which contains the VLANs. The access to
      these lists must be protected with an appropriate lock or otherwise they
      might operate on on different entries. This could for example happen when
      another context is adding VLAN entries to this list.
      
      This could lead to a buffer overflow in these functions when enough entries
      were added between step 1 and 3 to the VLAN lists that the buffer room for
      the entries (*tt_change) is smaller then the now required extra buffer for
      new VLAN entries.
      
      Fixes: 7ea7b4a1 ("batman-adv: make the TT CRC logic VLAN specific")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Acked-by: NAntonio Quartulli <a@unstable.cc>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      8ba0f9bd
  9. 27 2月, 2018 1 次提交
  10. 22 12月, 2017 1 次提交
  11. 16 12月, 2017 6 次提交
  12. 31 7月, 2017 1 次提交
    • L
      batman-adv: fix TT sync flag inconsistencies · 54e22f26
      Linus Lüssing 提交于
      This patch fixes an issue in the translation table code potentially
      leading to a TT Request + Response storm. The issue may occur for nodes
      involving BLA and an inconsistent configuration of the batman-adv AP
      isolation feature. However, since the new multicast optimizations, a
      single, malformed packet may lead to a mesh-wide, persistent
      Denial-of-Service, too.
      
      The issue occurs because nodes are currently OR-ing the TT sync flags of
      all originators announcing a specific MAC address via the
      translation table. When an intermediate node now receives a TT Request
      and wants to answer this on behalf of the destination node, then this
      intermediate node now responds with an altered flag field and broken
      CRC. The next OGM of the real destination will lead to a CRC mismatch
      and triggering a TT Request and Response again.
      
      Furthermore, the OR-ing is currently never undone as long as at least
      one originator announcing the according MAC address remains, leading to
      the potential persistency of this issue.
      
      This patch fixes this issue by storing the flags used in the CRC
      calculation on a a per TT orig entry basis to be able to respond with
      the correct, original flags in an intermediate TT Response for one
      thing. And to be able to correctly unset sync flags once all nodes
      announcing a sync flag vanish for another.
      
      Fixes: e9c00136 ("batman-adv: fix tt_global_entries flags update")
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Acked-by: NAntonio Quartulli <a@unstable.cc>
      [sw: typo in commit message]
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      54e22f26
  13. 09 6月, 2017 2 次提交
  14. 17 3月, 2017 2 次提交
  15. 26 1月, 2017 2 次提交
  16. 02 12月, 2016 1 次提交
  17. 09 11月, 2016 1 次提交
    • S
      batman-adv: Cache the type of wifi device for each hardif · 10b1bbb4
      Sven Eckelmann 提交于
      batman-adv is requiring the type of wifi device in different contexts. Some
      of them can take the rtnl semaphore and some of them already have the
      semaphore taken. But even others don't allow that the semaphore will be
      taken.
      
      The data has to be retrieved when the hardif is added to batman-adv because
      some of the wifi information for an hardif will only be available with rtnl
      lock. It can then be cached in the batadv_hard_iface and the functions
      is_wifi_netdev and is_cfg80211_netdev can just compare the correct bits
      without imposing extra locking requirements.
      Signed-off-by: NSven Eckelmann <sven.eckelmann@open-mesh.com>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      10b1bbb4
  18. 30 10月, 2016 1 次提交
  19. 18 10月, 2016 1 次提交
  20. 09 8月, 2016 6 次提交
  21. 04 7月, 2016 1 次提交
  22. 30 6月, 2016 1 次提交