This patchset introduces optimizations for batman-adv in setups having several gateways into a common (switched) Ethernet backbone network especially if dat is additionally enabled.
Using the current implementation with bla and dat enabled, several problems can be observed in a real setup:
1. Multiplication of ARP replies from dat enabled gateways and dat enabled mesh nodes leading to an "ARP reply storm" in the common backbone network.
2. In rare corner cases bla does not fully prevent looping of unicast frames in the direction backbone --> mesh --> backbone and looping of multicast frames in the direction mesh --> backbone --> mesh.
The latter can lead to temporary confusion in the switched backbone resulting in packet loss and communication timeouts.
The observed problems are solved by introduction of additional rules for the dat handling, bla packet forwarding and bla claiming/unclaiming of clients.
..................................................................
PHOENIX CONTACT ELECTRONICS GmbH
Sitz der Gesellschaft / registered office of the company: 31812 Bad Pyrmont
USt-Id-Nr.: DE811742156
Amtsgericht Hannover HRB 100528 / district court Hannover HRB 100528
Geschäftsführer / Executive Board: Roland Bent, Dr. Martin Heubeck
___________________________________________________________________
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren, jegliche anderweitige Verwendung sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
----------------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.
___________________________________________________________________
Hello there
I have some basic Issues which I was not able to solve with the Wiki.
How is the metric (?/255) calculated?
Concerning the output of "batctl o" below, how can I interpret the following?
-What is the meaning when the originator is the same as the next hop (Line 1)?
-Is that correct that the originator car 29 will send all packets to car20 directly without a node in-between (Line 2)?
-How can the potential nexthops be interpreted?
[B.A.T.M.A.N. adv 2015.1, MainIF/MAC: adhoc0/c4:93:00:02:d1:4f (bat0 BATMAN_IV)]
Originator last-seen (#/255) Nexthop [outgoingIF]: Potential nexthops ...
car23 0.300s (255) car23 [ wlan0]: car35 ( 0) car24 ( 0) car31 (103) car21 (183) car36 ( 68) car20 (178) car23 (255)
car29 0.864s (175) car20 [ wlan0]: car23 ( 0) car36 ( 0) car31 ( 0) car35 ( 0) car21 ( 0) car24 ( 0) car20 (175) car29 ( 0)
Thank you for your answers
Regards
Nino
The ethtool API is changing in linux-4.6 and the B.A.T.M.A.N. V
code has to be changed accordingly.
Fixes: 5c3245172c01 ("batman-adv: ELP - compute the metric based on the estimated throughput")
Signed-off-by: Antonio Quartulli <a(a)unstable.cc>
---
This patch contains some compat code which is an attempt to implement
backward compatibility with kernel <4.6. Unfortunately my attempt does
not work because it is not possible to redefine something like
link_settings.base.speed to something else (due to the '.' in the string).
Any suggestion? :)
compat-include/linux/ethtool.h | 35 +++++++++++++++++++++++++++++++++++
net/batman-adv/bat_v_elp.c | 12 ++++++------
2 files changed, 41 insertions(+), 6 deletions(-)
create mode 100644 compat-include/linux/ethtool.h
diff --git a/compat-include/linux/ethtool.h b/compat-include/linux/ethtool.h
new file mode 100644
index 0000000..b11524d
--- /dev/null
+++ b/compat-include/linux/ethtool.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 2016 B.A.T.M.A.N. contributors:
+ *
+ * Antonio Quartulli
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * This file contains macros for maintaining compatibility with older versions
+ * of the Linux kernel.
+ */
+
+#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_ETHTOOL_H_
+#define _NET_BATMAN_ADV_COMPAT_LINUX_ETHTOOL_H_
+
+#include <linux/version.h>
+#include_next <linux/ethtool.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+
+#define ethtool_link_ksettings ethtool_cmd
+#define __ethtool_get_link_ksettings __ethtool_get_settings
+#define link_settings.base.speed ethtool_cmd_speed(&link_settings)
+
+#endif /* < KERNEL_VERSION(4, 6, 0) */
+
+#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_ETHTOOL_H_ */
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index e94b4a0..3844e7e 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -73,8 +73,8 @@ static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface)
static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
{
struct batadv_hard_iface *hard_iface = neigh->if_incoming;
+ struct ethtool_link_ksettings link_settings;
struct station_info sinfo;
- struct ethtool_cmd cmd;
u32 throughput;
int ret;
@@ -110,19 +110,19 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
/* if not a wifi interface, check if this device provides data via
* ethtool (e.g. an Ethernet adapter)
*/
- memset(&cmd, 0, sizeof(cmd));
+ memset(&link_settings, 0, sizeof(link_settings));
rtnl_lock();
- ret = __ethtool_get_settings(hard_iface->net_dev, &cmd);
+ ret = __ethtool_get_link_ksettings(hard_iface->net_dev, &link_settings);
rtnl_unlock();
if (ret == 0) {
/* link characteristics might change over time */
- if (cmd.duplex == DUPLEX_FULL)
+ if (link_settings.base.duplex == DUPLEX_FULL)
hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;
else
hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX;
- throughput = ethtool_cmd_speed(&cmd);
- if (throughput && throughput != SPEED_UNKNOWN)
+ throughput = link_settings.base.speed;
+ if (throughput && (throughput != SPEED_UNKNOWN))
return throughput * 10;
}
--
2.7.2
Hi,
I've used my free time in the last week to look over the 5246 patches which
were sent to the B.A.T.M.A.N. mailing list. These patches were categorized as
* Accepted:
committed to the respective repository at git.open-mesh.org
* Rejected:
Either rejected by the Maintainer(s) or withdrawn by the Author because
they turned out to be a bad idea
* RFC
patches which were just posted to get comments
* Not applicable
patches which were not really for a repository at git.open-mesh.org
(for example patches which are forwarded to net-next.git/net.git)
* Changes requested
Patch had flaws but these could be fixed but the author of the patch hasn't
sent a new version of the patch
* Superseded
New version of the patch(set) was sent which makes the old version obsolete
The result can now be found at https://patchwork.open-mesh.org/
You may wonder why are there patches with the state "New" + "Delegate" set to
some person. These are the patches which have not yet been applied in their
respective repository at git.open-mesh.org, not yet rejected and not yet
replaced by a different patch. Ok, these are most likely not all still waiting
to be applied but I just didn't know their state and thus the maintainer(s)
have to look over the remaining patches and change their state. Until then,
these are added to the TODO list of the maintainer [1].
Patchwork is currently configured to read the mails which are sent to
b.a.t.m.a.n(a)lists.open-mesh.org and add each patch + its comments to the
patchwork database. Maintainers can then update their state, download the
patches and bundle them (which then can be downloaded again). A heuristic was
installed in the post-receive hook that tries to find the correct commit for a
newly applied patch in the master branch and automatically mark them as
Accepted.
The author of an patch will be automatically informed about changes to the
state of his patch.
I have already started to assign the patches with the state "New" to the
maintainers. This is also the reason why Marek, Simon and Elektra will not be
able to create their own account and instead will receive a mail from me with
their account data.
But also other people can help here. They can register to set the state of
their own patches. This is for example helpful when they've just submitted a
new patchset and want to mark the old patchset as superseded. But they can of
course also disable the notification mails.
I hope this helps to better keep track on the incoming patches and make it
harder to forget one.
Kind regards,
Sven
[1] https://patchwork.open-mesh.org/user/todo/
From: Sven Eckelmann <sven.eckelmann(a)open-mesh.com>
The undefined behavior sanatizer detected an signed integer overflow in a
setup with near perfect link quality
UBSAN: Undefined behaviour in net/batman-adv/bat_iv_ogm.c:1246:25
signed integer overflow:
8713350 * 255 cannot be represented in type 'int'
The problems happens because the calculation of mixed unsigned and signed
integers resulted in an integer multiplication.
batadv_ogm_packet::tq (u8 255)
* tq_own (u8 255)
* tq_asym_penalty (int 134; max 255)
* tq_iface_penalty (int 255; max 255)
The tq_iface_penalty, tq_asym_penalty and inv_asym_penalty can just be
changed to unsigned int because they are not expected to become negative.
Fixes: 46e44fdb96ef ("batman-adv: add WiFi penalty")
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)open-mesh.com>
---
net/batman-adv/bat_iv_ogm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index cb2d1b9..b71b57e 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1147,9 +1147,10 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
u8 total_count;
u8 orig_eq_count, neigh_rq_count, neigh_rq_inv, tq_own;
unsigned int neigh_rq_inv_cube, neigh_rq_max_cube;
- int tq_asym_penalty, inv_asym_penalty, if_num, ret = 0;
+ int if_num, ret = 0;
+ unsigned int tq_asym_penalty, inv_asym_penalty;
unsigned int combined_tq;
- int tq_iface_penalty;
+ unsigned int tq_iface_penalty;
/* find corresponding one hop neighbor */
rcu_read_lock();
--
2.7.0
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
net/batman-adv/bridge_loop_avoidance.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 0a6c8b8..ac42504 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -120,7 +120,7 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node,
}
/**
- * batadv_compare_backbone_gw - compare address and vid of two claims
+ * batadv_compare_claim - compare address and vid of two claims
* @node: list node of the first entry to compare
* @data2: pointer to the second claims
*
--
2.7.0
The function batadv_iv_ogm_orig_add_if allocates new buffers for bcast_own
and bcast_own_sum. It is expected that these buffers are unchanged in case
either bcast_own or bcast_own_sum couldn't be resized.
But the error handling of this function frees the already resized buffer
for bcast_own when the allocation of the new bcast_own_sum buffer failed.
This will lead to an invalid memory access when some code will try to
access bcast_own.
Instead the resized new bcast_own buffer has to be kept. This will not lead
to problems because the size of the buffer was only increased and therefore
no user of the buffer will try to access bytes outside of the new buffer.
Fixes: fdafa7d29ace ("batman-adv: provide orig_node routing API")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
net/batman-adv/bat_iv_ogm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index cb2d1b9..af8bd86 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -156,10 +156,8 @@ static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node,
orig_node->bat_iv.bcast_own = data_ptr;
data_ptr = kmalloc_array(max_if_num, sizeof(u8), GFP_ATOMIC);
- if (!data_ptr) {
- kfree(orig_node->bat_iv.bcast_own);
+ if (!data_ptr)
goto unlock;
- }
memcpy(data_ptr, orig_node->bat_iv.bcast_own_sum,
(max_if_num - 1) * sizeof(u8));
--
2.7.0
Hi,
do you still remember GSOC 2012? Yes, it is really long ago. It was a time
when winters were still cold, summers still hot and it was still politically
correct to say "bandwidth meter" when you actually meant "throughput meter".
Three students tried their best to implement some of the ideas floating around
in the B.A.T.M.A.N. advanced community. And after some more work, most of the
features reached the finishing line. TVLV [1] and the fragmentation v2 [2]
were both integrated as part of the COMPAT 15 bump. But the "bandwidth
meter" [3] was never ready to being merged.
Nevertheless, the lessons learned in the first implementation [4] inspired
different people to continue working on it. Especially Antonio Quartulli
worked on his own version to increase its usefulness. And this feature makes
even more sense since we reached the new "throughput based metric" time epoch
with the introduction of B.A.T.M.A.N. V.
I hope we can reignite interest in this feature with a rebased and refurbished
version of this patchset. Both the batman-adv and batctl patches are based on
the newest revision in their respective master branches. Also a branch called
"tp_meter" was created in the batctl.git and batman-adv.git repository with
these patches already applied.
batman-adv
==========
Antonio Quartulli (2):
batman-adv: return netdev status in the TX path
batman-adv: use another ICMP packet when sending command from userspace
batman-adv: throughput meter implementation
Sven Eckelmann (1):
batman-adv: Add compatibility code for to_delayed_work
compat-include/linux/netdevice.h | 17 +
compat-include/linux/workqueue.h | 46 ++
net/batman-adv/Makefile | 1 +
net/batman-adv/fragmentation.c | 41 +-
net/batman-adv/fragmentation.h | 6 +-
net/batman-adv/icmp_socket.c | 225 +++---
net/batman-adv/icmp_socket.h | 5 +-
net/batman-adv/main.c | 6 +-
net/batman-adv/main.h | 24 +-
net/batman-adv/packet.h | 120 ++++
net/batman-adv/routing.c | 33 +-
net/batman-adv/send.c | 25 +-
net/batman-adv/soft-interface.c | 2 +
net/batman-adv/tp_meter.c | 1451 ++++++++++++++++++++++++++++++++++++++
net/batman-adv/tp_meter.h | 34 +
net/batman-adv/types.h | 113 +++
16 files changed, 2005 insertions(+), 144 deletions(-)
batctl
======
Antonio Quartulli (1):
batctl: introduce throughput meter support
Makefile | 2 +-
main.c | 6 ++
man/batctl.8 | 24 ++++++-
packet.h | 120 +++++++++++++++++++++++++++++++
tcpdump.c | 14 +++-
tp_meter.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tp_meter.h | 22 ++++++
7 files changed, 411 insertions(+), 4 deletions(-)
Kind regards,
Sven
[1] https://www.open-mesh.org/projects/open-mesh/wiki/2012-10-01-GSoC-2012-Spyr…
[2] https://www.open-mesh.org/projects/open-mesh/wiki/2012-09-24-GSoC-2012-Mart…
[3] https://www.open-mesh.org/projects/open-mesh/wiki/2012-10-06-GSoC-2012-Edo-…
[4] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2012-August/007924.html