History log of /net/batman-adv/originator.h
Revision Date Author Comments
08bf0ed29c7ded45c477d08618220dd200c3524a 29-Jan-2014 Antonio Quartulli <antonio@open-mesh.com> batman-adv: avoid potential race condition when adding a new neighbour

When adding a new neighbour it is important to atomically
perform the following:
- check if the neighbour already exists
- append the neighbour to the proper list

If the two operations are not performed in an atomic context
it is possible that two concurrent insertions add the same
neighbour twice.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
e19f9759edf811c94cf6f2dd67d08e6c86260741 04-Jan-2014 Simon Wunderlich <sw@simonwunderlich.de> batman-adv: update copyright years for 2014

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
cb1c92ec37fb70543d133a1fa7d9b54d6f8a1ecd 21-Nov-2013 Simon Wunderlich <simon@open-mesh.com> batman-adv: add debugfs support to view multiif tables

Show tables for the multi interface operation. Originator tables
are added per hard interface.

This patch also changes the API by adding the interface to the
bat_orig_print() parameters.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
7351a4822d42827ba0110677c0cbad88a3d52585 13-Nov-2013 Simon Wunderlich <simon@open-mesh.com> batman-adv: split out router from orig_node

For the network wide multi interface optimization there are different
routers for each outgoing interface (outgoing from the OGM perspective,
incoming for payload traffic). To reflect this, change the router and
associated data to a list of routers.

While at it, rename batadv_orig_node_get_router() to
batadv_orig_router_get() to follow the new naming scheme.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
89652331c00f43574515059ecbf262d26d885717 13-Nov-2013 Simon Wunderlich <simon@open-mesh.com> batman-adv: split tq information in neigh_node struct

For the network wide multi interface optimization it is required to save
metrics per outgoing interface in one neighbor. Therefore a new type is
introduced to keep interface-specific information. This also requires
some changes in access and list management.

The compare and equiv_or_better API calls are changed to take the
outgoing interface into consideration.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
ebf38fb7ab18ba60460bbd03de760ad5a2f435eb 03-Nov-2013 Antonio Quartulli <antonio@meshcoding.com> batman-adv: remove FSF address from GPL disclaimer

As suggested by checkpatch, remove all the references to the
FSF address since the kernel already has one reference in
its documentation.

In this way it is easier to update it in case of future
changes.

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
bbad0a5e3691cb3976d7a4815c47d9b7bb244731 02-Sep-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: make struct batadv_orig_node algorithm agnostic

some of the struct batadv_orig_node members are B.A.T.M.A.N. IV
specific and therefore they are moved in a algorithm specific
substruct in order to make batadv_orig_node routing algorithm
agnostic

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
0538f7599157b7bdef1814472048de5351c4fd6d 02-Sep-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: make struct batadv_neigh_node algorithm agnostic

some of the fields in struct batadv_neigh_node are strictly
related to the B.A.T.M.A.N. IV algorithm. In order to
make the struct usable by any routing algorithm it has to be
split and made more generic

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
7ea7b4a142758deaf46c1af0ca9ceca6dd55138b 30-Jul-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: make the TT CRC logic VLAN specific

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: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
863dd7a82a2fba3e1a094c3d10a9cc8d1afd10d6 25-Mar-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: drop useless argument seqno in neighbor creation

the sequence number is not stored in struct neigh_node,
therefore there is no need to pass such value to the
neigh_node creation procedure.

At the moment the value is only used by a debug message, but
given the fact that the seqno is not related to the neighbor
object, it is better to print it elsewhere.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
72822225bd41320a98f5d7cde38317766e18983f 15-Apr-2013 Linus Lüssing <linus.luessing@web.de> batman-adv: Fix rcu_barrier() miss due to double call_rcu() in TT code

rcu_barrier() only waits for the currently scheduled rcu functions
to finish - it won't wait for any function scheduled via another
call_rcu() within an rcu scheduled function.

Unfortunately our batadv_tt_orig_list_entry_free_ref() does just that,
via a batadv_orig_node_free_ref() call, leading to our rcu_barrier()
call potentially missing such a batadv_orig_node_free_ref().

This patch fixes this issue by calling the batadv_orig_node_free_rcu()
directly from the rcu callback, removing the unnecessary, additional
call_rcu() layer here.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
b67bfe0d42cac56c512dd5da4b1b347a23f4b70a 28-Feb-2013 Sasha Levin <sasha.levin@oracle.com> hlist: drop the node parameter from iterators

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: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0b87393146244c2dc31cb3c69c45f4948ca94ee1 04-Jan-2013 Antonio Quartulli <ordex@autistici.org> batman-adv: update copyright years

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
56303d34a332be8e2f4daf7891ebc12cb7900529 05-Jun-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix types structs with batadv_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
5bf74e9ca1e618afe5a513f64ee4923115e67004 05-Jun-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix hash struct and typedef with batadv_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
1eda58bfc56c43e73a0cf2bfb6e4d620ab866109 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix main static inline functions with batadv_

All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
da641193dd3117ccd408dc589a131f16286b0da0 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix originator static inline functions with batadv_

All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
9cfc7bd608b97463993b4f3e4775d99022253f8d 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Reformat multiline comments to consistent style

batman-adv doesn't follow the style for multiline comments that David S. Miller
prefers. All comments should be reformatted to follow this consistent style to
make the code slightly more readable.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
7d211efc5087bc8870fa3374da88b4bf8159e79b 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix originator non-static functions with batadv_

batman-adv can be compiled as part of the kernel instead of an module. In that
case the linker will see all non-static symbols of batman-adv and all other
non-static symbols of the kernel. This could lead to symbol collisions. A
prefix for the batman-adv symbols that defines their private namespace avoids
such a problem.

Reported-by: David Miller <davem@davemloft.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
7ae8b2852f946c71fdbd910156baa605a4ae3cee 01-Mar-2012 Marek Lindner <lindner_marek@yahoo.de> batman-adv: split neigh_new function into generic and batman iv specific parts

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
567db7b0b7c0a94cc62846f8ebb429bdda2884bc 01-Jan-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Update copyright years

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
c90681b8505946761b55d4981c9c3b56b3c4171b 05-Oct-2011 Antonio Quartulli <ordex@autistici.org> batman-adv: fixed hash functions type to uint32_t instead of int

There are two reasons for this fix:
- the result of choose_orig() and vis_choose() is an index and therefore it can't
be negative. Hence it is correct to make the return type unsigned too.

- sizeof(int) may not be the same on ALL the architectures. Since we plan to use
choose_orig() as DHT hash function, we need to guarantee that, given the same
argument, the result is the same. Then it is correct to explicitly express
the size of the return type (and the second argument). Since the expected
length is currently 4, uint32_t is the most convenient choice.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
b8e2dd135c3d8b06a4bc6d52b69317bdcccf4605 15-Jun-2011 Sven Eckelmann <sven@narfation.org> batman-adv: Move compare_orig to originator.c

compare_orig is only used in context of orig_node which is managed
inside originator.c. It is not necessary to keep that function inside
the header originator.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
747e4221a03cde62402b614ca1f8e961b8416130 14-May-2011 Sven Eckelmann <sven@narfation.org> batman-adv: Add const type qualifier for pointers

batman-adv uses pointers which are marked as const and should not
violate that type qualifier by passing it to functions which force a
cast to the non-const version.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
e1a5382f978b67b5cc36eec65e6046730ce07714 14-Mar-2011 Linus Lüssing <linus.luessing@web.de> batman-adv: Make orig_node->router an rcu protected pointer

The rcu protected macros rcu_dereference() and rcu_assign_pointer()
for the orig_node->router need to be used, as well as spin/rcu locking.
Otherwise we might end up using a router pointer pointing to already
freed memory.

Therefore this commit introduces the safe getter method
orig_node_get_router().

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
e6c10f433af9c98994c94a10ae862c152fcfb2a9 18-Feb-2011 Marek Lindner <lindner_marek@yahoo.de> batman-adv: rename batman_if struct to hard_iface

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
7b36e8eef989fc59535b4f1d3fc0f83afaf419d4 18-Feb-2011 Marek Lindner <lindner_marek@yahoo.de> batman-adv: Correct rcu refcounting for orig_node

It might be possible that 2 threads access the same data in the same
rcu grace period. The first thread calls call_rcu() to decrement the
refcount and free the data while the second thread increases the
refcount to use the data. To avoid this race condition all refcount
operations have to be atomic.

Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
7aadf889e897155c45cda230d2a6701ad1fbff61 18-Feb-2011 Marek Lindner <lindner_marek@yahoo.de> batman-adv: remove extra layer between hash and hash element - hash bucket

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
44524fcdf6ca19b58c24f7622c4af1d8d8fe59f8 10-Feb-2011 Marek Lindner <lindner_marek@yahoo.de> batman-adv: Correct rcu refcounting for neigh_node

It might be possible that 2 threads access the same data in the same
rcu grace period. The first thread calls call_rcu() to decrement the
refcount and free the data while the second thread increases the
refcount to use the data. To avoid this race condition all refcount
operations have to be atomic.

Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
a4c135c561106c397bae33455acfca4aa8065a30 19-Jan-2011 Simon Wunderlich <siwu@hrz.tu-chemnitz.de> batman-adv: protect bonding with rcu locks

bonding / alternating candidates need to be secured by rcu locks
as well. This patch therefore converts the bonding list
from a plain pointer list to a rcu securable lists and references
the bonding candidates.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
16b1aba849eeb45d51a5de731cf103143439ffe1 19-Jan-2011 Marek Lindner <lindner_marek@yahoo.de> batman-adv: protect originator nodes with reference counters

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
a8e7f4bc38c4a90ee308cd7f1f8604f71db59d05 12-Dec-2010 Marek Lindner <lindner_marek@yahoo.de> batman-adv: protect neighbor nodes with reference counters

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
64afe35398269577ef9809474dd7dc0e5d265176 27-Jan-2011 Sven Eckelmann <sven@narfation.org> batman-adv: Update copyright years

Signed-off-by: Sven Eckelmann <sven@narfation.org>
c6c8fea29769d998d94fcec9b9f14d4b52b349d3 13-Dec-2010 Sven Eckelmann <sven@narfation.org> net: Add batman-adv meshing protocol

B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is a routing
protocol for multi-hop ad-hoc mesh networks. The networks may be wired or
wireless. See http://www.open-mesh.org/ for more information and user space
tools.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>