Skip to content

Commit c6c8fea

Browse files
ecsvdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b236da6 commit c6c8fea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+10278
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
What: /sys/class/net/<iface>/batman-adv/mesh_iface
3+
Date: May 2010
4+
Contact: Marek Lindner <[email protected]>
5+
Description:
6+
The /sys/class/net/<iface>/batman-adv/mesh_iface file
7+
displays the batman mesh interface this <iface>
8+
currently is associated with.
9+
10+
What: /sys/class/net/<iface>/batman-adv/iface_status
11+
Date: May 2010
12+
Contact: Marek Lindner <[email protected]>
13+
Description:
14+
Indicates the status of <iface> as it is seen by batman.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
What: /sys/class/net/<mesh_iface>/mesh/aggregated_ogms
3+
Date: May 2010
4+
Contact: Marek Lindner <[email protected]>
5+
Description:
6+
Indicates whether the batman protocol messages of the
7+
mesh <mesh_iface> shall be aggregated or not.
8+
9+
What: /sys/class/net/<mesh_iface>/mesh/bonding
10+
Date: June 2010
11+
Contact: Simon Wunderlich <[email protected]>
12+
Description:
13+
Indicates whether the data traffic going through the
14+
mesh will be sent using multiple interfaces at the
15+
same time (if available).
16+
17+
What: /sys/class/net/<mesh_iface>/mesh/fragmentation
18+
Date: October 2010
19+
Contact: Andreas Langer <[email protected]>
20+
Description:
21+
Indicates whether the data traffic going through the
22+
mesh will be fragmented or silently discarded if the
23+
packet size exceeds the outgoing interface MTU.
24+
25+
What: /sys/class/net/<mesh_iface>/mesh/gw_bandwidth
26+
Date: October 2010
27+
Contact: Marek Lindner <[email protected]>
28+
Description:
29+
Defines the bandwidth which is propagated by this
30+
node if gw_mode was set to 'server'.
31+
32+
What: /sys/class/net/<mesh_iface>/mesh/gw_mode
33+
Date: October 2010
34+
Contact: Marek Lindner <[email protected]>
35+
Description:
36+
Defines the state of the gateway features. Can be
37+
either 'off', 'client' or 'server'.
38+
39+
What: /sys/class/net/<mesh_iface>/mesh/gw_sel_class
40+
Date: October 2010
41+
Contact: Marek Lindner <[email protected]>
42+
Description:
43+
Defines the selection criteria this node will use
44+
to choose a gateway if gw_mode was set to 'client'.
45+
46+
What: /sys/class/net/<mesh_iface>/mesh/orig_interval
47+
Date: May 2010
48+
Contact: Marek Lindner <[email protected]>
49+
Description:
50+
Defines the interval in milliseconds in which batman
51+
sends its protocol messages.
52+
53+
What: /sys/class/net/<mesh_iface>/mesh/hop_penalty
54+
Date: Oct 2010
55+
Contact: Linus Lüssing <[email protected]>
56+
Description:
57+
Defines the penalty which will be applied to an
58+
originator message's tq-field on every hop.
59+
60+
What: /sys/class/net/<mesh_iface>/mesh/vis_mode
61+
Date: May 2010
62+
Contact: Marek Lindner <[email protected]>
63+
Description:
64+
Each batman node only maintains information about its
65+
own local neighborhood, therefore generating graphs
66+
showing the topology of the entire mesh is not easily
67+
feasible without having a central instance to collect
68+
the local topologies from all nodes. This file allows
69+
to activate the collecting (server) mode.
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
[state: 21-11-2010]
2+
3+
BATMAN-ADV
4+
----------
5+
6+
Batman advanced is a new approach to wireless networking which
7+
does no longer operate on the IP basis. Unlike the batman daemon,
8+
which exchanges information using UDP packets and sets routing
9+
tables, batman-advanced operates on ISO/OSI Layer 2 only and uses
10+
and routes (or better: bridges) Ethernet Frames. It emulates a
11+
virtual network switch of all nodes participating. Therefore all
12+
nodes appear to be link local, thus all higher operating proto-
13+
cols won't be affected by any changes within the network. You can
14+
run almost any protocol above batman advanced, prominent examples
15+
are: IPv4, IPv6, DHCP, IPX.
16+
17+
Batman advanced was implemented as a Linux kernel driver to re-
18+
duce the overhead to a minimum. It does not depend on any (other)
19+
network driver, and can be used on wifi as well as ethernet lan,
20+
vpn, etc ... (anything with ethernet-style layer 2).
21+
22+
CONFIGURATION
23+
-------------
24+
25+
Load the batman-adv module into your kernel:
26+
27+
# insmod batman-adv.ko
28+
29+
The module is now waiting for activation. You must add some in-
30+
terfaces on which batman can operate. After loading the module
31+
batman advanced will scan your systems interfaces to search for
32+
compatible interfaces. Once found, it will create subfolders in
33+
the /sys directories of each supported interface, e.g.
34+
35+
# ls /sys/class/net/eth0/batman_adv/
36+
# iface_status mesh_iface
37+
38+
If an interface does not have the "batman_adv" subfolder it prob-
39+
ably is not supported. Not supported interfaces are: loopback,
40+
non-ethernet and batman's own interfaces.
41+
42+
Note: After the module was loaded it will continuously watch for
43+
new interfaces to verify the compatibility. There is no need to
44+
reload the module if you plug your USB wifi adapter into your ma-
45+
chine after batman advanced was initially loaded.
46+
47+
To activate a given interface simply write "bat0" into its
48+
"mesh_iface" file inside the batman_adv subfolder:
49+
50+
# echo bat0 > /sys/class/net/eth0/batman_adv/mesh_iface
51+
52+
Repeat this step for all interfaces you wish to add. Now batman
53+
starts using/broadcasting on this/these interface(s).
54+
55+
By reading the "iface_status" file you can check its status:
56+
57+
# cat /sys/class/net/eth0/batman_adv/iface_status
58+
# active
59+
60+
To deactivate an interface you have to write "none" into its
61+
"mesh_iface" file:
62+
63+
# echo none > /sys/class/net/eth0/batman_adv/mesh_iface
64+
65+
66+
All mesh wide settings can be found in batman's own interface
67+
folder:
68+
69+
# ls /sys/class/net/bat0/mesh/
70+
# aggregated_ogms bonding fragmentation orig_interval
71+
# vis_mode
72+
73+
74+
There is a special folder for debugging informations:
75+
76+
# ls /sys/kernel/debug/batman_adv/bat0/
77+
# originators socket transtable_global transtable_local
78+
# vis_data
79+
80+
81+
Some of the files contain all sort of status information regard-
82+
ing the mesh network. For example, you can view the table of
83+
originators (mesh participants) with:
84+
85+
# cat /sys/kernel/debug/batman_adv/bat0/originators
86+
87+
Other files allow to change batman's behaviour to better fit your
88+
requirements. For instance, you can check the current originator
89+
interval (value in milliseconds which determines how often batman
90+
sends its broadcast packets):
91+
92+
# cat /sys/class/net/bat0/mesh/orig_interval
93+
# 1000
94+
95+
and also change its value:
96+
97+
# echo 3000 > /sys/class/net/bat0/mesh/orig_interval
98+
99+
In very mobile scenarios, you might want to adjust the originator
100+
interval to a lower value. This will make the mesh more respon-
101+
sive to topology changes, but will also increase the overhead.
102+
103+
104+
USAGE
105+
-----
106+
107+
To make use of your newly created mesh, batman advanced provides
108+
a new interface "bat0" which you should use from this point on.
109+
All interfaces added to batman advanced are not relevant any
110+
longer because batman handles them for you. Basically, one "hands
111+
over" the data by using the batman interface and batman will make
112+
sure it reaches its destination.
113+
114+
The "bat0" interface can be used like any other regular inter-
115+
face. It needs an IP address which can be either statically con-
116+
figured or dynamically (by using DHCP or similar services):
117+
118+
# NodeA: ifconfig bat0 192.168.0.1
119+
# NodeB: ifconfig bat0 192.168.0.2
120+
# NodeB: ping 192.168.0.1
121+
122+
Note: In order to avoid problems remove all IP addresses previ-
123+
ously assigned to interfaces now used by batman advanced, e.g.
124+
125+
# ifconfig eth0 0.0.0.0
126+
127+
128+
VISUALIZATION
129+
-------------
130+
131+
If you want topology visualization, at least one mesh node must
132+
be configured as VIS-server:
133+
134+
# echo "server" > /sys/class/net/bat0/mesh/vis_mode
135+
136+
Each node is either configured as "server" or as "client" (de-
137+
fault: "client"). Clients send their topology data to the server
138+
next to them, and server synchronize with other servers. If there
139+
is no server configured (default) within the mesh, no topology
140+
information will be transmitted. With these "synchronizing
141+
servers", there can be 1 or more vis servers sharing the same (or
142+
at least very similar) data.
143+
144+
When configured as server, you can get a topology snapshot of
145+
your mesh:
146+
147+
# cat /sys/kernel/debug/batman_adv/bat0/vis_data
148+
149+
This raw output is intended to be easily parsable and convertable
150+
with other tools. Have a look at the batctl README if you want a
151+
vis output in dot or json format for instance and how those out-
152+
puts could then be visualised in an image.
153+
154+
The raw format consists of comma separated values per entry where
155+
each entry is giving information about a certain source inter-
156+
face. Each entry can/has to have the following values:
157+
-> "mac" - mac address of an originator's source interface
158+
(each line begins with it)
159+
-> "TQ mac value" - src mac's link quality towards mac address
160+
of a neighbor originator's interface which
161+
is being used for routing
162+
-> "HNA mac" - HNA announced by source mac
163+
-> "PRIMARY" - this is a primary interface
164+
-> "SEC mac" - secondary mac address of source
165+
(requires preceding PRIMARY)
166+
167+
The TQ value has a range from 4 to 255 with 255 being the best.
168+
The HNA entries are showing which hosts are connected to the mesh
169+
via bat0 or being bridged into the mesh network. The PRIMARY/SEC
170+
values are only applied on primary interfaces
171+
172+
173+
LOGGING/DEBUGGING
174+
-----------------
175+
176+
All error messages, warnings and information messages are sent to
177+
the kernel log. Depending on your operating system distribution
178+
this can be read in one of a number of ways. Try using the com-
179+
mands: dmesg, logread, or looking in the files /var/log/kern.log
180+
or /var/log/syslog. All batman-adv messages are prefixed with
181+
"batman-adv:" So to see just these messages try
182+
183+
# dmesg | grep batman-adv
184+
185+
When investigating problems with your mesh network it is some-
186+
times necessary to see more detail debug messages. This must be
187+
enabled when compiling the batman-adv module. When building bat-
188+
man-adv as part of kernel, use "make menuconfig" and enable the
189+
option "B.A.T.M.A.N. debugging".
190+
191+
Those additional debug messages can be accessed using a special
192+
file in debugfs
193+
194+
# cat /sys/kernel/debug/batman_adv/bat0/log
195+
196+
The additional debug output is by default disabled. It can be en-
197+
abled during run time. Following log_levels are defined:
198+
199+
0 - All debug output disabled
200+
1 - Enable messages related to routing / flooding / broadcasting
201+
2 - Enable route or hna added / changed / deleted
202+
3 - Enable all messages
203+
204+
The debug output can be changed at runtime using the file
205+
/sys/class/net/bat0/mesh/log_level. e.g.
206+
207+
# echo 2 > /sys/class/net/bat0/mesh/log_level
208+
209+
will enable debug messages for when routes or HNAs change.
210+
211+
212+
BATCTL
213+
------
214+
215+
As batman advanced operates on layer 2 all hosts participating in
216+
the virtual switch are completely transparent for all protocols
217+
above layer 2. Therefore the common diagnosis tools do not work
218+
as expected. To overcome these problems batctl was created. At
219+
the moment the batctl contains ping, traceroute, tcpdump and
220+
interfaces to the kernel module settings.
221+
222+
For more information, please see the manpage (man batctl).
223+
224+
batctl is available on http://www.open-mesh.org/
225+
226+
227+
CONTACT
228+
-------
229+
230+
Please send us comments, experiences, questions, anything :)
231+
232+
IRC: #batman on irc.freenode.org
233+
Mailing-list: [email protected]@lists.open-mesh.org
234+
(optional subscription at
235+
https://lists.open-mesh.org/mm/listinfo/b.a.t.m.a.n)
236+
237+
You can also contact the Authors:
238+
239+
Marek Lindner <[email protected]>
240+
Simon Wunderlich <[email protected]>

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,15 @@ S: Maintained
12641264
F: drivers/video/backlight/
12651265
F: include/linux/backlight.h
12661266

1267+
BATMAN ADVANCED
1268+
M: Marek Lindner <[email protected]>
1269+
M: Simon Wunderlich <[email protected]>
1270+
M: Sven Eckelmann <[email protected]>
1271+
1272+
W: http://www.open-mesh.org/
1273+
S: Maintained
1274+
F: net/batman-adv/
1275+
12671276
BAYCOM/HDLCDRV DRIVERS FOR AX.25
12681277
M: Thomas Sailer <[email protected]>
12691278

net/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ source "net/ieee802154/Kconfig"
214214
source "net/sched/Kconfig"
215215
source "net/dcb/Kconfig"
216216
source "net/dns_resolver/Kconfig"
217+
source "net/batman-adv/Kconfig"
217218

218219
config RPS
219220
boolean

net/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ endif
6969
obj-$(CONFIG_WIMAX) += wimax/
7070
obj-$(CONFIG_DNS_RESOLVER) += dns_resolver/
7171
obj-$(CONFIG_CEPH_LIB) += ceph/
72+
obj-$(CONFIG_BATMAN_ADV) += batman-adv/

net/batman-adv/Kconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# B.A.T.M.A.N meshing protocol
3+
#
4+
5+
config BATMAN_ADV
6+
tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
7+
depends on NET
8+
default n
9+
---help---
10+
11+
B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is
12+
a routing protocol for multi-hop ad-hoc mesh networks. The
13+
networks may be wired or wireless. See
14+
http://www.open-mesh.org/ for more information and user space
15+
tools.
16+
17+
config BATMAN_ADV_DEBUG
18+
bool "B.A.T.M.A.N. debugging"
19+
depends on BATMAN_ADV != n
20+
---help---
21+
22+
This is an option for use by developers; most people should
23+
say N here. This enables compilation of support for
24+
outputting debugging information to the kernel log. The
25+
output is controlled via the module parameter debug.

0 commit comments

Comments
 (0)