From 1cf69fc5b7ffac3193ad8fa4439586c865c5acab Mon Sep 17 00:00:00 2001
From: Andreas Pape <apape(a)phoenixcontact.com>
Date: Fri, 12 Feb 2016 14:00:53 +0100
Subject: [PATCH 4/4] batman-adv: free skb when dropping broadcast packet
received from another backbone gw
skb should be freed in batadv_recv_bcast_packet if packet shall be dropped
due to
reception from another backbone gateway of the same backbone.
Signed-off-by: Andreas Pape <apape(a)phoenixcontact.com>
---
net/batman-adv/routing.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 4dd646a..128ed28 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1104,8 +1104,10 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
/* don't hand the broadcast up if it is from an originator
* from the same backbone.
*/
- if (batadv_bla_is_backbone_gw(skb, orig_node, hdr_size))
- goto out;
+ if (batadv_bla_is_backbone_gw(skb, orig_node, hdr_size)) {
+ kfree_skb(skb);
+ goto rx_success;
+ }
if (batadv_dat_snoop_incoming_arp_request(bat_priv, skb,
hdr_size))
goto rx_success;
--
1.7.0.4
..................................................................
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.
___________________________________________________________________
On Friday 12 February 2016 18:24:50 Andreas Pape wrote:
> Am I right that the problem comes from the e-mail client I use? Or is
> there an issue with the patch as such (i.e. how I created it with git - I
> tried to follow the description on open-mesh.org)?
It looks like your client in corrupting the patch. The first link should
explain how to configure some clients. Maybe you can follow the steps to
configure your client.
> I conclude from the
> error message in your mail that it's more likely that I have become a
> victim of my e-mail client.... If this is the case, I will follow the
> advice given in one of the links you refered to and send the patches to
> myself first and try out if they can be applied first before I make a
> second attempt to send them to the mailing list. Unfortunately I'm not
> allowed to use another e-mail client, but I think I can squeeze some
> settings for pure text e-mails (like automatic line breaks).
Usually the easiest way is to use git-send-email. But this would be a
different email client.
And let me guess, you have to use your phoenixcontact.com mail account to
contribute to projects... If nothing else works then maybe you can send it
just as attachments. It is a little bit ugly to comment on attachments but
better than no patches at all. (I hope it is ok for the maintainers)
> Sorry for spamming the mailing list with nonsense....
No problem. I've send more nonsense to the list than anyone else :)
> Just for my curiosity: are patches automatically applied to a repository
> if I send them to the mailing list? If this is the case, I didn't know. I
> would have been more cautious otherwise.
No, the patches are not applied anywhere automatically. Marek will go through
the patches and apply them manually after they were discussed on the
mailinglist.
Some projects use a tool called patchwork that gathers patches but even then
it wouldn't be applied in a git repo automatically.
Kind regards,
Sven
This patchset makes batman-adv network namespace aware. A soft
interface can be creates in a namespace and hard interfaces added to
it. soft interfaces cannot be moved between name spaces.
The biggest change is to debugfs, which is not natively netns aware,
unlike sysfs which is. A new netns directory has been added and within
that, a directory per network name space which batman is used within.
The changes are backwards compatible, in that interfaces in the global
namespace are not placed into a subdirectory.
/sys/kernel/debug/batman_adv
├── eth0
│ └── originators
├── eth1
│ └── originators
├── eth2
│ └── originators
├── netns
│ ├── 4026531957 -> ..
│ ├── 4026532176
│ │ ├── bat0
│ │ │ ├── bla_backbone_table
│ │ │ ├── bla_claim_table
│ │ │ ├── dat_cache
│ │ │ ├── gateways
│ │ │ ├── nc
│ │ │ │ ├── max_buffer_time
│ │ │ │ ├── max_fwd_delay
│ │ │ │ └── min_tq
│ │ │ ├── nc_nodes
│ │ │ ├── originators
│ │ │ ├── socket
│ │ │ ├── transtable_global
│ │ │ └── transtable_local
│ │ ├── emu1-veth1
│ │ │ └── originators
│ │ └── emu1-veth2
│ │ └── originators
│ ├── 4026532225
│ │ ├── bat0
│ │ │ ├── bla_backbone_table
│ │ │ ├── bla_claim_table
│ │ │ ├── dat_cache
│ │ │ ├── gateways
│ │ │ ├── nc
│ │ │ │ ├── max_buffer_time
│ │ │ │ ├── max_fwd_delay
│ │ │ │ └── min_tq
│ │ │ ├── nc_nodes
│ │ │ ├── originators
│ │ │ ├── socket
│ │ │ ├── transtable_global
│ │ │ └── transtable_local
│ │ ├── emu2-veth1
│ │ │ └── originators
│ │ └── emu2-veth2
│ │ └── originators
Patches are available for batctl and alfred, to make use of this new
structure.
The bat-over-bat detection has been enhanced, so that it is also netns
aware. It can also now cope with veth interfaces which are mutual
parents.
Andrew Lunn (4):
batman-adv: NETIF_F_NETNS_LOCAL feature to prevent netns moves
batman-adv: Create batman soft interfaces within correct netns.
batman-adv: Handle parent interfaces in a different netns
batman-adv: debugfs: Add netns support
net/batman-adv/debugfs.c | 118 ++++++++++++++++++++++++++++++++++++-
net/batman-adv/hard-interface.c | 49 +++++++++++++--
net/batman-adv/hard-interface.h | 2 +-
net/batman-adv/soft-interface.c | 9 ++-
net/batman-adv/soft-interface.h | 2 +-
net/batman-adv/sysfs.c | 3 +-
net/batman-adv/translation-table.c | 3 +-
7 files changed, 172 insertions(+), 14 deletions(-)
--
2.7.0.rc3
Hi,
it looks like the next version (with B.A.T.M.A.N. V support and cfg80211
dependency) has to be build against the mac80211 compat version. OpenWrt right
now uses Linux 3.18, 4.1, 4.3 and 4.4. These kernel versions don't require
many changes (which are not already part of the compat layer) to get batman-
adv building against it. But most of the required changes are rather ugly (see
batman-adv/patches/0000-compat-hacks.patch). But at least it builds with them.
I have the basic changes for openwrt-routing attached. Maybe someone has some
visions how to continue from here.
I've also attached the patch to build the current state of B.A.T.M.A.N. V on
OpenWrt.
Kind regards,
Sven
From: Andrew Lunn <andrew(a)lunn.ch>
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
[...]
This can be avoided by checking if two devices are each others parent and
stopping the check in this situation.
Fixes: 3d48811b27f5 ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface")
Signed-off-by: Andrew Lunn <andrew(a)lunn.ch>
[sven(a)narfation.org: rewritten description, extracted fix]
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
net/batman-adv/hard-interface.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index aea4d06..fbd3c91 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -79,6 +79,28 @@ out:
}
/**
+ * batadv_mutual_parents - check if two devices are each others parent
+ * @dev1: 1st net_device
+ * @dev: 2nd net_device
+ *
+ * veth devices come in pairs and each is the parent of the other!
+ *
+ * Return: true if the devices are each others parent, otherwise false
+ */
+static bool batadv_mutual_parents(const struct net_device *dev1,
+ const struct net_device *dev2)
+{
+ int dev1_parent_iflink = dev_get_iflink(dev1);
+ int dev2_parent_iflink = dev_get_iflink(dev2);
+
+ if (!dev1_parent_iflink || !dev2_parent_iflink)
+ return false;
+
+ return (dev1_parent_iflink == dev2->ifindex) &&
+ (dev2_parent_iflink == dev1->ifindex);
+}
+
+/**
* batadv_is_on_batman_iface - check if a device is a batman iface descendant
* @net_dev: the device to check
*
@@ -111,6 +133,9 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
if (WARN(!parent_dev, "Cannot find parent device"))
return false;
+ if (batadv_mutual_parents(net_dev, parent_dev))
+ return false;
+
ret = batadv_is_on_batman_iface(parent_dev);
return ret;
--
2.7.0
Hello David,
this is another pull request intended for net-next.
Here you have a batch of patches by Sven Eckelmann that
drops our private reference counting implementation and
substitutes it with the kref objects/functions.
Then you have a patch, by Simon Wunderlich, that
makes the broadcast protection window code more generic so
that it can be re-used in the future by other components
with different requirements.
Lastly, Sven is also introducing two lockdep asserts in
functions operating on our TVLV container list, to make
sure that the proper lock is always acquired by the users.
Please pull or let me know of any problem!
Thanks a lot,
Antonio
The following changes since commit aaa5672052cb0f18a5ab0ab19e9ef71c50e018a8:
sxgbe: remove unused code (2016-02-10 06:10:17 -0500)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to 92dcdf09a139e51b7b043b9443b8fd69de298dff:
batman-adv: Convert batadv_tt_common_entry to kref (2016-02-10 23:24:06 +0800)
----------------------------------------------------------------
Here you have a batch of patches by Sven Eckelmann that
drops our private reference counting implementation and
substitutes it with the kref objects/functions.
Then you have a patch, by Simon Wunderlich, that
makes the broadcast protection window code more generic so
that it can be re-used in the future by other components
with different requirements.
Lastly, Sven is also introducing two lockdep asserts in
functions operating on our TVLV container list, to make
sure that the proper lock is always acquired by the users.
----------------------------------------------------------------
Simon Wunderlich (1):
batman-adv: add seqno maximum age and protection start flag parameters
Sven Eckelmann (20):
batman-adv: Drop reference to netdevice on last reference
batman-adv: Add lockdep assert for container_list_lock
batman-adv: Convert batadv_hardif_neigh_node to kref
batman-adv: Convert batadv_gw_node to kref
batman-adv: Convert batadv_softif_vlan to kref
batman-adv: Convert batadv_bla_backbone_gw to kref
batman-adv: Convert batadv_bla_claim to kref
batman-adv: Convert batadv_nc_node to kref
batman-adv: Convert batadv_nc_path to kref
batman-adv: Convert batadv_dat_entry to kref
batman-adv: Convert batadv_tvlv_container to kref
batman-adv: Convert batadv_tvlv_handler to kref
batman-adv: Convert batadv_tt_orig_list_entry to kref
batman-adv: Convert batadv_neigh_ifinfo to kref
batman-adv: Convert batadv_orig_ifinfo to kref
batman-adv: Convert batadv_neigh_node to kref
batman-adv: Convert batadv_hard_iface to kref
batman-adv: Convert batadv_orig_node_vlan to kref
batman-adv: Convert batadv_orig_node to kref
batman-adv: Convert batadv_tt_common_entry to kref
net/batman-adv/bat_iv_ogm.c | 12 ++--
net/batman-adv/bridge_loop_avoidance.c | 43 +++++++++---
net/batman-adv/distributed-arp-table.c | 29 ++++++--
net/batman-adv/gateway_client.c | 44 ++++++++----
net/batman-adv/hard-interface.c | 25 ++++---
net/batman-adv/hard-interface.h | 16 ++---
net/batman-adv/main.c | 50 +++++++++++---
net/batman-adv/main.h | 3 +
net/batman-adv/multicast.c | 7 +-
net/batman-adv/network-coding.c | 51 +++++++++-----
net/batman-adv/originator.c | 122 ++++++++++++++++++++-------------
net/batman-adv/originator.h | 4 +-
net/batman-adv/routing.c | 26 ++++---
net/batman-adv/routing.h | 3 +-
net/batman-adv/soft-interface.c | 33 ++++++---
net/batman-adv/sysfs.c | 3 +-
net/batman-adv/translation-table.c | 90 +++++++++++++++++-------
net/batman-adv/types.h | 37 +++++-----
18 files changed, 405 insertions(+), 193 deletions(-)
The batadv_gw_node reference counter in batadv_gw_node_update can only be
reduced when the list entry was actually removed. Otherwise the reference
counter may reach zero when batadv_gw_node_update is called from two
different contexts for the same gw_node but only one context is actually
removing the entry from the list.
The release function for this gw_node is not called inside the list_lock
spinlock protected region because the function batadv_gw_node_update still
holds a gw_node reference for the object pointer on the stack. Thus the
actual release function (when required) will be called only at the end of
the function.
Fixes: 0511575c4d03 ("batman-adv: remove obsolete deleted attribute for gateway node")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
net/batman-adv/gateway_client.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 8350775..c9b8b48 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -527,11 +527,12 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
* gets dereferenced.
*/
spin_lock_bh(&bat_priv->gw.list_lock);
- hlist_del_init_rcu(&gw_node->list);
+ if (!hlist_unhashed(&gw_node->list)) {
+ hlist_del_init_rcu(&gw_node->list);
+ batadv_gw_node_free_ref(gw_node);
+ }
spin_unlock_bh(&bat_priv->gw.list_lock);
- batadv_gw_node_free_ref(gw_node);
-
curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
if (gw_node == curr_gw)
batadv_gw_reselect(bat_priv);
--
2.7.0
Fixes: 5c324517 ("ELP - compute the metric based on the estimated throughput")
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
---
net/batman-adv/bat_v_elp.c | 3 ++-
net/batman-adv/main.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index f257897..46c6a00 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -67,7 +67,8 @@ static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface)
* batadv_v_elp_get_throughput - get the throughput towards a neighbour
* @neigh: the neighbour for which the throughput has to be obtained
*
- * Return: the throughput towards the given neighbour.
+ * Return: The throughput towards the given neighbour in multiples of 100kpbs
+ * (a value of '1' equals to 0.1Mbps, '10' equals 1Mbps, etc).
*/
static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
{
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 7b05f68..db45336 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -62,7 +62,7 @@
#define BATADV_TQ_TOTAL_BIDRECT_LIMIT 1
/* B.A.T.M.A.N. V */
-#define BATADV_THROUGHPUT_DEFAULT_VALUE 10
+#define BATADV_THROUGHPUT_DEFAULT_VALUE 10 /* 1 Mbps */
#define BATADV_ELP_PROBES_PER_NODE 2
#define BATADV_ELP_MIN_PROBE_SIZE 200 /* bytes */
#define BATADV_ELP_PROBE_MAX_TX_DIFF 100 /* milliseconds */
--
2.7.0
Hello
I have a problem in my mesh setup which is quite similiar to Bug#216 of
the bug tracker.
I'm using batman-adv 2014.4.0 in a BLA setup consisting of 3 Mesh Nodes
(A, B, C) connected to the same backone network via a common switch and a
mesh node D connected to an end device E. I ping that single mesh node D
and the connected end device E from a PC which is connected to the same
switch as the three Nodes A to C. BLA is compiled and enabled.
From time to time I see looping unicast packets in my backbone network.
This unicast looping starts directly after one of the nodes A to C claimed
the mac address of my PC. The looping telegram is then the ping request
sent by the PC. I have a wireshark recording made in my backbone via port
mirroring of one of the switch ports where a mesh node is connected to
which shows this behaviour.
I am not sure if I understood bla correctly but isn't it nonsense that a
bla backbone gateway claims MAC addresses from its own backbone (i.e. the
one it is directly connected to via its ethernet port)?
A simple change in batadv_bla_rx seems to solve this problem: add an
additional check before claiming a new mac address: if this address is
already known from the tt local table (via command batadv_is_my_client)
don't claim it.
This seems to solve my problem as far as I have tested so far. Any
thoughts about that?
Best 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.
___________________________________________________________________