Hello everybody (thx to Marek Lindner for the answer)
My name is Jérôme, i'm a French student in informatics and networks,
for a project i use BATMAN ( i use it with raspberry Pi in cars).
I would like to change the duration of the sliding windows, i understand
that the duration of the sliding windows is equals to 128*intervall it
(intervall beetween every hello packets)
So normally the sliding windows is equals to 128 seconds because the
interval is 1s in default mode.
I would like to change the code to change this duration but not just
with the interval it value but directly with the 128. Because when i use
this protocol in a mobile environment like cars this value is to high,
and i would like to reduce in something like sliding windows duration =
30*5(=interval it which i can change easily).
Could you tell me where i can find something like that in the code :
#define _timeslidingwindows 128
Thank you and have a nice day.
Jérôme Gries
batman-adv checks in different situation if a new device is already on top
of a different batman-adv device. This is done by getting the iflink of a
device and all its parent. It assumes that this iflink is always a parent
device in an acyclic graph. But this assumption is broken by devices like
veth which are actually a pair of two devices linked to each other. The
recursive check would therefore get veth0 when calling dev_get_iflink on
veth1. And it gets veth0 when calling dev_get_iflink with veth1.
Creating a veth pair and loading batman-adv freezes parts of the system
ip link add veth0 type veth peer name veth1
modprobe batman-adv
An RCU stall will be detected on the system which cannot be fixed.
INFO: rcu_sched self-detected stall on CPU
1: (5264 ticks this GP) idle=3e9/140000000000001/0
softirq=144683/144686 fqs=5249
(t=5250 jiffies g=46 c=45 q=43)
Task dump for CPU 1:
insmod R running task 0 247 245 0x00000008
ffffffff8151f140 ffffffff8107888e ffff88000fd141c0 ffffffff8151f140
0000000000000000 ffffffff81552df0 ffffffff8107b420 0000000000000001
ffff88000e3fa700 ffffffff81540b00 ffffffff8107d667 0000000000000001
Call Trace:
<IRQ> [<ffffffff8107888e>] ? rcu_dump_cpu_stacks+0x7e/0xd0
[<ffffffff8107b420>] ? rcu_check_callbacks+0x3f0/0x6b0
[<ffffffff8107d667>] ? hrtimer_run_queues+0x47/0x180
[<ffffffff8107cf9d>] ? update_process_times+0x2d/0x50
[<ffffffff810873fb>] ? tick_handle_periodic+0x1b/0x60
[<ffffffff810290ae>] ? smp_trace_apic_timer_interrupt+0x5e/0x90
[<ffffffff813bbae2>] ? apic_timer_interrupt+0x82/0x90
<EOI> [<ffffffff812c3fd7>] ? __dev_get_by_index+0x37/0x40
[<ffffffffa0031f3e>] ? batadv_hard_if_event+0xee/0x3a0 [batman_adv]
[<ffffffff812c5801>] ? register_netdevice_notifier+0x81/0x1a0
[...]
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Cc: Jetmir Gigollai <jetmir_gigollaj(a)web.de>
---
compat-include/linux/netdevice.h | 6 ------
net/batman-adv/hard-interface.c | 42 ----------------------------------------
2 files changed, 48 deletions(-)
diff --git a/compat-include/linux/netdevice.h b/compat-include/linux/netdevice.h
index f19f624..0e4fcc8 100644
--- a/compat-include/linux/netdevice.h
+++ b/compat-include/linux/netdevice.h
@@ -111,10 +111,4 @@ static inline int batadv_netdev_set_master(struct net_device *slave,
#endif /* < KERNEL_VERSION(3, 17, 0) */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
-
-#define dev_get_iflink(_net_dev) ((_net_dev)->iflink)
-
-#endif /* < KERNEL_VERSION(3, 19, 0) */
-
#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_NETDEVICE_H_ */
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index bef9147..0c2643d 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -75,44 +75,6 @@ out:
return hard_iface;
}
-/**
- * batadv_is_on_batman_iface - check if a device is a batman iface descendant
- * @net_dev: the device to check
- *
- * If the user creates any virtual device on top of a batman-adv interface, it
- * is important to prevent this new interface to be used to create a new mesh
- * network (this behaviour would lead to a batman-over-batman configuration).
- * This function recursively checks all the fathers of the device passed as
- * argument looking for a batman-adv soft interface.
- *
- * Return: true if the device is descendant of a batman-adv mesh interface (or
- * if it is a batman-adv interface itself), false otherwise
- */
-static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
-{
- struct net_device *parent_dev;
- bool ret;
-
- /* check if this is a batman-adv mesh interface */
- if (batadv_softif_is_valid(net_dev))
- return true;
-
- /* no more parents..stop recursion */
- if (dev_get_iflink(net_dev) == 0 ||
- dev_get_iflink(net_dev) == net_dev->ifindex)
- return false;
-
- /* recurse over the parent device */
- parent_dev = __dev_get_by_index(&init_net, dev_get_iflink(net_dev));
- /* if we got a NULL parent_dev there is something broken.. */
- if (WARN(!parent_dev, "Cannot find parent device"))
- return false;
-
- ret = batadv_is_on_batman_iface(parent_dev);
-
- return ret;
-}
-
static int batadv_is_valid_iface(const struct net_device *net_dev)
{
if (net_dev->flags & IFF_LOOPBACK)
@@ -124,10 +86,6 @@ static int batadv_is_valid_iface(const struct net_device *net_dev)
if (net_dev->addr_len != ETH_ALEN)
return 0;
- /* no batman over batman */
- if (batadv_is_on_batman_iface(net_dev))
- return 0;
-
return 1;
}
--
2.6.2
Hello David,
here you have a bunch of patches intended for net.
This patchset is provided by Sven Eckelmann and it is basically
fixing 2 major issues that exist in several parts of the code -
that is why we have 8 patches.
The first bugfix (patch 1 and 2) is preventing call_rcu from
being invoked recursively. This would deceive any user waiting
on rcu_barrier() because the latter won't be able to wait for
the nested invocation thus triggering any sort of undefined
behaviours.
The second bugfix (patches from 3 to 8) prevents the code from
freeing rcu protected objects without waiting for the proper grace
period. This issue can potentially lead to wrong memory access
and thus kernel crashes.
Unfortunately this bogus code pattern was copy/pasted
all around the place when developing new features, therefore
Sven diligently created several patches to address each component
independently.
Given that such bugs were introduced quite some time ago, all
the patches except patch 5 should be considered for submission
to stable.
Please pull or let me know of any issue!
Thanks a lot,
Antonio
The following changes since commit 6c3f5aef1159a278b54642ebc0bbb5cdab7630cf:
bna: fix Rx data corruption with VLAN stripping enabled and MTU > 4096 (2016-01-15 21:49:25 -0500)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem
for you to fetch changes up to 42eff6a617e23b691f8e4467f4687ed7245a92db:
batman-adv: Drop immediate orig_node free function (2016-01-16 22:50:00 +0800)
----------------------------------------------------------------
Included changes:
- avoid recursive invocations of call_rcu() which would fool users waiting on
rcu_barrier()
- prevent immediate kfree of objects used in rcu protected contexts
----------------------------------------------------------------
Sven Eckelmann (8):
batman-adv: Avoid recursive call_rcu for batadv_bla_claim
batman-adv: Avoid recursive call_rcu for batadv_nc_node
batman-adv: Drop immediate batadv_orig_ifinfo free function
batman-adv: Drop immediate batadv_neigh_node free function
batman-adv: Drop immediate batadv_hardif_neigh_node free function
batman-adv: Drop immediate neigh_ifinfo free function
batman-adv: Drop immediate batadv_hard_iface free function
batman-adv: Drop immediate orig_node free function
net/batman-adv/bridge_loop_avoidance.c | 10 +-
net/batman-adv/hard-interface.h | 12 --
net/batman-adv/network-coding.c | 19 ++--
net/batman-adv/originator.c | 196 ++++++++++++---------------------
net/batman-adv/originator.h | 1 -
net/batman-adv/translation-table.c | 28 +++--
6 files changed, 94 insertions(+), 172 deletions(-)
BATADV_BONDING_TQ_THRESHOLD is not used anymore since the implementation
of the bat_neigh_is_similar_or_better() API function.
Such function uses the more generic BATADV_TQ_SIMILARITY_THRESHOLD
constant.
Therefore, remove definition of the unused BATADV_BONDING_TQ_THRESHOLD
constant.
Signed-off-by: Antonio Quartulli <a(a)unstable.cc>
---
net/batman-adv/main.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 32dfc9e..8c01f54 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -100,11 +100,6 @@
*/
#define BATADV_TQ_SIMILARITY_THRESHOLD 50
-/* how much worse secondary interfaces may be to be considered as bonding
- * candidates
- */
-#define BATADV_BONDING_TQ_THRESHOLD 50
-
/* should not be bigger than 512 bytes or change the size of
* forw_packet->direct_link_flags
*/
--
2.7.0
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
v6:
- removed patches which are now applied in the branch next
- rebased remaining patches on the patch
"batman-adv: Avoid recursive call_rcu for batadv_nc_node" which was
modified by Marek while he applied the patches (this unfortunately made
some of the remaining patches "hard" to apply)
v5:
- add hack which allows to compile against stable kernel like 3.2.44 which
also added the kref_get_unless_zero function
v4:
- fix function names in commit messages
- fix double whitespace in batadv_tt_orig_list_entry_release kerneldoc
- add extra patch for batadv_claim_free_ref kerneldoc fix
- change the phrase "free it" in all *_free_ref/*_put functions to "release it"
v3:
- update copyright year
v2:
- split patchset into fixes and kref migration to make it easier when the
decision is made where each patch will be applied
compat-include/linux/kref.h | 46 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 compat-include/linux/kref.h
diff --git a/compat-include/linux/kref.h b/compat-include/linux/kref.h
new file mode 100644
index 0000000..bb3442c
--- /dev/null
+++ b/compat-include/linux/kref.h
@@ -0,0 +1,46 @@
+/* Copyright (C) 2007-2016 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, 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_KREF_H_
+#define _NET_BATMAN_ADV_COMPAT_LINUX_KREF_H_
+
+#include <linux/version.h>
+#include_next <linux/kref.h>
+
+#include <linux/atomic.h>
+#include <linux/kernel.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
+
+/* some stable versions like Linux 3.2.44 also introduced this function
+ * and would therefore break the build because they trigger a redefinition
+ * of this function. Instead rename this function to be in the batadv_*
+ * namespace
+ */
+#define kref_get_unless_zero(__kref) batadv_kref_get_unless_zero(__kref)
+
+static inline int __must_check batadv_kref_get_unless_zero(struct kref *kref)
+{
+ return atomic_add_unless(&kref->refcount, 1, 0);
+}
+
+#endif /* < KERNEL_VERSION(3, 8, 0) */
+
+#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_KREF_H_ */
--
2.7.0.rc3
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
v4:
- fix function names in commit messages
- fix double whitespace in batadv_tt_orig_list_entry_release kerneldoc
- add extra patch for batadv_claim_free_ref kerneldoc fix
- change the phrase "free it" in all *_free_ref/*_put functions to "release it"
v3:
- update copyright year
v2:
- split patchset into fixes and kref migration to make it easier when the
decision is made where each patch will be applied
net/batman-adv/bridge_loop_avoidance.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index d9b034a..fc1b898 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -168,7 +168,8 @@ static void batadv_claim_free_rcu(struct rcu_head *rcu)
}
/**
- * batadv_claim_free_rcu - free a claim
+ * batadv_claim_free_ref - decrement the claim refcounter and possibly
+ * release it
* @claim: claim to be free'd
*/
static void batadv_claim_free_ref(struct batadv_bla_claim *claim)
--
2.6.4
Hi,
for those following the mailing list and other events around the B.A.T.M.A.N.
team the term 'B.A.T.M.A.N. V' probably sounds all too familiar. It has been
more than 5 years since the first ideas for improving the routing protocol
were exchanged. In the following years we had several GSoC projects dedicated
to pull this topic forward, countless hack & brainstorming sessions (including
sleepless nights at each battlemesh). Turns out, replacing a mature protocol
like B.A.T.M.A.N. IV takes more effort than you might think.
Another hurdle we kept running into was the missing separation between routing
logic and feature code preventing any developer and/or tester to quickly
switch from one protocol to the other. Now we have finally completed hiding
all routing logic behind an internal API allowing to change the routing
protocol while still benefiting from all the layer2 features.
With this mail the B.A.T.M.A.N. team announces the availability of the latest
protocol revision: B.A.T.M.A.N. V. Major features are its throughput based
path metric and packet type separation. For a high level overview about the
differences to B.A.T.M.A.N. IV feel invited to continue reading[1]. Technical
protocol specs also are available [2][3].
The code has already undergone stability and performance testing[4], thus is
considered ready for a wider audience testing. In the coming weeks said
patches will be included in the main source tree and sent upstream to the
kernel maintainers. Comments and feedback are welcome!
Next steps involve finishing the throughout meter[5] to enrich B.A.T.M.A.N. V
with an automatic link throughput detection when other mechanisms fail.
Happy routing,
The B.A.T.M.A.N. team
[1] https://www.open-mesh.org/projects/batman-adv/wiki/BATMAN_V
[2] https://www.open-mesh.org/projects/batman-adv/wiki/ELP
[3] https://www.open-mesh.org/projects/batman-adv/wiki/Ogmv2
[4] https://www.open-mesh.org/projects/batman-adv/wiki/BATMAN_V_Tests
[5] https://www.open-mesh.org/projects/open-mesh/wiki/2012-10-06-GSoC-2012-Edo-…
Hi,
I'm trying to do a mesh network using the RaspberryPi and Batman.
My problem is I'm using 2 wifi card on one raspberrypi one for batman and the other one for connecting to my wireless access point.
I already made my mesh network I can ping on layer 2 or 3 between 2 raspberrypi. When connecting the Ethernet cable(on the raspberry with 2 wifi dongle) I can use the bridge to ping toward the internet. But when I disconnect the cable I can't ping internet anymore.
I already verified my batman interface and my bridge both seem to work
The AP is connected on wlan1, wlan1 doesn't have an IP address assigned to it. The AP is configured with WPA2. When trying to assign a address using dhclient to the bridge interface the system can't seem to find a way and the command is waiting.
If I want to connected my batman network to a standard wifi AP do I need to use a bridge or the functionality exist with batman?
If it's with the bridge how can it work?
I'm putting the output of a few command at the end of the email. If you want anything else It will be my pleasure to send it.
André Pouliot
-----
root@raspberrypi:/home/pi# ifconfig
bat0 Link encap:Ethernet HWaddr 72:4c:12:42:f2:d4
inet6 addr: fe80::704c:12ff:fe42:f2d4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:354 errors:0 dropped:0 overruns:0 frame:0
TX packets:5857 errors:0 dropped:791 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:19536 (19.0 KiB) TX bytes:821562 (802.3 KiB)
eth0 Link encap:Ethernet HWaddr b8:27:eb:06:21:f3
inet addr:172.17.94.48 Bcast:172.17.95.255 Mask:255.255.240.0
inet6 addr: fe80::ba27:ebff:fe06:21f3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9628 errors:0 dropped:5 overruns:0 frame:0
TX packets:3273 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1054143 (1.0 MiB) TX bytes:380009 (371.1 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:216 errors:0 dropped:0 overruns:0 frame:0
TX packets:216 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22172 (21.6 KiB) TX bytes:22172 (21.6 KiB)
mesh-bridge Link encap:Ethernet HWaddr 00:0f:60:04:03:a6
inet addr:172.17.94.29 Bcast:172.17.95.255 Mask:255.255.240.0
inet6 addr: fe80::20f:60ff:fe04:3a6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9123 errors:0 dropped:0 overruns:0 frame:0
TX packets:2856 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:963896 (941.3 KiB) TX bytes:316106 (308.6 KiB)
wlan0 Link encap:Ethernet HWaddr 40:a5:ef:01:23:c8
inet6 addr: fe80::42a5:efff:fe01:23c8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1532 Metric:1
RX packets:22070 errors:0 dropped:0 overruns:0 frame:0
TX packets:29900 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2408956 (2.2 MiB) TX bytes:4165384 (3.9 MiB)
wlan1 Link encap:Ethernet HWaddr 00:0f:60:04:03:a6
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:2195 errors:0 dropped:1 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:276922 (270.4 KiB) TX bytes:3110 (3.0 KiB)
root@raspberrypi:/home/pi# brctl show
bridge name bridge id STP enabled interfaces
mesh-bridge 8000.000f600403a6 no bat0
eth0
wlan1
root@raspberrypi:/home/pi# batctl o
[B.A.T.M.A.N. adv 2015.0, MainIF/MAC: wlan0/40:a5:ef:01:23:c8 (bat0 BATMAN_IV)]
Originator last-seen (#/255) Nexthop [outgoingIF]: Potential nexthops ...
40:a5:ef:01:2f:58 0.010s (255) 40:a5:ef:01:2f:58 [ wlan0]: 40:a5:ef:01:2f:58 (255)
root@raspberrypi:/home/pi# iw dev wlan1 link
Connected to 00:24:01:65:e4:6d (on wlan1)
SSID: C2T3-Prod
freq: 2437
RX: 16265 bytes (149 packets)
TX: 180 bytes (3 packets)
signal: -43 dBm
tx bitrate: 6.5 MBit/s MCS 0
bss flags: short-preamble short-slot-time
dtim period: 1
beacon int: 100