Skip to contentSkip to conversation

net: Add batman-adv meshing protocol

PATCH Superseded Sven Eckelmann 3 participants 3 messages Sep 18, 2010 – Oct 9, 2010 1 message not in the archive

Subsystems (4)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 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.

---
batman-adv is a layer2 meshing protocol currently in drivers/staging/batman-adv. GregKH recently [1][2] gave us his blessing to leave the staging tree and move to a more suitable location.

Short functionality overview:

The batman-adv module is an implementation of the B.A.T.M.A.N. routing protocol operating on layer2 optimized for (but not limited to) wireless networks. Next to finding the best possible path through the network it encapsulates the data traffic and optimizes the transport as well. There also is a user space tool "batctl" which offers various functionalities next to a kernel module configuration interface. Detailed documentation can be found at the project homepage[3].

Everything is addressed in the last round of comments [4].

Following patches were send to staging-next [5] since the last submission:

Linus Lüssing (1):
Staging: batman-adv: Always synchronize rcu's on module shutdown

Marek Lindner (2):
Staging: batman-adv: removing redundant assignment of skb->dev
Staging: batman-adv: Introduce update_primary_addr to update mac address

Sven Eckelmann (13):
Staging: batman-adv: Remove currently unused gw_* datastructures
Staging: batman-adv: Add rcu TODO
Staging: batman-adv: checkpatch cleanup of comments
Staging: batman-adv: Move mailing list address to .org
Staging: batman-adv: Mark debugfs files as nonseekable
Staging: batman-adv: wait for call_rcu before unloading module
Staging: batman-adv: Introduce if_list_lock to protect if_list
Staging: batman-adv: Always protect list_for_each_entry_rcu with RCU
Staging: batman-adv: Remove unneeded rcu_read_lock
Staging: batman-adv: Use synchronize_rcu instead of call_rcu
Staging: batman-adv: Use refcnt to track usage count of batman_if
Staging: batman-adv: count batman_if list queries as reference
Staging: batman-adv: Track references of batman_if in set_primary_if

Vasiliy Kulikov (1):
Staging: batman-adv: check kmalloc() return value

[1] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2010-June/002881.html
[2] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2010-June/002968.html
[3] http://www.open-mesh.org
[4] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2010-September/003337.html
[5] http://git.kernel.org/?p=linux/kernel/git/gregkh/staging-next-2.6.git

 .../ABI/testing/sysfs-class-net-batman-adv         |   14 +
 Documentation/ABI/testing/sysfs-class-net-mesh     |   33 +
 Documentation/networking/batman-adv.txt            |  239 ++++
 MAINTAINERS                                        |    8 +
 net/Kconfig                                        |    1 +
 net/Makefile                                       |    1 +
 net/batman-adv/Kconfig                             |   25 +
 net/batman-adv/Makefile                            |   22 +
 net/batman-adv/aggregation.c                       |  270 ++++
 net/batman-adv/aggregation.h                       |   43 +
 net/batman-adv/bat_debugfs.c                       |  343 +++++
 net/batman-adv/bat_debugfs.h                       |   33 +
 net/batman-adv/bat_sysfs.c                         |  558 ++++++++
 net/batman-adv/bat_sysfs.h                         |   42 +
 net/batman-adv/bitarray.c                          |  201 +++
 net/batman-adv/bitarray.h                          |   47 +
 net/batman-adv/hard-interface.c                    |  637 +++++++++
 net/batman-adv/hard-interface.h                    |   58 +
 net/batman-adv/hash.c                              |  306 +++++
 net/batman-adv/hash.h                              |  100 ++
 net/batman-adv/icmp_socket.c                       |  359 +++++
 net/batman-adv/icmp_socket.h                       |   34 +
 net/batman-adv/main.c                              |  222 ++++
 net/batman-adv/main.h                              |  185 +++
 net/batman-adv/originator.c                        |  537 ++++++++
 net/batman-adv/originator.h                        |   36 +
 net/batman-adv/packet.h                            |  134 ++
 net/batman-adv/ring_buffer.c                       |   52 +
 net/batman-adv/ring_buffer.h                       |   28 +
 net/batman-adv/routing.c                           | 1393 ++++++++++++++++++++
 net/batman-adv/routing.h                           |   46 +
 net/batman-adv/send.c                              |  577 ++++++++
 net/batman-adv/send.h                              |   41 +
 net/batman-adv/soft-interface.c                    |  392 ++++++
 net/batman-adv/soft-interface.h                    |   32 +
 net/batman-adv/translation-table.c                 |  513 +++++++
 net/batman-adv/translation-table.h                 |   45 +
 net/batman-adv/types.h                             |  242 ++++
 net/batman-adv/unicast.c                           |  269 ++++
 net/batman-adv/unicast.h                           |   39 +
 net/batman-adv/vis.c                               |  901 +++++++++++++
 net/batman-adv/vis.h                               |   37 +
 42 files changed, 9095 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-class-net-batman-adv
 create mode 100644 Documentation/ABI/testing/sysfs-class-net-mesh
 create mode 100644 Documentation/networking/batman-adv.txt
 create mode 100644 net/batman-adv/Kconfig
 create mode 100644 net/batman-adv/Makefile
 create mode 100644 net/batman-adv/aggregation.c
 create mode 100644 net/batman-adv/aggregation.h
 create mode 100644 net/batman-adv/bat_debugfs.c
 create mode 100644 net/batman-adv/bat_debugfs.h
 create mode 100644 net/batman-adv/bat_sysfs.c
 create mode 100644 net/batman-adv/bat_sysfs.h
 create mode 100644 net/batman-adv/bitarray.c
 create mode 100644 net/batman-adv/bitarray.h
 create mode 100644 net/batman-adv/hard-interface.c
 create mode 100644 net/batman-adv/hard-interface.h
 create mode 100644 net/batman-adv/hash.c
 create mode 100644 net/batman-adv/hash.h
 create mode 100644 net/batman-adv/icmp_socket.c
 create mode 100644 net/batman-adv/icmp_socket.h
 create mode 100644 net/batman-adv/main.c
 create mode 100644 net/batman-adv/main.h
 create mode 100644 net/batman-adv/originator.c
 create mode 100644 net/batman-adv/originator.h
 create mode 100644 net/batman-adv/packet.h
 create mode 100644 net/batman-adv/ring_buffer.c
 create mode 100644 net/batman-adv/ring_buffer.h
 create mode 100644 net/batman-adv/routing.c
 create mode 100644 net/batman-adv/routing.h
 create mode 100644 net/batman-adv/send.c
 create mode 100644 net/batman-adv/send.h
 create mode 100644 net/batman-adv/soft-interface.c
 create mode 100644 net/batman-adv/soft-interface.h
 create mode 100644 net/batman-adv/translation-table.c
 create mode 100644 net/batman-adv/translation-table.h
 create mode 100644 net/batman-adv/types.h
 create mode 100644 net/batman-adv/unicast.c
 create mode 100644 net/batman-adv/unicast.h
 create mode 100644 net/batman-adv/vis.c
 create mode 100644 net/batman-adv/vis.h
Documentation/ABI/testing/sysfs-class-net-batman-adv new file +14 -0
new file mode 100644
index 0000000..38dd762
@@ -0,0 +1,14 @@
+
+What:           /sys/class/net/<iface>/batman-adv/mesh_iface
+Date:           May 2010
+Contact:        Marek Lindner <[email protected]>
+Description:
+                The /sys/class/net/<iface>/batman-adv/mesh_iface file
+                displays the batman mesh interface this <iface>
+                currently is associated with.
+
+What:           /sys/class/net/<iface>/batman-adv/iface_status
+Date:           May 2010
+Contact:        Marek Lindner <[email protected]>
+Description:
+                Indicates the status of <iface> as it is seen by batman.
Documentation/ABI/testing/sysfs-class-net-mesh new file +33 -0
new file mode 100644
index 0000000..5aa1912
@@ -0,0 +1,33 @@
+
+What:           /sys/class/net/<mesh_iface>/mesh/aggregated_ogms
+Date:           May 2010
+Contact:        Marek Lindner <[email protected]>
+Description:
+                Indicates whether the batman protocol messages of the
+                mesh <mesh_iface> shall be aggregated or not.
+
+What:           /sys/class/net/<mesh_iface>/mesh/bonding
+Date:           June 2010
+Contact:        Simon Wunderlich <[email protected]>
+Description:
+                Indicates whether the data traffic going through the
+                mesh will be sent using multiple interfaces at the
+                same time (if available).
+
+What:           /sys/class/net/<mesh_iface>/mesh/orig_interval
+Date:           May 2010
+Contact:        Marek Lindner <[email protected]>
+Description:
+                Defines the interval in milliseconds in which batman
+                sends its protocol messages.
+
+What:           /sys/class/net/<mesh_iface>/mesh/vis_mode
+Date:           May 2010
+Contact:        Marek Lindner <[email protected]>
+Description:
+                Each batman node only maintains information about its
+                own local neighborhood, therefore generating graphs
+                showing the topology of the entire mesh is not easily
+                feasible without having a central instance to collect
+                the local topologies from all nodes. This file allows
+                to activate the collecting (server) mode.
Documentation/networking/batman-adv.txt new file +239 -0

239 lines not on this page · raw message

MAINTAINERS +8 -0
index 4c14636..bea3c55 100644
@@ -1269,6 +1269,14 @@ S:	Maintained
 F:	drivers/video/backlight/
 F:	include/linux/backlight.h
 
+BATMAN ADVANCED
+M:	Marek Lindner <[email protected]>
+M:	Simon Wunderlich <[email protected]>
+L:	[email protected]
+W:	http://www.open-mesh.org/
+S:	Maintained
+F:	net/batman-adv/
+
 BAYCOM/HDLCDRV DRIVERS FOR AX.25
 M:	Thomas Sailer <[email protected]>
 L:	[email protected]
net/Kconfig +1 -0
index e926884..3469fa0 100644
@@ -214,6 +214,7 @@ source "net/ieee802154/Kconfig"
 source "net/sched/Kconfig"
 source "net/dcb/Kconfig"
 source "net/dns_resolver/Kconfig"
+source "net/batman-adv/Kconfig"
 
 config RPS
 	boolean
net/Makefile +1 -0
index ea60fbc..6f211df 100644
@@ -68,3 +68,4 @@ obj-$(CONFIG_SYSCTL)		+= sysctl_net.o
 endif
 obj-$(CONFIG_WIMAX)		+= wimax/
 obj-$(CONFIG_DNS_RESOLVER)	+= dns_resolver/
+obj-$(CONFIG_BATMAN_ADV)	+= batman-adv/
net/batman-adv/Kconfig new file +25 -0
new file mode 100644
index 0000000..6c051ad
@@ -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"
+	depends on NET
+        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_ADV_DEBUG
+	bool "B.A.T.M.A.N. debugging"
+	depends on BATMAN_ADV != 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.
net/batman-adv/Makefile new file +22 -0
new file mode 100644
index 0000000..4b5c434
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2007-2010 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-$(CONFIG_BATMAN_ADV) += batman-adv.o
+batman-adv-objs := main.o bat_debugfs.o bat_sysfs.o send.o routing.o soft-interface.o icmp_socket.o translation-table.o bitarray.o hash.o ring_buffer.o vis.o hard-interface.o aggregation.o originator.o unicast.o
net/batman-adv/aggregation.c new file +270 -0

270 lines not on this page · raw message

net/batman-adv/aggregation.h new file +43 -0

43 lines not on this page · raw message

net/batman-adv/bat_debugfs.c new file +343 -0

343 lines not on this page · raw message

net/batman-adv/bat_debugfs.h new file +33 -0
new file mode 100644
index 0000000..72df532
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 B.A.T.M.A.N. contributors:
+ *
+ * Marek Lindner
+ *
+ * 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
+ *
+ */
+
+
+#ifndef _NET_BATMAN_ADV_DEBUGFS_H_
+#define _NET_BATMAN_ADV_DEBUGFS_H_
+
+#define DEBUGFS_BAT_SUBDIR "batman_adv"
+
+void debugfs_init(void);
+void debugfs_destroy(void);
+int debugfs_add_meshif(struct net_device *dev);
+void debugfs_del_meshif(struct net_device *dev);
+
+#endif /* _NET_BATMAN_ADV_DEBUGFS_H_ */
net/batman-adv/bat_sysfs.c new file +558 -0

558 lines not on this page · raw message

net/batman-adv/bat_sysfs.h new file +42 -0

42 lines not on this page · raw message

net/batman-adv/bitarray.c new file +201 -0

201 lines not on this page · raw message

net/batman-adv/bitarray.h new file +47 -0

47 lines not on this page · raw message

net/batman-adv/hard-interface.c new file +637 -0

637 lines not on this page · raw message

net/batman-adv/hard-interface.h new file +58 -0

58 lines not on this page · raw message

net/batman-adv/hash.c new file +306 -0

306 lines not on this page · raw message

net/batman-adv/hash.h new file +100 -0

100 lines not on this page · raw message

net/batman-adv/icmp_socket.c new file +359 -0

4 lines not on this page · raw message

net/batman-adv/icmp_socket.h new file +34 -0
new file mode 100644
index 0000000..bf9b348

Lines of this file are not shown. View the raw message.

net/batman-adv/main.c new file +222 -0

222 lines not on this page · raw message

net/batman-adv/main.h new file +185 -0

185 lines not on this page · raw message

net/batman-adv/originator.c new file +537 -0

537 lines not on this page · raw message

net/batman-adv/originator.h new file +36 -0
new file mode 100644
index 0000000..a97c400

Lines of this file are not shown. View the raw message.

net/batman-adv/packet.h new file +134 -0

134 lines not on this page · raw message

net/batman-adv/ring_buffer.c new file +52 -0

52 lines not on this page · raw message

net/batman-adv/ring_buffer.h new file +28 -0
new file mode 100644
index 0000000..6b0cb9a

Lines of this file are not shown. View the raw message.

net/batman-adv/routing.c new file +1393 -0

1,393 lines not on this page · raw message

net/batman-adv/routing.h new file +46 -0

46 lines not on this page · raw message

net/batman-adv/send.c new file +577 -0

577 lines not on this page · raw message

net/batman-adv/send.h new file +41 -0

41 lines not on this page · raw message

net/batman-adv/soft-interface.c new file +392 -0

392 lines not on this page · raw message

net/batman-adv/soft-interface.h new file +32 -0
new file mode 100644
index 0000000..843a7ec

Lines of this file are not shown. View the raw message.

net/batman-adv/translation-table.c new file +513 -0

513 lines not on this page · raw message

net/batman-adv/translation-table.h new file +45 -0

45 lines not on this page · raw message

net/batman-adv/types.h new file +242 -0

242 lines not on this page · raw message

net/batman-adv/unicast.c new file +269 -0

269 lines not on this page · raw message

net/batman-adv/unicast.h new file +39 -0
new file mode 100644
index 0000000..7973697

Lines of this file are not shown. View the raw message.

net/batman-adv/vis.c new file +901 -0

901 lines not on this page · raw message

net/batman-adv/vis.h new file +37 -0
new file mode 100644
index 0000000..2c3b330

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.2.3

Part of the diff is not shown here. View the raw message.

maintainer
#1 lore raw

From: Sven Eckelmann <[email protected]>
Date: Sat, 18 Sep 2010 21:03:30 +0200

Quoted 6 lines

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.

The only thing remaining which I really don't like is this hash helper library thing in here.

It's a terrible abstraction and very inefficient. Iteration uses function calls, as does removal. Key comparisons use callbacks, via indirection function pointers, also very inefficient.

Just use the "struct hlist_head" and "struct hlist_node" objects we have generically already. Inline the list iteration, as well as the key comparisons and the node linking/unlinking.

Otherwise if you think your hash helpers are so incredibly useful, propose for their inclusion under lib/ on linux-kernel

But frankly, I wish you a lot of luck with that. :-)

A message that is not in the archive (sent off-list or not yet received): 20100924.134334.28812338.davem-fT/PcQaiUtIeIZ0/[email protected]

#3 lore raw
Quoted 8 lines · David Miller

From: Sven Eckelmann <[email protected]>
Date: Sat, 18 Sep 2010 21:03:30 +0200

Quoted 5 lines

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.

Quoted 8 lines
Quoted 1 line

The only thing remaining which I really don't like is this hash helper library thing in here.

It's a terrible abstraction and very inefficient. Iteration uses function calls, as does removal. Key comparisons use callbacks, via indirection function pointers, also very inefficient.

I would completely agree.

Quoted 3 lines

Just use the "struct hlist_head" and "struct hlist_node" objects we have generically already. Inline the list iteration, as well as the key comparisons and the node linking/unlinking.

hlist_head and hlist_node is the right thing to do, but I am a little bit irritated by the rest.

Ok, no hash implementation from the basics, but there is functionality shared by the four hashing tables used, which I would not like to "implement" again everywhere. For example the "add to hash if data isn't already added there". This can easily done using a static inline function which receives a comparison and choose/key function (which also can be inlined by the compiler) and does the rest using hlist_*.

Speaks anything against such things shared in inside batman-adv only?

thanks,
Sven