Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23721387 authored by Simon Wunderlich's avatar Simon Wunderlich Committed by Antonio Quartulli
Browse files

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: default avatarSimon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent a7f6ee94
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -68,9 +68,10 @@ All mesh wide settings can be found in batman's own interface
folder:
folder:


# ls /sys/class/net/bat0/mesh/
# ls /sys/class/net/bat0/mesh/
# aggregated_ogms   fragmentation gw_sel_class   vis_mode
# aggregated_ogms        fragmentation          hop_penalty
# ap_isolation      gw_bandwidth  hop_penalty
# ap_isolation           gw_bandwidth           log_level
# bonding                gw_mode                orig_interval
# bonding                gw_mode                orig_interval
# bridge_loop_avoidance  gw_sel_class           vis_mode




There is a special folder for debugging information:
There is a special folder for debugging information:
@@ -202,12 +203,13 @@ abled during run time. Following log_levels are defined:
1 - Enable messages related to routing / flooding / broadcasting
1 - Enable messages related to routing / flooding / broadcasting
2 - Enable messages related to route added / changed / deleted
2 - Enable messages related to route added / changed / deleted
4 - Enable messages related to translation table operations
4 - Enable messages related to translation table operations
7 - Enable all messages
8 - Enable messages related to bridge loop avoidance
15 - enable all messages


The debug output can be changed at runtime  using  the  file
The debug output can be changed at runtime  using  the  file
/sys/class/net/bat0/mesh/log_level. e.g.
/sys/class/net/bat0/mesh/log_level. e.g.


# echo 2 > /sys/class/net/bat0/mesh/log_level
# echo 6 > /sys/class/net/bat0/mesh/log_level


will enable debug messages for when routes change.
will enable debug messages for when routes change.


+1 −1
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@


config BATMAN_ADV
config BATMAN_ADV
	tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
	tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
	depends on NET
	depends on NET && INET
	select CRC16
	select CRC16
        default n
        default n
	help
	help
+1 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ batman-adv-y += bat_debugfs.o
batman-adv-y += bat_iv_ogm.o
batman-adv-y += bat_iv_ogm.o
batman-adv-y += bat_sysfs.o
batman-adv-y += bat_sysfs.o
batman-adv-y += bitarray.o
batman-adv-y += bitarray.o
batman-adv-y += bridge_loop_avoidance.o
batman-adv-y += gateway_client.o
batman-adv-y += gateway_client.o
batman-adv-y += gateway_common.o
batman-adv-y += gateway_common.o
batman-adv-y += hard-interface.o
batman-adv-y += hard-interface.o
+1 −1
Original line number Original line Diff line number Diff line
@@ -398,7 +398,7 @@ BAT_ATTR_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE,
static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, show_gw_bwidth,
static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, show_gw_bwidth,
		store_gw_bwidth);
		store_gw_bwidth);
#ifdef CONFIG_BATMAN_ADV_DEBUG
#ifdef CONFIG_BATMAN_ADV_DEBUG
BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 7, NULL);
BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 15, NULL);
#endif
#endif


static struct bat_attribute *mesh_attrs[] = {
static struct bat_attribute *mesh_attrs[] = {
Loading