This cover letter only tries to recap the changes applied from the previous
version. Please check the patch for major details.
Changes from v1:
- rebased on top of latest master (some patches from the previous patchset were
merged already)
- accidental change to the GW table header moved to right patch
- remove bat_ prefix from API names
- API subobjects redefined as proper struct instead of anonymous ones to fix
kernel-doc complaints
- bonus kernel-doc added
- missing include files added
Changes from v2:
- minimum default value of gw_sel_class restored to 1
Changes from v3:
- move "batman-adv: split routing API data structure in subobjects" as patch 1
- check if algo_ops->gw.get_best_gw_node was implemented before calling it
- add patch to disable GW mode knobs if API have not been implemented (6/6)
Changes from v4:
- drop CONFIG_BATMAN_ADV_BATMAN_V dependency when declaring batadv_gw_node_get()
in gateway_client.h
- rebased on top of current master
Cheers,
Antonio Quartulli (4):
batman-adv: make the GW selection class algorithm specific
batman-adv: make GW election code protocol specific
batman-adv: B.A.T.M.A.N. V - implement GW selection logic
batman-adv: disable sysfs knobs when GW-mode is not implemented
net/batman-adv/bat_iv_ogm.c | 219 ++++++++++++++++++++++++++++++++++
net/batman-adv/bat_v.c | 254 +++++++++++++++++++++++++++++++++++++++-
net/batman-adv/gateway_client.c | 222 +++++------------------------------
net/batman-adv/gateway_client.h | 5 +
net/batman-adv/gateway_common.c | 5 +-
net/batman-adv/sysfs.c | 62 +++++++++-
net/batman-adv/types.h | 23 ++++
7 files changed, 592 insertions(+), 198 deletions(-)
--
2.8.4
The function batadv_send_skb_unicast is not acquiring a reference for an
orig_node nor removing it from any datastructure. It still reduces the
reference counter for an object which is still in the hands of the caller.
This is confusing and can lead to problems in the reference handling in the
caller function. This breaks for example the reference counting in
batadv_interface_tx when an DHCP packet (BATADV_DHCP_TO_SERVER) is
detected in a multicast (not broadcast) packet which is later detected by
the multicast code as BATADV_FORW_SINGLE. The multicast code then assumes
that it will send it and acquires the originator to the destination. But in
reality, the DHCP forwarding code takes precedence and as result the
reference counter is not decreased anymore.
Fixes: 405cc1e5a81e ("batman-adv: Modified forwarding behaviour for multicast packets")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
net/batman-adv/send.c | 22 ++++++++++++++++------
net/batman-adv/soft-interface.c | 3 +++
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 729deec..44be408 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -362,8 +362,6 @@ int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
ret = NET_XMIT_SUCCESS;
out:
- if (orig_node)
- batadv_orig_node_put(orig_node);
if (ret == NET_XMIT_DROP)
kfree_skb(skb);
return ret;
@@ -395,6 +393,7 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
struct batadv_orig_node *orig_node;
u8 *src, *dst;
+ int ret;
src = ethhdr->h_source;
dst = ethhdr->h_dest;
@@ -406,8 +405,13 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
}
orig_node = batadv_transtable_search(bat_priv, src, dst, vid);
- return batadv_send_skb_unicast(bat_priv, skb, packet_type,
- packet_subtype, orig_node, vid);
+ ret = batadv_send_skb_unicast(bat_priv, skb, packet_type,
+ packet_subtype, orig_node, vid);
+
+ if (orig_node)
+ batadv_orig_node_put(orig_node);
+
+ return ret;
}
/**
@@ -425,10 +429,16 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
unsigned short vid)
{
struct batadv_orig_node *orig_node;
+ int ret;
orig_node = batadv_gw_get_selected_orig(bat_priv);
- return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
- orig_node, vid);
+ ret = batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
+ orig_node, vid);
+
+ if (orig_node)
+ batadv_orig_node_put(orig_node);
+
+ return ret;
}
void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 216ac03..e508bf5 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -57,6 +57,7 @@
#include "hard-interface.h"
#include "multicast.h"
#include "network-coding.h"
+#include "originator.h"
#include "packet.h"
#include "send.h"
#include "sysfs.h"
@@ -377,6 +378,8 @@ dropped:
dropped_freed:
batadv_inc_counter(bat_priv, BATADV_CNT_TX_DROPPED);
end:
+ if (mcast_single_orig)
+ batadv_orig_node_put(mcast_single_orig);
if (primary_if)
batadv_hardif_put(primary_if);
return NETDEV_TX_OK;
--
2.8.1
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.
v3:
- rebased patchset
- moved snooping of ip addresses for dat speed up into separate function
- removed "patch of a patch"
- removed automatic claiming during check of a claim
- fixed issues of the patchset not being compiled due to chosen batman
options
Kind regards,
Andreas
..................................................................
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.
___________________________________________________________________
Hi Team,
I really appreciate for all your contributions in the mesh network.
I am trying to set-up mesh network using tplink WR1043ND routers and
raspberry pi B+ integrated with ra2800usb (wi pi). The tplink routers
are working as expected. Howoever, the raspberry pi is not working.
The configuration file for the Pi board is as follows:
config interface loopback
option ifname lo
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0
config interface lan
option ifname eth0
option type bridge
option proto static
option ipaddr 192.168.1.1
option netmask 255.255.255.0
config interface 'mesh'
option ifname 'adhoc0'
option mtu '1528'
option proto 'batadv'
option mesh 'bat0'
config interface mb
option ifname bat0
option type bridge option proto static
option ipaddr 192.168.99.26
option netmask 255.255.255.0
using the same config in tplink routers work but not in pi boards. The
adhoc0 interface is not shown up in pi board.
cat sys/class/net/adhoc0/batman-adv/mesh_iface says none.
cat sys/class/net/adhoc0/batman-adv/staus says not in use.
Please Help!!! Thanks in advance.
Yours Sincerely,
Sailash M
Research Student
Good day,
I'm currently finishing writing my bachelor thesis whose topic is mesh
networks. I have been running batmand and comparing it in performance
to olsrd; one metric I can't seem to be able to measure, though, is
network convergence time, i.e., the time it takes for a new node to be
discovered when connected and forgotten when disconnected from the
network. This is due to the fact that batmand doesn't seem to display
updated information in the same way that olsrd does (with
DebugLevel=2). I've tried looking at the routing tables but these also
aren't updated when a host disconnects and get purged after some time
has passed.
Is there any way I can get a real time view of the network to calculate
the time it takes for a host to be discovered/forgotten?
Thanks,
Thomas Tiotto
Università degli Studi di Milano
I've followed the quick start guide, but apparently I'm missing
something when it comes to non-batman clients.
I've set all this up using vagrant and VirtualBox. The mesh seems to
work perfectly, however when I put in non-batman clients they cannot
communicate one with another. I would expect that they would be able to
ping one another.
I've given IP addresses to the bridge adapters on the 192.168.1.0/24
subnet. The clients I've given IP addresses on that same subnet
(192.168.1.121 and 192.168.1.142). When I tried pinging, I don't get
anything back. Sniffing packets in tcpdump shows that it is never
getting anything back, though I did get an ARP back once with the
correct MAC address, but still couldn't ping. Never got an ARP back
again...
I can ping from each client to the IP address of the bridge they are
connecting to, but cannot ping anything else on the network.
Any thoughts? Hopefully someone has seen this before and can point me
in the right direction!
Also, is there a separate list for alfred, or should I use this list for
alfred questions?
Thanks!
Jon
Here are the commands I used to setup:
batctl if add eth0 (eth0 already up)
ip link add name br0 type bridge
ip link set dev eth1 master br0
ip link set dev bat0 master br0
ip link set up dev eth1
ip link set up dev bat0
ip addr replace dev br0 192.168.1.102/24 (and 104 on the other node)
Here is what batadv-vis shows for my setup (I changed the labels "TT"
for the two clients to "CLI<IP>").
digraph {
subgraph "cluster_08:00:27:2c:10:05" {
"08:00:27:2c:10:05"
}
"08:00:27:2c:10:05" -> "08:00:27:6b:86:2e" [label="1.016"]
"08:00:27:2c:10:05" -> "0a:00:27:00:00:06" [label="TT"]
"08:00:27:2c:10:05" -> "1e:8d:d3:23:ab:d4" [label="TT"]
"08:00:27:2c:10:05" -> "08:00:27:b1:38:03" [label="CLI142"]
"08:00:27:2c:10:05" -> "1e:8d:d3:23:ab:d4" [label="TT"]
"08:00:27:2c:10:05" -> "08:00:27:1c:9b:14" [label="TT"]
subgraph "cluster_08:00:27:a2:8c:62" {
"08:00:27:a2:8c:62"
}
"08:00:27:a2:8c:62" -> "08:00:27:83:dd:41" [label="1.000"]
"08:00:27:a2:8c:62" -> "08:00:27:38:31:55" [label="1.000"]
"08:00:27:a2:8c:62" -> "08:00:27:f6:78:1a" [label="TT"]
"08:00:27:a2:8c:62" -> "d6:f4:e6:bd:22:fb" [label="TT"]
"08:00:27:a2:8c:62" -> "d6:f4:e6:bd:22:fb" [label="TT"]
"08:00:27:a2:8c:62" -> "0a:00:27:00:00:05" [label="TT"]
subgraph "cluster_08:00:27:38:31:55" {
"08:00:27:38:31:55"
}
"08:00:27:38:31:55" -> "08:00:27:83:dd:41" [label="1.000"]
"08:00:27:38:31:55" -> "08:00:27:a2:8c:62" [label="1.000"]
"08:00:27:38:31:55" -> "52:98:12:67:6b:06" [label="TT"]
"08:00:27:38:31:55" -> "0a:00:27:00:00:04" [label="TT"]
"08:00:27:38:31:55" -> "08:00:27:08:ee:90" [label="CLI121"]
"08:00:27:38:31:55" -> "52:98:12:67:6b:06" [label="TT"]
"08:00:27:38:31:55" -> "08:00:27:17:21:9d" [label="TT"]
subgraph "cluster_08:00:27:6b:86:2e" {
"08:00:27:6b:86:2e"
"08:00:27:83:dd:41" [peripheries=2]
}
"08:00:27:6b:86:2e" -> "08:00:27:2c:10:05" [label="1.000"]
"08:00:27:83:dd:41" -> "08:00:27:38:31:55" [label="1.000"]
"08:00:27:83:dd:41" -> "08:00:27:a2:8c:62" [label="1.016"]
"08:00:27:6b:86:2e" -> "a6:f4:5c:fa:06:cd" [label="TT"]
"08:00:27:6b:86:2e" -> "0a:00:27:00:00:03" [label="TT"]
"08:00:27:6b:86:2e" -> "08:00:27:9c:bb:a3" [label="TT"]
"08:00:27:6b:86:2e" -> "a6:f4:5c:fa:06:cd" [label="TT"]
}
The tp_meter code frees the skb when the batadv_send_skb_to_orig returns <
0. But the batadv_send_skb_to_orig only defines -1 as return code for
failed submits with still valid skbs.
Fixes: 98d7a766b645 ("batman-adv: throughput meter implementation")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Interesting because a patch was submitted to net next to remove NET_XMIT_POLICED
and return -EINPROGRESS instead.
I will maybe later send more patches because the current way of handling
DROPPED/free'd skb/not-freed skb is quite confusing.
net/batman-adv/tp_meter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index ed99afb..bf6bffb 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -615,7 +615,7 @@ static int batadv_tp_send_msg(struct batadv_tp_vars *tp_vars, const u8 *src,
batadv_tp_fill_prerandom(tp_vars, data, data_len);
r = batadv_send_skb_to_orig(skb, orig_node, NULL);
- if (r < 0)
+ if (r == -1)
kfree_skb(skb);
if (r == NET_XMIT_SUCCESS)