This is the second patchset of the TT-VLAN improvement.
It brings a not negligible change into the TT logic since it is splitting the
CRC mechanism on a per-VLAN basis. Since it is not so easy to digest I decided
to send it alone.
This change is required by an improvement which will come right after: VLAN
based TT filtering for BLA2 enabled nodes (third patchset of the TT-VLAN
feature).
In a few words....
Right now a backbone node rejects any TT entry announced by another backbone.
With this change it will be possible to filter out only those TT entries
belonging to the VLAN where BLA2 is running on. In this way, the others VLANs
will still be able to contact each other.
Before implementing the new feature, the first patch is introducing a
new lock to make any change to the local and global TT table atomic.
In this way a TT Reply cannot be sent during a writing operation on
one of the TT tables. This will prevent the TT Reply from containing
any inconsistent data.
Thanks everybody for their feedback!
Changes from v7:
- improved kernel doc and commit message in 1/2
- fixed some kernel doc typ0s in 2/2
- moved change_offset computation inside batadv_tt_prepare_tvlv_global_data()
and batadv_tt_prepare_tvlv_local_data() to avoid code duplication in 2/2
Changes from v6:
- remove orig_node_vlan from the list after freeing
- introduce locking around TT operations with 1/2
- fixed refcounting
- fixed style
Cheers,
Antonio Quartulli (2):
batman-adv: lock around TT operations to avoid sending inconsistent
data
batman-adv: make the TT CRC logic VLAN specific
compat.c | 9 +
compat.h | 1 +
main.c | 1 +
originator.c | 102 +++++++-
originator.h | 7 +
packet.h | 18 +-
translation-table.c | 738 ++++++++++++++++++++++++++++++++++++++++++----------
types.h | 52 +++-
8 files changed, 772 insertions(+), 156 deletions(-)
--
1.8.1.5
The B.A.T.M.A.N. team proudly presents its newest release - batman-adv
2013.3.0 - a stability and bugfix release uniquely focused on ironing out bugs
and annoyances. As the kernel module always depends on the Linux kernel it was
compiled against, it does not make sense to provide binaries on our website.
As usual, you will find the signed tarballs in our download section:
http://downloads.open-mesh.org/batman/releases/batman-adv-2013.3.0/
as well as prepackaged binaries in your distribution.
Important changes
-----------------
For the first time, a batman-adv and batctl release is accompanied by
A.L.F.R.E.D. (Almighty Lightweight Fact Remote Exchange Daemon) - a user space
daemon conceived for the purpose of replacing the in-kernel visualization
component with an easy to extend user space application. It bears the striking
advantage of not only distributing visualization data but all kinds of data
within a mesh network, thereby filling an often felt gap.
Note: The alfred vis support is not compulsory for obtaining visualization
data as the in-kernel code still is enabled. Both systems are compatible and
can even be deployed side by side. It is planned to remove the in-kernel code
by the end of the year which is why it is recommended to check out alfred
soon, in the interest of making sure the transition goes as smooth as
possible.
Thanks
------
Thanks to all people sending in patches:
* Antonio Quartulli <ordex(a)autistici.org>
* Jiri Pirko <jiri(a)resnulli.us>
* Linus Lüssing <linus.luessing(a)web.de>
* Marek Lindner <lindner_marek(a)yahoo.de>
* Martin Hundebøll <martin(a)hundeboll.net>
* Matthias Schiffer <mschiffer(a)universe-factory.net>
* Patrick McHardy <kaber(a)trash.net>
* Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
* Sven Eckelmann <sven(a)open-mesh.com>
batman-adv
----------
The batman-adv kernel module takes special care when transporting payload
broadcast traffic across the mesh network to increase the likelihood of a
successful transmission. To reduce overhead this mechanism was tweaked to only
be enabled on wireless interfaces as it is safe to assume wired connections
and VPNs suffer less from packet loss. The internal handling of VLAN IDs has
been unified to prepare for the upcoming translation table VLAN support. DAT
has learned not to reply to ARP requests sent by local clients destined for
other local clients to avoid duplicate ARP replies. The batman-adv protocol
(OGM) duplicate check was applied too strictly in certain situations which
could lead to route starvation of better routes. To mitigate this effect the
duplicate policy is applied on a per neighbor basis. Upon configuring an
interface batman-adv would try to acquire the in-kernel network configuration
lock or return with ERESTARTSYS in case the lock was held by some other party.
To avoid having to abort an interface activation this part of the code was
reworked and the need to acquire the lock removed. A crash on kernel module
unload triggered by a double free of the traffic statistic counters was fixed.
The network coding neighbor table won't display neighbors unsuitable for
network coding anymore.
batctl
------
A misleading warning about an uninitialized variable when compiling with "O2"
was fixed and a few typographic errors in the bisect output were corrected.
alfred
------
Alfred is a user space daemon for distributing arbitrary local information
over the mesh/network in a decentralized fashion. This data can be anything
which appears to be useful - originally designed to replace the batman-adv
visualization (vis), you may distribute hostnames, phone books, administration
information, DNS information, the local weather forecast, etc.
Alfred runs as daemon in the background of the system. A user may insert
information by using the alfred binary on the command line, or use special
programs to communicate with alfred (done via unix sockets). The daemon then
takes care of distributing the local information to other alfred servers on
other nodes. This is done via IPv6 link-local multicast, and does not require
any configuration. A user can request data from alfred, and will receive the
information available from all alfred servers in the network.
Happy routing,
The B.A.T.M.A.N. team
This is the second patchset of the TT-VLAN improvement.
It brings a not negligible change into the TT logic since it is splitting the
CRC mechanism on a per-VLAN basis. Since it is not so easy to digest I decided
to send it alone.
This change is required by an improvement which will come right after: VLAN
based TT filtering for BLA2 enabled nodes (third patchset of the TT-VLAN
feature).
In a few words....
Right now a backbone node rejects any TT entry announced by another backbone.
With this change it will be possible to filter out only those TT entries
belonging to the VLAN where BLA2 is running on. In this way, the others VLANs
will still be able to contact each other.
Before implementing the new feature, the first patch is introducing a
new lock to make any change to the local and global TT table atomic.
In this way a TT Reply cannot be sent during a writing operation on
one of the TT tables. This will prevent the TT Reply from containing
any inconsistent data.
Changes from v6:
- remove orig_node_vlan from the list after freeing
- introduce locking around TT operations with 1/2
- fixed refcounting
- fixed style
Cheers,
Antonio Quartulli (2):
batman-adv: lock around TT operations to avoid sending inconsistent
data
batman-adv: make the TT CRC logic VLAN specific
compat.c | 9 +
compat.h | 1 +
main.c | 1 +
originator.c | 102 +++++++-
originator.h | 7 +
packet.h | 18 +-
translation-table.c | 730 ++++++++++++++++++++++++++++++++++++++++++----------
types.h | 45 +++-
8 files changed, 759 insertions(+), 154 deletions(-)
--
1.8.1.5
Hello folks,
i finally took the time to finish the netifd integration in openwrt.
since 2013.0.0, the "slave interfaces" moved from
batman-adv.bat0.interfaces to network.meshblah.proto=batadv, so that
netifd could properly manage the setup and teardown, avoiding some race
conditions i faced at that time (about a year ago)
now i did the same for the "mesh interface", batX, which until now had
the parameters still set in /etc/config/batman-adv.
### So, what in 2012.4.0 was
# cat /etc/config/batman-adv
config 'mesh' 'bat0'
option 'interfaces' 'mesh0'
option 'ap_isolation' '1'
option 'gw_mode' 'server'
# cat /etc/config/network
config interface 'mesh0'
option ifname 'eth2'
option proto 'none'
option auto '1'
### now fully turns into:
# cat /etc/config/network
config interface 'bat0'
option proto 'batmesh'
option ifname 'bat0'
option ap_isolation '1'
option gw_mode 'server'
config interface 'mesh0'
option ifname 'eth2'
option proto 'batadv'
option mesh 'bat0'
[about the proto name... since proto=batadv was already taken for slave
interfaces, i couldn't come up with anything better than "batmesh" :(
I was talking with Nico just now, and he suggested "batadvmesh"
in any case, suggestions are much welcome. Anyway, proto=bat.*mesh is
for setting the mesh parameters]
and well, to avoid breaking current configs unnecesarily [over
sysupgrades (or opkg upgrades?)] i included a small uci-defaults
migration script to take care of that; it transparently migrates all
current /etc/config/batman-adv settings to netifd-style.
Why the integration? reliability in the setup; no more race conditions
whatsoever at boot, or runtime: i even tried rmmoding the module, and
doing "ifup mesh0" brought everything up again cleanly. while netifd had
some stigmas when it was born, now (in my experience) it has grown to a
pretty solid nifty daemon.
I made a pull request on
https://github.com/openwrt-routing/packages/pull/4
comments welcome :D
if you prefer [PATCHES] over mail, just ask :)
as always, cheers, and thanks for being so cool people!
Gui
Hi,
I get following important warnings when compiling alfred 2013.3.0
unix_sock.c: In function ‘unix_sock_req_data_finish’:
unix_sock.c:261:7: warning: ignoring return value of ‘write’, declared
with attribute warn_unused_result [-Wunused-result]
write(client_sock, &status, sizeof(status));
^
unix_sock.c: In function ‘unix_sock_req_data_reply’:
unix_sock.c:187:8: warning: ignoring return value of ‘write’, declared
with attribute warn_unused_result [-Wunused-result]
write(client_sock, buf, sizeof(push->header) + len);
^
Hi,
it seems the A.L.F.R.E.D. component and his vis is getting released
soon http://git.open-mesh.org/alfred.git/commit/fac591b6d8a8a9eaca33a0d7614433cb…
But where are the man pages? Don't you think it would be nice for
people when they can read how it is used in a standard unix way? At
least they need to use it because this functionality is removed in
batman-adv soon.
http://www.open-mesh.org/projects/open-mesh/wiki/2013-07-29-batman-adv-2013…
I can't find the manpages for both binaries in the tarball
http://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2013.3.0…
And isn't the name vis potentially problematic and bad named after
all? "vis" doesn't tell anyone about the connection to batman-adv and
it sounds more like a GUI program to visualize stuff (mathematical
equations?). And it clashes directly with the vis of batmand. So I
cannot install both on the same system in a unix manner.
Hi,
I am currently redesigning hbbp and p2ptbl[1,2]. p2ptbl is a distributed
key-value database build on top of HBBP link-local UDP broadcasts. Both
are used in some Freifunk communities and elsewhere.
To reduce the bandwidth demand of the employed gossip protocol I would
like to use something that behaves like a link-local broadcast packet in
a batman-adv mesh every respect - except that any mesh node on it's
route may decide to drop it or change it's UDP data.
Right now only approaches that are ugly or don't work come to my mind.
Ugly:
* using NFQUEUE on all enslaved interfaces to mangle packets before
they are seen by batman; requires out-of-kernel parsing of batman-adv
packets and watching enslaved interfaces
* add a custom broadcast TVLV; requires kernel code and either bloats
OGMs are requires non-OGM broadcast TVLV packets
Don't work:
* using NFQUEUE on bcast payload (without batman header); does not work
because they are not exposed to the iptables
* send link-local UDP on all enslaved interfaces; requires to
reimplement all the loop-avoidance / routing / resending logic that
already exists in batman-adv
If you see a smarter way or a reason why manipulating broadcast packets
is utter nonsene: please let me know.
With best regards,
Jan Huwald
[1] http://code.sotun.de/git/hbbp/
[2] http://code.sotun.de/git/wrt/p2ptbl/
batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's data.
And if it tries to do so then this can potentially fail.
We shouldn't continue working on this skb in such a case.
Signed-off-by: Linus Lüssing <linus.luessing(a)web.de>
---
send.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/send.c b/send.c
index d2cc507..9c9cab6 100644
--- a/send.c
+++ b/send.c
@@ -266,11 +266,14 @@ static int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
switch (packet_type) {
case BATADV_UNICAST:
- batadv_send_skb_prepare_unicast(skb, orig_node);
+ if (!batadv_send_skb_prepare_unicast(skb, orig_node))
+ goto out;
break;
case BATADV_UNICAST_4ADDR:
- batadv_send_skb_prepare_unicast_4addr(bat_priv, skb, orig_node,
- packet_subtype);
+ if (!batadv_send_skb_prepare_unicast_4addr(bat_priv, skb,
+ orig_node,
+ packet_subtype))
+ goto out;
break;
default:
/* this function supports UNICAST and UNICAST_4ADDR only. It
--
1.7.10.4
From: Antonio Quartulli <antonio(a)open-mesh.com>
Whenever the GW client mode is deselected, a DEL event has
to be sent in order to tell userspace that the current
gateway has been lost. Send the uevent on state change only
if a gateway was currently selected.
Reported-by: Marek Lindner <lindner_marek(a)yahoo.de>
Signed-off-by: Antonio Quartulli <antonio(a)open-mesh.com>
---
v2:
- fixed typo
- fixed kernel doc
- fixed comment in sysfs.c
gateway_client.c | 27 +++++++++++++++++++++++++++
gateway_client.h | 1 +
sysfs.c | 4 ++++
3 files changed, 32 insertions(+)
diff --git a/gateway_client.c b/gateway_client.c
index 588d27e..edf61da 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -188,6 +188,33 @@ next:
return curr_gw;
}
+/**
+ * batadv_gw_check_client_stop - check if client mode has been switched off
+ * @bat_priv: the bat priv with all the soft interface information
+ *
+ * This function assumes the caller has checked that the gw state *is actually
+ * changing*. This function is not supposed to be called when there is no state
+ * change.
+ */
+void batadv_gw_check_client_stop(struct batadv_priv *bat_priv)
+{
+ struct batadv_gw_node *curr_gw;
+
+ if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_CLIENT)
+ return;
+
+ curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
+ if (!curr_gw)
+ return;
+
+ /* if batman-adv is switching the gw client mode off and a gateway was
+ * already selected, send a DEL uevent
+ */
+ batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL, NULL);
+
+ batadv_gw_node_free_ref(curr_gw);
+}
+
void batadv_gw_election(struct batadv_priv *bat_priv)
{
struct batadv_gw_node *curr_gw = NULL, *next_gw = NULL;
diff --git a/gateway_client.h b/gateway_client.h
index 7ef955a..b235cbf 100644
--- a/gateway_client.h
+++ b/gateway_client.h
@@ -20,6 +20,7 @@
#ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
#define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
+void batadv_gw_check_client_stop(struct batadv_priv *bat_priv);
void batadv_gw_deselect(struct batadv_priv *bat_priv);
void batadv_gw_election(struct batadv_priv *bat_priv);
struct batadv_orig_node *
diff --git a/sysfs.c b/sysfs.c
index 6ec145d..096b511 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -409,6 +409,10 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj,
curr_gw_mode_str, buff);
batadv_gw_deselect(bat_priv);
+ /* always call batadv_gw_check_client_stop() before changing the gateway
+ * state
+ */
+ batadv_gw_check_client_stop(bat_priv);
atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp);
batadv_gw_tvlv_container_update(bat_priv);
return count;
--
1.8.1.5