1. 06 1月, 2015 2 次提交
    • L
      batman-adv: fix potential TT client + orig-node memory leak · 9d31b3ce
      Linus Lüssing 提交于
      This patch fixes a potential memory leak which can occur once an
      originator times out. On timeout the according global translation table
      entry might not get purged correctly. Furthermore, the non purged TT
      entry will cause its orig-node to leak, too. Which additionally can lead
      to the new multicast optimization feature not kicking in because of a
      therefore bogus counter.
      
      In detail: The batadv_tt_global_entry->orig_list holds the reference to
      the orig-node. Usually this reference is released after
      BATADV_PURGE_TIMEOUT through: _batadv_purge_orig()->
      batadv_purge_orig_node()->batadv_update_route()->_batadv_update_route()->
      batadv_tt_global_del_orig() which purges this global tt entry and
      releases the reference to the orig-node.
      
      However, if between two batadv_purge_orig_node() calls the orig-node
      timeout grew to 2*BATADV_PURGE_TIMEOUT then this call path isn't
      reached. Instead the according orig-node is removed from the
      originator hash in _batadv_purge_orig(), the batadv_update_route()
      part is skipped and won't be reached anymore.
      
      Fixing the issue by moving batadv_tt_global_del_orig() out of the rcu
      callback.
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Acked-by: NAntonio Quartulli <antonio@meshcoding.com>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NAntonio Quartulli <antonio@meshcoding.com>
      9d31b3ce
    • L
      batman-adv: fix delayed foreign originator recognition · 2c667a33
      Linus Lüssing 提交于
      Currently it can happen that the reception of an OGM from a new
      originator is not being accepted. More precisely it can happen that
      an originator struct gets allocated and initialized
      (batadv_orig_node_new()), even the TQ gets calculated and set correctly
      (batadv_iv_ogm_calc_tq()) but still the periodic orig_node purging
      thread will decide to delete it if it has a chance to jump between
      these two function calls.
      
      This is because batadv_orig_node_new() initializes the last_seen value
      to zero and its caller (batadv_iv_ogm_orig_get()) makes it visible to
      other threads by adding it to the hash table already.
      batadv_iv_ogm_calc_tq() will set the last_seen variable to the correct,
      current time a few lines later but if the purging thread jumps in between
      that it will think that the orig_node timed out and will wrongly
      schedule it for deletion already.
      
      If the purging interval is the same as the originator interval (which is
      the default: 1 second), then this game can continue for several rounds
      until the random OGM jitter added enough difference between these
      two (in tests, two to about four rounds seemed common).
      
      Fixing this by initializing the last_seen variable of an orig_node
      to the current time before adding it to the hash table.
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NAntonio Quartulli <antonio@meshcoding.com>
      2c667a33
  2. 16 5月, 2014 1 次提交
  3. 11 5月, 2014 1 次提交
  4. 10 5月, 2014 2 次提交
  5. 22 3月, 2014 3 次提交
  6. 18 2月, 2014 1 次提交
  7. 12 1月, 2014 6 次提交
  8. 09 1月, 2014 1 次提交
  9. 27 12月, 2013 1 次提交
  10. 23 10月, 2013 5 次提交
  11. 20 10月, 2013 2 次提交
    • A
      batman-adv: make the TT global purge routine VLAN specific · 95fb130d
      Antonio Quartulli 提交于
      Instead of unconditionally removing all the TT entries
      served by a given originator, make tt_global_orig_del()
      remove only entries matching a given VLAN identifier
      provided as argument.
      
      If such argument is negative all the global entries
      served by the originator are removed.
      
      This change is used into the BLA code to purge entries
      served by a newly discovered Backbone node, but limiting
      the operation only to those connected to the VLAN where the
      backbone has been discovered.
      
      Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
      Signed-off-by: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
      95fb130d
    • A
      batman-adv: make the TT CRC logic VLAN specific · 7ea7b4a1
      Antonio Quartulli 提交于
      This change allows nodes to handle the TT table on a
      per-VLAN basis. This is needed because nodes may have to
      store only some of the global entries advertised by another
      node.
      
      In this scenario such nodes would re-create only a partial
      global table and would not be able to compute a correct CRC
      anymore.
      
      This patch splits the logic and introduces one CRC per VLAN.
      In this way a node fetching only some entries belonging to
      some VLANs is still able to compute the needed CRCs and
      still check the table correctness.
      
      With this patch the shape of the TVLV-TT is changed too
      because now a node needs to advertise all the CRCs of all
      the VLANs that it is wired to.
      
      The debug output of the local Translation Table now shows
      the CRC along with each entry since there is not a common
      value for the entire table anymore.
      Signed-off-by: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
      7ea7b4a1
  12. 19 10月, 2013 1 次提交
    • A
      batman-adv: lock around TT operations to avoid sending inconsistent data · a70a9aa9
      Antonio Quartulli 提交于
      A TT response may be prepared and sent while the local or
      global translation table is getting updated.
      
      The worst case is when one of the tables is accessed after
      its content has been recently updated but the metadata
      (TTVN/CRC) has not yet. In this case the reader will get a
      table content which does not match the TTVN/CRC.
      This will lead to an inconsistent state and so to a TT
      recovery.
      
      To avoid entering this situation, put a lock around those TT
      operations recomputing the metadata and around the TT
      Response creation (the latter is the only reader that
      accesses the metadata together with the table).
      Signed-off-by: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
      a70a9aa9
  13. 12 10月, 2013 2 次提交
  14. 10 10月, 2013 1 次提交
  15. 29 5月, 2013 2 次提交
  16. 17 5月, 2013 1 次提交
  17. 27 3月, 2013 1 次提交
  18. 14 3月, 2013 1 次提交
    • M
      batman-adv: network coding - detect coding nodes and remove these after timeout · d56b1705
      Martin Hundebøll 提交于
      To use network coding efficiently, a relay must know when neighbor nodes
      are likely to have enough information to be able to decode a network
      coded packet. This is detected by using OGMs from batman-adv to discover
      when one neighbor is in range of another neighbor. The relay check the
      TLL to detect when an OGM is forwarded from one neighbor by another
      neighbor, and thereby knows that the two neighbors are in range and thus
      overhear packets sent by each other.
      
      This information is saved in the orig_node struct to be used when
      searching for coding opportunities. Two lists are added to the
      orig_node struct: One for neighbors that can hear the orig_node
      (outgoing nc_nodes) and one for neighbors that the orig_node can hear
      (incoming nc_nodes).
      
      Information about nc_nodes is kept for 10 seconds and is available
      through debugfs in batman_adv/nc_nodes to use when debugging network
      coding.
      Signed-off-by: NMartin Hundebøll <martin@hundeboll.net>
      Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
      Signed-off-by: NAntonio Quartulli <ordex@autistici.org>
      d56b1705
  19. 28 2月, 2013 1 次提交
    • S
      hlist: drop the node parameter from iterators · b67bfe0d
      Sasha Levin 提交于
      I'm not sure why, but the hlist for each entry iterators were conceived
      
              list_for_each_entry(pos, head, member)
      
      The hlist ones were greedy and wanted an extra parameter:
      
              hlist_for_each_entry(tpos, pos, head, member)
      
      Why did they need an extra pos parameter? I'm not quite sure. Not only
      they don't really need it, it also prevents the iterator from looking
      exactly like the list iterator, which is unfortunate.
      
      Besides the semantic patch, there was some manual work required:
      
       - Fix up the actual hlist iterators in linux/list.h
       - Fix up the declaration of other iterators based on the hlist ones.
       - A very small amount of places were using the 'node' parameter, this
       was modified to use 'obj->member' instead.
       - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
       properly, so those had to be fixed up manually.
      
      The semantic patch which is mostly the work of Peter Senna Tschudin is here:
      
      @@
      iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
      
      type T;
      expression a,c,d,e;
      identifier b;
      statement S;
      @@
      
      -T b;
          <+... when != b
      (
      hlist_for_each_entry(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue(a,
      - b,
      c) S
      |
      hlist_for_each_entry_from(a,
      - b,
      c) S
      |
      hlist_for_each_entry_rcu(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_rcu_bh(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue_rcu_bh(a,
      - b,
      c) S
      |
      for_each_busy_worker(a, c,
      - b,
      d) S
      |
      ax25_uid_for_each(a,
      - b,
      c) S
      |
      ax25_for_each(a,
      - b,
      c) S
      |
      inet_bind_bucket_for_each(a,
      - b,
      c) S
      |
      sctp_for_each_hentry(a,
      - b,
      c) S
      |
      sk_for_each(a,
      - b,
      c) S
      |
      sk_for_each_rcu(a,
      - b,
      c) S
      |
      sk_for_each_from
      -(a, b)
      +(a)
      S
      + sk_for_each_from(a) S
      |
      sk_for_each_safe(a,
      - b,
      c, d) S
      |
      sk_for_each_bound(a,
      - b,
      c) S
      |
      hlist_for_each_entry_safe(a,
      - b,
      c, d, e) S
      |
      hlist_for_each_entry_continue_rcu(a,
      - b,
      c) S
      |
      nr_neigh_for_each(a,
      - b,
      c) S
      |
      nr_neigh_for_each_safe(a,
      - b,
      c, d) S
      |
      nr_node_for_each(a,
      - b,
      c) S
      |
      nr_node_for_each_safe(a,
      - b,
      c, d) S
      |
      - for_each_gfn_sp(a, c, d, b) S
      + for_each_gfn_sp(a, c, d) S
      |
      - for_each_gfn_indirect_valid_sp(a, c, d, b) S
      + for_each_gfn_indirect_valid_sp(a, c, d) S
      |
      for_each_host(a,
      - b,
      c) S
      |
      for_each_host_safe(a,
      - b,
      c, d) S
      |
      for_each_mesh_entry(a,
      - b,
      c, d) S
      )
          ...+>
      
      [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
      [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
      [akpm@linux-foundation.org: checkpatch fixes]
      [akpm@linux-foundation.org: fix warnings]
      [akpm@linux-foudnation.org: redo intrusive kvm changes]
      Tested-by: NPeter Senna Tschudin <peter.senna@gmail.com>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NSasha Levin <sasha.levin@oracle.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b67bfe0d
  20. 19 1月, 2013 2 次提交
  21. 12 1月, 2013 2 次提交
  22. 15 11月, 2012 1 次提交
    • A
      batman-adv: substitute tt_poss_change with a per-tt_entry flag · 7c1fd91d
      Antonio Quartulli 提交于
      tt_poss_change is a node-wide flag which tells whether the node is in a roaming
      state (a client recently moved to/away from it) in order to let it apply special
      re-routing rules. However this flag does not give a clear idea of the current
      state because it is not possible to understand *which client* is actually
      involved in the roaming. For this reason a better approach has been chosen:
      instead of using a node-wide variable, the roaming state is now given by a
      per-tt_entry ROAM flag which, in case of packet coming through the node, tells
      the node whether the real destination is in roaming state or not.
      
      With this flag change, batadv_check_unicast_ttvn() has also been rearranged in
      order to better fit the new re-routing logic and to be much more readable.
      Signed-off-by: NAntonio Quartulli <ordex@autistici.org>
      7c1fd91d