Thanks for the quick reply Linus,
No transmission on IPv4, haven't tried on IPv6 but I assume is going
to be the same. Luan Jinlu suggested that I should use a bssid that
starts with 02. Is this a requirement for the mesh to work?
Should I share a batman-adv log? which packet type should be more useful?
Thanks a lot for your kind help!!
Best Regards,
Derick
> ---------- Forwarded message ----------
> From: "Linus Lüssing" <linus.luessing(a)c0d3.blue>
> To: The list for a Better Approach To Mobile Ad-hoc Networking <b.a.t.m.a.n(a)lists.open-mesh.org>
> Cc:
> Bcc:
> Date: Fri, 24 Feb 2017 09:28:11 +0100
> Subject: Re: [B.A.T.M.A.N.] Node freezes but still alive
> Hi Derick,
>
> On Thu, Feb 23, 2017 at 05:37:55PM -0600, Derick Roman De Leon Leal wrote:
> > I have a little setup with two nodes and one gateway, from time to
> > time one of the nodes just stops transmitting data.
>
> Very odd indeed. Can you check whether transmitting IPv4 or
> IPv6 packets on adhoc0 directly still works when this happens?
>
> Cheers, Linus
>
>
> _______________________________________________
> B.A.T.M.A.N mailing list
> B.A.T.M.A.N(a)lists.open-mesh.org
> https://lists.open-mesh.org/mm/listinfo/b.a.t.m.a.n
>
First of all, thanks in advance for this fantastic mesh protocol. I am
kind of new at this so any advice is welcome.
I have a little setup with two nodes and one gateway, from time to
time one of the nodes just stops transmitting data.
I see the node on the originators list but the TQ never changes unlike
when its working OK that the TQ changes a bit during the day. The
thing is that the node is there, since the last-seen time is updating
every few seconds just like when is working normal. I have tried
changing my batman configuration with no positive results. Also, I
have changed the nodes and this is still happening.
This happens and resolves itself in a couple of hours, but it does not
happen in other setups I have with more nodes.
I tried to search the internet for this issue with zero luck. The
three devices are OM2P-HS v3 running Openwrt r49395 with batman-adv
2016.2 using BATMAN IV.
Have you guys have encountered this problem before?
Is my configuration wrong in any way?
Do you have any recommendations for me?
Below is the configuration I am using, hope this helps. Please let me
know if there is any more information I can make available to you to
help me solve this problem.
Thanks a lot for taking the time to read all this. I appreciate any
comments and feedback you can give.
Kind Regards,
Derick
Nodes Configuration: -----------------------------------------------------
batman-adv +++++++++++++++++++++
config 'mesh' 'bat0'
option 'interfaces' 'mesh'
option 'aggregated_ogms'
option 'ap_isolation' '1'
option 'bonding'
option 'fragmentation' '1'
option 'gw_bandwidth'
option 'gw_mode' 'client'
option 'gw_sel_class'
option 'log_level'
option 'orig_interval'
option 'vis_mode'
option 'bridge_loop_avoidance' '1'
option 'distributed_arp_table'
option 'multicast_mode'
option 'network_coding'
option 'hop_penalty'
option 'isolation_mark'
wireless +++++++++++++++++++++++++++
config wifi-device radio0
option type mac80211
option channel 6
option hwmode 11g
option path 'platform/ar934x_wmac'
option htmode HT20
option country MX
config wifi-iface wlan0
option ifname wlan0
option device radio0
option network lan
option mode sta
option encryption none
option disabled 0
config wifi-iface mesh0
option device radio0
option ifname adhoc0
option network mesh
option mode adhoc
option ssid MY-SSID111
option bssid CA:FE:CA:FE:CA:FE
network +++++++++++++++++++++++++
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdaa:8902:bcc0::/48'
config interface 'lan'
option ifname 'eth0 bat0'
option force_link '1'
option type 'bridge'
option proto 'dhcp'
list dns 8.8.8.8
list dns 8.8.4.4
option peerdns 0
config interface 'wan'
option ifname 'eth1'
option proto 'dhcp'
config interface 'wan6'
option ifname 'eth1'
option proto 'dhcpv6'
config interface 'mesh'
option proto 'batadv'
option mtu '1528'
option mesh 'bat0'
Gateway configuration
-------------------------------------------------------------
everything is the same as in the nodes configuration but batman-adv file.
config 'mesh' 'bat0'
option 'interfaces' 'mesh'
option 'aggregated_ogms'
option 'ap_isolation' '1'
option 'bonding'
option 'fragmentation' '1'
option 'gw_bandwidth'
option 'gw_mode' 'server'
option 'gw_sel_class'
option 'log_level'
option 'orig_interval'
option 'vis_mode'
option 'bridge_loop_avoidance' '1'
option 'distributed_arp_table'
option 'multicast_mode'
option 'network_coding'
option 'hop_penalty'
option 'isolation_mark'
The function batadv_frag_skb_buffer was supposed not to consume the skbuff
on errors. This was followed in the helper function
batadv_frag_insert_packet when the skb would potentially be inserted in the
fragment queue. But it could happen that the next helper function
batadv_frag_merge_packets would try to merge the fragments and fail. This
results in a kfree_skb of all the enqueued fragments (including the just
inserted one). batadv_recv_frag_packet would detect the error in
batadv_frag_skb_buffer and try to free the skb again.
The behavior of batadv_frag_skb_buffer (and its helper
batadv_frag_insert_packet) must therefore be changed to always consume the
skbuff to have a common behavior and avoid the double kfree_skb.
Fixes: 9b3eab61754d ("batman-adv: Receive fragmented packets and merge")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Cc: Martin Hundebøll <martin(a)hundeboll.net>
net/batman-adv/fragmentation.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index ead18ca8..7b523e6c 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -239,8 +239,10 @@ err_unlock:
spin_unlock_bh(&chain->lock);
err:
- if (!ret)
+ if (!ret) {
kfree(frag_entry_new);
+ kfree_skb(skb);
+ }
return ret;
}
@@ -313,7 +315,7 @@ free:
*
* There are three possible outcomes: 1) Packet is merged: Return true and
* set *skb to merged packet; 2) Packet is buffered: Return true and set *skb
- * to NULL; 3) Error: Return false and leave skb as is.
+ * to NULL; 3) Error: Return false and free skb.
*
* Return: true when packet is merged or buffered, false when skb is not not
* used.
@@ -338,9 +340,9 @@ bool batadv_frag_skb_buffer(struct sk_buff **skb,
goto out_err;
out:
- *skb = skb_out;
ret = true;
out_err:
+ *skb = skb_out;
return ret;
}
--
2.11.0
Trying to split and transmit a unicast packet in 16 parts will fail for
the final fragment: After having sent the 15th one with a frag_packet.no
index of 14, we will increase the the index to 15 - and return with an
error code immediately, even though one more fragment is due for
transmission and allowed.
Fixing this issue by moving the check before incrementing the index.
While at it, adding an unlikely(), because the check is actually more of
an assertion.
Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue>
---
Compile time tested only
---
net/batman-adv/fragmentation.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 0854ebd..f181868 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -499,6 +499,12 @@ int batadv_frag_send_packet(struct sk_buff *skb,
/* Eat and send fragments from the tail of skb */
while (skb->len > max_fragment_size) {
+ /* The initial check in this function should cover this case */
+ if (unlikely(frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1)) {
+ ret = -EINVAL;
+ goto put_primary_if;
+ }
+
skb_fragment = batadv_frag_create(skb, &frag_header, mtu);
if (!skb_fragment) {
ret = -ENOMEM;
@@ -515,12 +521,6 @@ int batadv_frag_send_packet(struct sk_buff *skb,
}
frag_header.no++;
-
- /* The initial check in this function should cover this case */
- if (frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1) {
- ret = -EINVAL;
- goto put_primary_if;
- }
}
/* Make room for the fragment header. */
--
2.1.4
From: Jean Delvare <jdelvare(a)suse.de>
Git can be told to apply language-specific rules when generating diffs.
Enable this for C source code files (*.c and *.h) so that function names
are printed right. Specifically, doing so prevents "git diff" from
mistakenly considering unindented goto labels as function names.
Signed-off-by: Jean Delvare <jdelvare(a)suse.de>
[sven(a)narfation.org: Ported patch from linux.git]
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
.gitattributes | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.gitattributes b/.gitattributes
index eeef3e0..1d2a7e9 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,4 @@
/.gitignore export-ignore
/.gitattributes export-ignore
+*.c diff=cpp
+*.h diff=cpp
--
2.11.0
i observe a limit of 127 interfaces which can be hooked into bat0
where do i find this limit, or does somebody can tell me more about
this? Or, if it is a good idea to circumwent this at all? Or, if its
even possible in actual protocoll structure.
background:
Freifunk with tunneldigger and l2tp tunnel interfaces put a whole lot of
l2tp-eth interfaces in a bridge and hook the bridge into batman, which
make trouble and also doesnt feel like good practice. (i think to
circumvent this limit)
Freifunk with wireguard and gretap also have a lot of gretap tunnel
interfaces - but without bridging is limited to 127 interfaces
(we also experiment with vxlan which is limited to v4 in bridge
forwarding and by this not really an option - idea was to hook vxlan0 in
bat0 , which may be similar to bridging l2tp-eth)
you can find the test here (in german)
https://forum.freifunk.net/t/500-gretap-tunnel-interfaces-in-batman-einhaen…
or the wireguard in freifunk structures (batman network) here
https://forum.freifunk.net/t/wireguard-0-0-20161230-mit-linux-3-18-kernel-u…
the error if you exceed the interface limit in dmesg :
|Error - can't write to file
'/sys/class/net/gre127/batman_adv/mesh_iface': Cannot allocate memory|
--
make the world nicer, please use PGP encryption
Hi Jens
The script i just used is:
# add one if per 3 second and give output, also monitor dmesg
dmesg -w &
for i in `seq 1 255`; do
# one interface
ip link add gre$i type gretap local 192.168.99.1 remote 192.168.3.$i ttl 255 dev lan1
ip link set up dev gre$i
batctl if add gre$i
# another inf
ip link add grex$i type gretap local 192.168.99.1 remote 192.168.4.$i ttl 255 dev lan1
ip link set up dev grex$i
batctl if add grex$i
echo -n $(uptime|cut -d"," -f4-) $(ifconfig lan1|grep TX\ p) $i
sleep 3
done
So this adds two interfaces per 3 seconds to bat0.
root@wrt1900ac:~# batctl if
grex122: active
gre123: active
grex123: active
gre124: active
grex124: active
gre125: active
grex125: active
gre126: active
...
grex119: active
gre120: active
grex120: active
gre121: active
grex121: active
gre122: active
root@wrt1900ac:~# batctl if | wc
344 688 5116
So i have 344 interfaces in the mesh. No memory problems reported.
Andrew
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
net/batman-adv/translation-table.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 6077a87d46f0..a75f0a640bcd 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2253,12 +2253,13 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
/* its the last one, mark for roaming. */
tt_global_entry->common.flags |= BATADV_TT_CLIENT_ROAM;
tt_global_entry->roam_at = jiffies;
- } else
+ } else {
/* there is another entry, we can simply delete this
* one and can still use the other one.
*/
batadv_tt_global_del_orig_node(bat_priv, tt_global_entry,
orig_node, message);
+ }
}
/**
@@ -2314,10 +2315,11 @@ static void batadv_tt_global_del(struct batadv_priv *bat_priv,
/* local entry exists, case 2: client roamed to us. */
batadv_tt_global_del_orig_list(tt_global_entry);
batadv_tt_global_free(bat_priv, tt_global_entry, message);
- } else
+ } else {
/* no local entry exists, case 1: check for roaming */
batadv_tt_global_del_roaming(bat_priv, tt_global_entry,
orig_node, message);
+ }
out:
if (tt_global_entry)
Increase route switching likelikood with every seqno we missed from our
currently selected router.
This is safe to do without causing any loops at any time because the
sequence number is strictly larger than the one we last got from our
selected router.
---
Another idea to improve route convergence time. Simpler than the
"Rest-In-Peace" protocol idea, but they should be combinable.
Idea is a little inspired from once again potentially having missed a
bus: Should I stick to the plan of taking the bus and wait a few more
minutes (maybe it is just late?) or should I walk instead?
(Here in Lübeck buses usually arrive about every 30min. - or not all
between 00:30 and 04:30 - so it often makes sense to just use
the slower alternative of walking if you have missed it :-) )
Also inspired by the asymmetric link penalty.
Potential cons:
* might potentially increase route flappiness if the route has
a certain amount of packet loss / length
-> Maybe additional to broadcasting OGMs to neighbors, distribute it
to a few, good/promising ones via unicast, too?
PS: Please disregard the patch style, it's just an RFC for the
concept/idea for now :-)
---
net/batman-adv/bat_v_ogm.c | 51 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
index 03a35c9..08a79a9 100644
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/bat_v_ogm.c
@@ -492,6 +492,53 @@ out:
}
/**
+ * batadv_v_ogm_seq_tx - penalize router throughput
+ * @router_throughput: the router throughput to penalize
+ * @seq_diff: seqno diff between OGM and current router
+ */
+static u32 batadv_v_ogm_seq_tx(u32 router_throughput, u32 seq_diff)
+{
+ const u32 m = BATADV_OGM_MAX_ORIGDIFF;
+ const u32 r = router_throughput;
+ const u32 d = seq_diff;
+ u64 ret;
+
+ if (s <= 1)
+ return r;
+ else if (s >= d)
+ return 0;
+
+ /* f(x) = [ - 1/(m-1)^2 * (d-1)^2 + 1 ] * r */
+ ret = r * (m-1) * (m-1) - r * (d-1) * (d-1)
+ return (u32)(ret / ( (m-1) * (m-1) ));
+
+ /**
+ * For BATADV_OGM_MAX_ORIGDIFF == 5 equivalent to:
+ */
+ switch(seq_diff) {
+ case 0:
+ /* fallthrough */
+ case 1:
+ /* no penalty for seq-diff == 1 either,
+ * maybe the best route has just a little more
+ * latency
+ */
+ return router_throughput;
+ case 2:
+ /* 15/16 */
+ return 0.9375 * router_throughput;
+ case 3:
+ /* 3/4 */
+ return 0.75 * router_throughput;
+ case 4:
+ /* 7/16 */
+ return 0.4375 * router_throughput;
+ default:
+ return 0;
+ }
+}
+
+/**
* batadv_v_ogm_route_update - update routes based on OGM
* @bat_priv: the bat priv with all the soft interface information
* @ethhdr: the Ethernet header of the OGM2
@@ -570,8 +617,8 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
router_throughput = router_ifinfo->bat_v.throughput;
neigh_throughput = neigh_ifinfo->bat_v.throughput;
- if ((neigh_seq_diff < BATADV_OGM_MAX_ORIGDIFF) &&
- (router_throughput >= neigh_throughput))
+ if (batadv_v_ogm_seq_tx(router_throughput, neigh_seq_diff)
+ >= neigh_throughput)
goto out;
}
--
2.1.4