aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.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/routing.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/routing.c')
-rw-r--r--net/batman-adv/routing.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 71d4211beb23..a1d8c9b0f902 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -29,6 +29,7 @@
29#include "originator.h" 29#include "originator.h"
30#include "vis.h" 30#include "vis.h"
31#include "unicast.h" 31#include "unicast.h"
32#include "bridge_loop_avoidance.h"
32 33
33static int route_unicast_packet(struct sk_buff *skb, 34static int route_unicast_packet(struct sk_buff *skb,
34 struct hard_iface *recv_if); 35 struct hard_iface *recv_if);
@@ -1071,6 +1072,12 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
1071 /* rebroadcast packet */ 1072 /* rebroadcast packet */
1072 add_bcast_packet_to_list(bat_priv, skb, 1); 1073 add_bcast_packet_to_list(bat_priv, skb, 1);
1073 1074
1075 /* don't hand the broadcast up if it is from an originator
1076 * from the same backbone.
1077 */
1078 if (bla_is_backbone_gw(skb, orig_node, hdr_size))
1079 goto out;
1080
1074 /* broadcast for me */ 1081 /* broadcast for me */
1075 interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size); 1082 interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size);
1076 ret = NET_RX_SUCCESS; 1083 ret = NET_RX_SUCCESS;