Skip to content

Commit

Permalink
staging: batman-adv meshing protocol
Browse files Browse the repository at this point in the history
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.

This is the first submission for inclusion in staging.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Andrew Lunn authored and Greg Kroah-Hartman committed Dec 11, 2009
1 parent 6638db5 commit 5beef3c
Show file tree
Hide file tree
Showing 38 changed files with 7,101 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ source "drivers/staging/wlags49_h2/Kconfig"

source "drivers/staging/wlags49_h25/Kconfig"

source "drivers/staging/batman-adv/Kconfig"

source "drivers/staging/strip/Kconfig"

source "drivers/staging/arlan/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_RAMZSWAP) += ramzswap/
obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/
obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/
obj-$(CONFIG_BATMAN_ADV) += batman-adv/
obj-$(CONFIG_STRIP) += strip/
obj-$(CONFIG_ARLAN) += arlan/
obj-$(CONFIG_WAVELAN) += wavelan/
Expand Down
37 changes: 37 additions & 0 deletions drivers/staging/batman-adv/CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
batman-adv 0.2:

* support latest kernels (2.6.20 - 2.6.31)
* temporary routing loops / TTL code bug / ghost entries in originator table fixed
* internal packet queue for packet aggregation & transmission retry (ARQ)
for payload broadcasts added
* interface detection converted to event based handling to avoid timers
* major linux coding style adjustments applied
* all kernel version compatibility functions has been moved to compat.h
* use random ethernet address generator from the kernel
* /sys/module/batman_adv/version to export kernel module version
* vis: secondary interface export for dot draw format + JSON output format added
* many bugs (alignment issues, race conditions, deadlocks, etc) squashed

-- Sat, 07 Nov 2009 15:44:31 +0100

batman-adv 0.1:

* support latest kernels (2.6.20 - 2.6.28)
* LOTS of cleanup: locking, stack usage, memory leaks
* Change Ethertype from 0x0842 to 0x4305
unregistered at IEEE, if you want to sponsor an official Ethertype ($2500)
please contact us

-- Sun, 28 Dec 2008 00:44:31 +0100

batman-adv 0.1-beta:

* layer 2 meshing based on BATMAN TQ algorithm in kernelland
* operates on any ethernet like interface
* supports IPv4, IPv6, DHCP, etc
* is controlled via /proc/net/batman-adv/
* bridging via brctl is supported
* interface watchdog (interfaces can be (de)activated dynamically)
* offers integrated vis server which meshes/syncs with other vis servers in range

-- Mon, 05 May 2008 14:10:04 +0200
25 changes: 25 additions & 0 deletions drivers/staging/batman-adv/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# B.A.T.M.A.N meshing protocol
#

config BATMAN_ADV
tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
default n
---help---

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.

config BATMAN_DEBUG
bool "B.A.T.M.A.N. debugging"
depends on BATMAN != n
help

This is an option for use by developers; most people should
say N here. This enables compilation of support for
outputting debugging information to the kernel log. The
output is controlled via the module parameter debug.

22 changes: 22 additions & 0 deletions drivers/staging/batman-adv/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright (C) 2007-2009 B.A.T.M.A.N. contributors:
#
# Marek Lindner, Simon Wunderlich
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA
#

obj-m += batman-adv.o
batman-adv-objs := main.o proc.o send.o routing.o soft-interface.o device.o translation-table.o bitarray.o hash.o ring_buffer.o vis.o hard-interface.o aggregation.o log.o
125 changes: 125 additions & 0 deletions drivers/staging/batman-adv/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
[state: 07-11-2009]

BATMAN-ADV
----------

Batman-advanced is a new approach to wireless networking which does no longer
operate on the IP basis. Unlike B.A.T.M.A.N, which exchanges information
using UDP packets and sets routing tables, batman-advanced operates on ISO/OSI
Layer 2 only and uses and routes (or better: bridges) Ethernet Frames. It
emulates a virtual network switch of all nodes participating. Therefore all
nodes appear to be link local, thus all higher operating protocols won't be
affected by any changes within the network. You can run almost any protocol
above B.A.T.M.A.N. Advanced, prominent examples are: IPv4, IPv6, DHCP, IPX.

This is batman-advanced implemented as Linux kernel driver. It does not depend
on any network (other) driver, and can be used on wifi as well as ethernet,
vpn, etc ... (anything with ethernet-style layer 2).
It compiles against and should work with Linux 2.6.20 - 2.6.31. Supporting older
versions is not planned, but it's probably easy to backport it. If you work on a
backport, feel free to contact us. :-)

COMPILE
-------
To compile against your currently installed kernel, just type:

# make

if you want to compile against some other kernel, use:

# make KERNELPATH=/path/to/kernel

USAGE
-----

insmod the batman-adv.ko in your kernel:

# insmod batman-adv.ko

the module is now waiting for activation. You must add some interfaces
on which batman can operate. Each interface must be added separately:

# echo wlan0 > /proc/net/batman-adv/interfaces

( # echo wlan1 > /proc/net/batman-adv/interfaces )
( # echo eth0 > /proc/net/batman-adv/interfaces )
( ... )

Now batman starts broadcasting on this interface.
You can now view the table of originators (mesh participants) with:

# cat /proc/net/batman-adv/originators

The module will create a new interface "bat0", which can be used as a
regular interface:

# ifconfig bat0 inet 192.168.0.1 up
# ping 192.168.0.2
...

If you want topology visualization, your meshnode must be configured
as VIS-server:

# echo "server" > /proc/net/batman-adv/vis

Each node is either configured as "server" or as "client" (default:
"client"). Clients send their topology data to the server next to them,
and server synchronize with other servers. If there is no server
configured (default) within the mesh, no topology information will be
transmitted. With these "synchronizing servers", there can be 1 or
more vis servers sharing the same (or at least very similar) data.

When configured as server, you can get a topology snapshot of your mesh:

# cat /proc/net/batman-adv/vis

This output format is a graphviz formatted text file which can be
processed with graphviz-tools like dot.
The labels are similar/compatible to the ETX metric, 1.0 means perfect
connection (100%), 2.0 means 50%, 3.0 means 33% and so on.

Alternatively, a JSON output format is available. The format can be set
using by writing either "dot_draw" or "json" into the vis_format file.
"dot_draw" is selected by default.

echo "json" > /proc/net/batman-adv/vis_format

In very mobile scenarios, you might want to adjust the originator
interval to a lower value. This will make the mesh more responsive to
topology changes, but will also increase the overhead. Please make sure
that all nodes in your mesh use the same interval. The default value
is 1000 ms (1 second).

# echo 1000 > /proc/net/batman-adv/orig_interval

To deactivate batman, do:

# echo "" > /proc/net/batman-adv/interfaces

BATCTL
------

B.A.T.M.A.N. advanced operates on layer 2 and thus all hosts partici-
pating in the virtual switch are completely transparent for all proto-
cols above layer 2. Therefore the common diagnosis tools do not work as
expected. To overcome these problems batctl was created. At the moment
the batctl contains ping, traceroute, tcpdump and interfaces to the
kernel module settings.

For more information, please see the manpage (man batctl).

batctl is available on http://www.open-mesh.net/

CONTACT
-------

Please send us comments, experiences, questions, anything :)

IRC: #batman on irc.freenode.org
Mailing-list: b.a.t.m.a.n@open-mesh.net
(subscription at https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n )

You can also contact the Authors:

Marek Lindner <lindner_marek@yahoo.de>
Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
51 changes: 51 additions & 0 deletions drivers/staging/batman-adv/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
=> proc interface
* implement new interface to add/delete interfaces and setting options
* /proc/sys/net/batman-adv/ as main folder
* in interfaces/ list every available interface of the host
* each interfaces/$iface/ contains the following files:
-> enable (def: 0) [add/remove this interface to batman-adv]
-> ogm_interval (def: 1000) [ogm interval of that interface]
-> context (def: bat0) [later we want to support multiple mesh instances via
-> bat0/bat1/bat2/..]
-> status (read-only) [outputs the interface status from batman's
-> perspective]
* in mesh/batX/ list every available mesh subnet
-> vis_server (def: 0) [enable/disable vis server for that mesh]
-> vis_data (read-only) [outputs the vis data in a raw format]
-> aggregate_ogm (def: 1) [enable/disable ogm aggregation for that mesh]
-> originators (read-only) [outputs the originator table]
-> transtable_global (read-only) [outputs the global translation table]
-> transtable_local (read-only) [outputs the local translation table]

=> vis "raw" data output
* the raw format shall replace dot draw / json to offer a neutral that can
* be converted
* the format (comma seperated entries):
-> "mac" -> mac address of an originator (each line begins with it)
-> "TQ mac value" -> src mac's link quality towards mac address
-> "HNA mac" -> HNA announced by source mac
-> "PRIMARY" -> this is a primary interface
-> "SEC mac" -> secondary mac address of source (requires preceeding
-> PRIMARY)

=> logging
* the log level LOG_TYPE_CRIT, LOG_TYPE_WARN & LOG_TYPE_NOTICE will be
* unified to use printk
* LOG_TYPE_BATMAN & LOG_TYPE_ROUTES will also use printk but only after the
* internal debug level has been raised
* the internal debug level can be modified using a module parameter (debug)
* or at run time via /sys/module/batman-adv/parameters/debug
* make use of printk %pM support instead of converting mac addresses
* manually

=> strip out all backward compatibility support to older kernels
(only found in compat.h)

=> fix checkpatch.pl errors

Please send all patches to:
Marek Lindner <lindner_marek@yahoo.de>
Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Andrew Lunn <andrew@lunn.ch>
b.a.t.m.a.n@lists.open-mesh.net
Greg Kroah-Hartman <gregkh@suse.de>
Loading

0 comments on commit 5beef3c

Please sign in to comment.