aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/main.c
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2012-01-22 14:00:19 -0500
committerAntonio Quartulli <ordex@autistici.org>2012-04-11 08:28:58 -0400
commit23721387c409087fd3b97e274f34d3ddc0970b74 (patch)
treecf386c6f169a1b2b6e8c8ef77be5226e10046689 /net/batman-adv/main.c
parenta7f6ee9493677ba40625d810258de5bd521cc1b0 (diff)
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>
Diffstat (limited to 'net/batman-adv/main.c')
-rw-r--r--net/batman-adv/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 94d4968a953a..e67ca96285b3 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -30,6 +30,7 @@
30#include "translation-table.h" 30#include "translation-table.h"
31#include "hard-interface.h" 31#include "hard-interface.h"
32#include "gateway_client.h" 32#include "gateway_client.h"
33#include "bridge_loop_avoidance.h"
33#include "vis.h" 34#include "vis.h"
34#include "hash.h" 35#include "hash.h"
35#include "bat_algo.h" 36#include "bat_algo.h"
@@ -115,6 +116,9 @@ int mesh_init(struct net_device *soft_iface)
115 if (vis_init(bat_priv) < 1) 116 if (vis_init(bat_priv) < 1)
116 goto err; 117 goto err;
117 118
119 if (bla_init(bat_priv) < 1)
120 goto err;
121
118 atomic_set(&bat_priv->gw_reselect, 0); 122 atomic_set(&bat_priv->gw_reselect, 0);
119 atomic_set(&bat_priv->mesh_state, MESH_ACTIVE); 123 atomic_set(&bat_priv->mesh_state, MESH_ACTIVE);
120 goto end; 124 goto end;
@@ -142,6 +146,8 @@ void mesh_free(struct net_device *soft_iface)
142 146
143 tt_free(bat_priv); 147 tt_free(bat_priv);
144 148
149 bla_free(bat_priv);
150
145 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE); 151 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
146} 152}
147 153