History log of /net/batman-adv/bridge_loop_avoidance.c
Revision Date Author Comments
d46b6bfa7628030a93e05f7087b7c638a85b4a35 23-Jun-2014 Simon Wunderlich <simon@open-mesh.com> batman-adv: drop QinQ claim frames in bridge loop avoidance

Since bridge loop avoidance only supports untagged or simple 802.1q
tagged VLAN claim frames, claim frames with stacked VLAN headers (QinQ)
should be detected and dropped. Transporting the over the mesh may cause
problems on the receivers, or create bogus entries in the local tt
tables.

Reported-by: Antonio Quartulli <antonio@open-mesh.com>
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>
8fdd01530cda849ba531e7e9d8674fbc81ab5782 22-Jan-2014 Antonio Quartulli <antonio@meshcoding.com> batman-adv: prefer ether_addr_copy to memcpy

On some architectures ether_addr_copy() is slightly faster
than memcpy() therefore use the former when possible.

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
e88b617d84b53170f0781cc0756019c5b1855890 19-Jan-2014 Linus Lüssing <linus.luessing@web.de> batman-adv: remove obsolete skb_reset_mac_header() in batadv_bla_tx()

Our .ndo_start_xmit handler (batadv_interface_tx()) can rely on having
the skb mac header pointer set correctly since the following commit
present in kernels >= 3.9:

"net: reset mac header in dev_start_xmit()" (6d1ccff627)

Therefore this commit removes the according, now redundant,
skb_reset_mac_header() call in batadv_bla_tx().

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
927c2ed7e5879a96759aadda94404d516ce9fb42 19-Jan-2014 Linus Lüssing <linus.luessing@web.de> batman-adv: use vlan_/eth_hdr() instead of skb->data in interface_tx path

Our .ndo_start_xmit handler (batadv_interface_tx()) can rely on having
the skb mac header pointer set correctly since the following commit
present in kernels >= 3.9:

"net: reset mac header in dev_start_xmit()" (6d1ccff627)

Therefore we can safely use eth_hdr() and vlan_eth_hdr() instead of
skb->data now, which spares us some ugly type casts.

At the same time set the mac_header in batadv_dat_snoop_incoming_arp_request()
before sending the skb along the TX path.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
1b371d13071d6b6b9dc7a00fe1bc5a6babd68a5b 15-Jan-2014 Simon Wunderlich <sw@simonwunderlich.de> batman-adv: use consistent kerneldoc style

Reported-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
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>
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>
cfd4f75701b6b13b1ec74e6f65ad0d1969c19247 07-Aug-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: make the backbone gw check VLAN specific

The backbone gw check has to be VLAN specific so that code
using it can specify VID where the check has to be done.

In the TT code, the check has been moved into the
tt_global_add() function so that it can be performed on a
per-entry basis instead of ignoring all the TT data received
from another backbone node. Only TT global entries belonging
to the VLAN where the backbone node is connected to are
skipped.
All the other spots where the TT code was checking whether a
node is a backbone have been removed.

Moreover, batadv_bla_is_backbone_gw_orig() now returns bool
since it used to return only 1 or 0.

Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
95fb130d68656174a417ad19e7bc8e8ecf382dab 07-Aug-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: make the TT global purge routine VLAN specific

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: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
c018ad3de61a1dc4194879a53e5559e094aa7b1a 04-Jun-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: add the VLAN ID attribute to the TT entry

To make the translation table code VLAN-aware, each entry
must carry the VLAN ID which it belongs to. This patch adds
such attribute to the related TT structures.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
293e93385e024be71500c9480ef85d6199459d17 19-May-2013 Antonio Quartulli <ordex@autistici.org> batman-adv: use htons when possible

When comparing a network ordered value with a constant, it
is better to convert the constant at compile time by means
of htons() instead of converting the value at runtime using
ntohs().

This refactoring may slightly improve the code performance.

Moreover substitute __constant_htons() with htons() since
the latter increase readability and it is smart enough to be
as efficient as the former

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
2c598663e84c8c8edbbac568e9e94e1fac410c3c 12-May-2013 Antonio Quartulli <ordex@autistici.org> batman-adv: use VLAN_ETH_HLEN instead of sizeof(struct vlan_eth_hdr)

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
9d2c9488cedb666bc8206fbdcdc1575e0fbc5929 06-Aug-2013 Linus Lüssing <linus.luessing@web.de> batman-adv: fix potential kernel paging errors for unicast transmissions

There are several functions which might reallocate skb data. Currently
some places keep reusing their old ethhdr pointer regardless of whether
they became invalid after such a reallocation or not. This potentially
leads to kernel paging errors.

This patch fixes these by refetching the ethdr pointer after the
potential reallocations.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
d5b4c93e67b0b1291aa8e2aaf694e40afc3412d0 07-Jun-2013 Simon Wunderlich <simon@open-mesh.com> batman-adv: Don't handle address updates when bla is disabled

The bridge loop avoidance has a hook to handle address updates of the
originator. These should not be handled when bridge loop avoidance is
disabled - it might send some bridge loop avoidance packets which should
not appear if bla is disabled.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
5f80df6705fcd8153f93bd0e82109dbeb7ff535b 19-Apr-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: print the VID properly

Since the MSB bits of any vid variable are now used for
storing flags, print the vid properly by taking the flags
away and printing -1 in case of VID representing no real
VLAN.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
eb2deb6b39b1597577c1635e9ebf319f1ae02213 19-Apr-2013 Antonio Quartulli <antonio@open-mesh.com> batman-adv: change VID semantic in the BLA code

In order to make batman-adv fully vlan aware later, the
semantic used for variables storing the VLAN ID values has
to be changed in order to be adapted to the new one which
will be used batman-adv wide.

In particular, the VID has to be an "_unsigned_ short int"
and its 4 MSB will be used as a flag bitfield, while the
remaining 12 bits are used to store the real VID value

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
7ed4be9523455a061e62236dc3caa9211cd7edda 08-Apr-2013 Antonio Quartulli <ordex@autistici.org> batman-adv: use eth_hdr() when it makes sense

Instead of casting the result of skb_mac_header() to
"struct ethhdr *" every time, the eth_hdr inline function
can be use to beautify the code and improve its readability.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
86a9bad3ab6b6f858fd4443b48738cabbb6d094c 19-Apr-2013 Patrick McHardy <kaber@trash.net> net: vlan: add protocol argument to packet tagging functions

Add a protocol argument to the VLAN packet tagging functions. In case of HW
tagging, we need that protocol available in the ndo_start_xmit functions,
so it is stored in a new field in the skb. The new field fits into a hole
(on 64 bit) and doesn't increase the sks's size.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
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>
712bbfe46b3004603762adb506baff99be0f8d8c 25-Dec-2012 Marek Lindner <lindner_marek@yahoo.de> batman-adv: rename batadv_claim struct to make clear it is used by bla

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
bae987747150d8939bf385863f49e2647db15e2a 25-Dec-2012 Marek Lindner <lindner_marek@yahoo.de> batman-adv: rename batadv_backbone_gw struct to make clear it is used by bla

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
7241444209f88f804ea33483394a601c1afb1d64 25-Dec-2012 Antonio Quartulli <ordex@autistici.org> batman-adv: a delayed_work has to be initialised once

A delayed_work struct does not need to be initialized each
every time before being enqueued. Therefore the
INIT_DELAYED_WORK() macro should be used during the
initialization process only.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
467b5fe69716257ebe17a9df9c428ad32eba540a 07-Dec-2012 Antonio Quartulli <antonio@open-mesh.com> batman-adv: use the const qualifier in hash functions

The data argument in each hash function should carry the
"const" qualifier as it is never modified.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
46d160ef887963f26fee2df3d3b99eab54637014 01-Dec-2012 Antonio Quartulli <ordex@autistici.org> batman-adv: remove useless blank lines before and after brackets

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
39a329915889a220b5f2c3f2eb3d7fd892567715 19-Nov-2012 Antonio Quartulli <ordex@autistici.org> batman-adv: unify and properly print hex values

Values are printed in hexadecimal format in several points in the
code, but they are not printed using the same format string.

This patches unifies the format used for such numbers so that they
look the same everywhere.

Given the fact that all the variables printed as hexadecimal are 16
bit long, this is the chosen printing format: %#.4x

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
004e86fc585f617f07bff38480eeee335be9b017 18-Oct-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: Fix broadcast duplist for fragmentation

If the skb is fragmented, the checksum must be computed on the
individual fragments, just using skb->data may fail on fragmented
data. Instead of doing linearizing the packet, use the new
batadv_crc32 to do that more efficiently- it should not hurt
replacing the old crc16 by the new crc32.

Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
c76d15253aeaf8ee3beee932d1950296431bec96 15-Oct-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: fix bla compare function

The address and the VLAN VID may not be packed in the respective
structs. Fix this by comparing the elements individually.

Reported-by: Marek Lindner <lindner_marek@yahoo.de>
Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
28709878b6a7d15362ba63bde01d42c38f88be9d 13-Sep-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: wait multiple periods before activating bla

For some reasons (bridge forward delay, network device setup order, etc)
the initial bridge loop avoidance announcement packets may be lost. This
may lead to problems in finding other backbone gws, and therfore create
loops in the startup time.

Fix this by extending the waiting periods to 3 (define can be changed)
before allowing broadcast traffic.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
d807f2728708c54a1ac1ce04d4549d8eb2b996d2 09-Sep-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: allow bla traffic only after first worker period

When adding a backbone gateway for the first time, it might not yet
be known in the backbone, and therefore we should not forward
broadcasts yet. This behaviour is the same as when sending a request
to another backbone gw because of a CRC mismatch. The backbone gw
will operate normal after the next periodic bla work.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
52aebd6a9fe4ad0245a00ef4457425ad83661c90 08-Sep-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: send announcement when backbone gw is registered

To avoid loops in the startup phase until the first announcement is
sent, send an announcement immediately as soon as a backbone gw is
added.

This may happen due to various reasons, e.g. a packet passes the rx
or tx path.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
07568d0369f93cd54d2e5ca6f5c64f5b55557857 30-Aug-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: don't rely on positions in struct for hashing

The hash functions in the bridge loop avoidance code expects the
VLAN vid to be right after the mac address, but this is not guaranteed.

Fix this by explicitly hashing over the right fields of the struct.

Reported-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
30da63a6af1dbf60e6d989faa4b984b1c6c9dfaf 03-Aug-2012 Marek Lindner <lindner_marek@yahoo.de> batman-adv: consolidate duplicated primary_if checking code

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
7dac7b76b8db87fc79857a53a09730fb2148579b 17-Oct-2012 Linus Lüssing <linus.luessing@web.de> batman-adv: Fix potential broadcast BLA-duplicate-check race condition

Threads in the bottom half of batadv_bla_check_bcast_duplist() might
otherwise for instance overwrite variables which other threads might
be using/reading at the same time in the top half, potentially
leading to messing up the bcast_duplist, possibly resulting in false
bridge loop avoidance duplicate check decisions.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
7f112af40fecf5399b61e69ffc6b55a9d82789f7 17-Oct-2012 Linus Lüssing <linus.luessing@web.de> batman-adv: Fix broadcast packet CRC calculation

So far the crc16 checksum for a batman-adv broadcast data packet, received
on a batman-adv hard interface, was calculated over zero bytes of its
content leading to many incoming broadcast data packets wrongly being
dropped (60-80% packet loss).

This patch fixes this issue by calculating the crc16 over the actual,
complete broadcast payload.

The issue is a regression introduced by
("batman-adv: add broadcast duplicate check").

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
c67893d17a6bbd16328a1ee38ab0cb460511014a 08-Jul-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Reduce accumulated length of simple statements

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
bbb1f90efba89b31fc5e329d5fcaf10aca99212b 08-Jul-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Don't break statements after assignment operator

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
807736f6e00714fdeb443b31061d1c27fa903296 15-Jul-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Split batadv_priv in sub-structures for features

The structure batadv_priv grows everytime a new feature is introduced. It gets
hard to find the parts of the struct that belongs to a specific feature. This
becomes even harder by the fact that not every feature uses a prefix in the
member name.

The variables for bridge loop avoidence, gateway handling, translation table
and visualization server are moved into separate structs that are included in
the bat_priv main struct.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
1c9b0550f4813c4931b4e142c80f5c89be9489ec 23-Jun-2012 Marek Lindner <lindner_marek@yahoo.de> batman-adv: convert remaining packet counters to per_cpu_ptr() infrastructure

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
3eb8773e3a24d88ca528993af3756af70f307a82 23-Jun-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: rename bridge loop avoidance claim types

for consistency reasons within the code and with the documentation,
we should always call it "claim" and "unclaim".

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
99e966fc969360bed8d3bb71c144fa10ba7a12d0 23-Jun-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: correct comments in bridge loop avoidance

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
536a23f119e35e58c762a219bafd398ba2ed7980 18-Jun-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: Add the backbone gateway list to debugfs

This is especially useful if there are no claims yet, but we still want
to know which gateways are using bridge loop avoidance in the network.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
2c53040f018b6c36a46eec75b9b937aaa5f78e6d 10-Jul-2012 Ben Hutchings <bhutchings@solarflare.com> net: Fix (nearly-)kernel-doc comments for various functions

Fix incorrect start markers, wrapped summary lines, missing section
breaks, incorrect separators, and some name mismatches.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2d3f6ccc4ea5c74d4b4af1b47c56b4cff4bbfcb7 04-Jul-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: check incoming packet type for bla

If the gateway functionality is used, some broadcast packets (DHCP
requests) may be transmitted as unicast packets. As the bridge loop
avoidance code now only considers the payload Ethernet destination,
it may drop the DHCP request for clients which are claimed by other
backbone gateways, because it falsely infers from the broadcast address
that the right backbone gateway should havehandled the broadcast.

Fix this by checking and delegating the batman-adv packet type used
for transmission.

Reported-by: Guido Iribarren <guidoiribarren@buenosaireslibre.org>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.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>
96412690116afcc1b2705615b5a7c8dc6c5e905f 05-Jun-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix packet 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>
39c75a51eda38ca5ce8b75f0a62a621eb3820a54 03-Jun-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix main enum with BATADV_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
acd34afa89772f6379b642bb979d0a112328c769 03-Jun-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix packet enum with BATADV_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
e9a4f295ebe06b00d6af5597c0cea78c315c2ebc 03-Jun-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix hard-interface enum with BATADV_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
42d0b044b7c9e5821f1bf3e2b4ea7861417c11c2 03-Jun-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix main defines with BATADV_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
3964f7285eba48b971b11dc51ba0a6e41cb995b3 03-Jun-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix bridge_loop_avoidance defines with BATADV_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
3b300de322014f529b2e0a72a92c414686b85671 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix bridge_loop_avoidance local static 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>
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>
c0a559295eb2601602f7dc88f4240afcd666f73a 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix hash 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>
e5d89254bf763da35b42a3c65289c9962f7240c2 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix hard-interface 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>
3193e8fdfa355289892661d206d1954114a7be95 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix main 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>
08c36d3e8ad1f73d3b0322842363b23f6d203630 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix translation-table 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>
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>
1a8eaf0733ca754533a03d6cfa4463def2b81ce3 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix hash 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>
08adf1512298201a53b88bb0a3d67e0dbbe0ed9b 12-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Prefix bridge_loop_avoidance 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>
5346c35ebfbdb1727e60079456dd8071cb888059 05-May-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Return error codes instead of -1 on failures

Signed-off-by: Sven Eckelmann <sven@narfation.org>
3e2f1a1bb528df14065a9287f37378ca453c52f9 22-Apr-2012 Al Viro <viro@ZenIV.linux.org.uk> batman-adv: trivial endianness annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
1a5852d81a664e5a6456f82dff6f31b06dc2bede 22-Apr-2012 Al Viro <viro@ZenIV.linux.org.uk> batman-adv: get rid of pointless cast in memcpy()

memcpy() arguments are void *, precisely to avoid that kind of pointless
casts.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
5d52dad27a08d2c8851acb12b041088ec07881dd 29-Mar-2012 Sven Eckelmann <sven@narfation.org> batman-adv: Initialize lockdep class keys for hashes

The hash for claim and backbone hash in the bridge loop avoidance code receive
the same key because they are getting initialized by hash_new with the same
key. Lockdep will create a backtrace when they are used recursively. This can
be avoided by reinitializing the key directly after the hash_new.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
c64703aace094bd2836bb0755b7faf8b4cbab998 14-Mar-2012 Antonio Quartulli <ordex@autistici.org> batman-adv: update copyright years

update copyright years in order to include 2012

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
0d125074ebc8c971e939f8c2c8f90a80fa09aeb4 18-Feb-2012 Antonio Quartulli <ordex@autistici.org> batman-adv: use ETH_HLEN instead of sizeof(struct ethhdr)

Instead of using sizeof(struct ethhdr) it is strongly recommended to use the
kernel macro ETH_HLEN. This patch substitute each occurrence of the former
expressione with the latter one.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
e88af9464f8ba6bec5a5213065ce8d98b2f2ac1a 18-Apr-2012 Antonio Quartulli <ordex@autistici.org> batman-adv: remove duplicated line in comment

Remove an accidentally added duplicated line in a function comment

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
38ef3d1d919e6a47c3e0d38b3d788aa468a7ede8 22-Jan-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: form groups in the bridge loop avoidance

backbone gateways may be part of the same LAN, but participate
in different meshes. With this patch, backbone gateways form groups by
applying the groupid of another backbone gateway if it is higher. After
forming the group, they only accept messages from backbone gateways of
the same group.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
fe2da6ff27c73c1d102ec2189f94e8bc729d1a9b 22-Jan-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: add broadcast duplicate check

When multiple backbone gateways relay the same broadcast from the
backbone into the mesh, other nodes in the mesh may receive this
broadcast multiple times. To avoid this, the crc checksums of
received broadcasts are recorded and new broadcast packets with
the same content may be dropped if received by another gateway.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
20ff9d593f8ff20c2ef24498f77a8bc30b3a059a 22-Jan-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: don't let backbone gateways exchange tt entries

As the backbone gateways are connected to the same backbone, they
should announce the same clients on the backbone non-exclusively.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
9bf8e4d4254397684250eae29a0dc12d54a00251 22-Jan-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: export claim tables through debugfs

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
23721387c409087fd3b97e274f34d3ddc0970b74 22-Jan-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> batman-adv: add basic bridge loop avoidance code

This second version of the bridge loop avoidance for batman-adv
avoids loops between the mesh and a backbone (usually a LAN).

By connecting multiple batman-adv mesh nodes to the same ethernet
segment a loop can be created when the soft-interface is bridged
into that ethernet segment. A simple visualization of the loop
involving the most common case - a LAN as ethernet segment:

node1 <-- LAN --> node2
| |
wifi <-- mesh --> wifi

Packets from the LAN (e.g. ARP broadcasts) will circle forever from
node1 or node2 over the mesh back into the LAN.

With this patch, batman recognizes backbone gateways, nodes which are
part of the mesh and backbone/LAN at the same time. Each backbone
gateway "claims" clients from within the mesh to handle them
exclusively. By restricting that only responsible backbone gateways
may handle their claimed clients traffic, loops are effectively
avoided.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>