This change has been made for local TT already, add another one for
global TT - but only for temporary entries (aka speedy join), to prevent
inconsistencies between local and global tables in case an older
batman-adv version is still announcing those entries from its local
table.
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
---
net/batman-adv/translation-table.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index e75b4937..4b64a9a6 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -4012,6 +4012,12 @@ bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv,
{
bool ret = false;
+ /* ignore loop detect macs, they are not supposed to be in the tt local
+ * data as well.
+ */
+ if (batadv_bla_is_loopdetect_mac(addr))
+ return false;
+
if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid,
BATADV_TT_CLIENT_TEMP,
atomic_read(&orig_node->last_ttvn)))
--
2.11.0
From: Gao Feng <fgao(a)ikuai8.com>
Because the func batadv_softif_init_late allocate some resources and
it would be invoked in register_netdevice. So we need to invoke the
func batadv_softif_free instead of free_netdev to cleanup when fail
to register_netdevice.
Signed-off-by: Gao Feng <fgao(a)ikuai8.com>
---
net/batman-adv/soft-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index d042c99..90bf990 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -1011,7 +1011,7 @@ struct net_device *batadv_softif_create(struct net *net, const char *name)
if (ret < 0) {
pr_err("Unable to register the batman interface '%s': %i\n",
name, ret);
- free_netdev(soft_iface);
+ batadv_softif_free(soft_iface);
return NULL;
}
--
1.9.1
batadv_tp_meter_init() is invoked in batadv_init() only
which is marked with __init.
For this reason batadv_tp_meter_init() can be marked with
__init as well and dropped after module load.
Signed-off-by: Antonio Quartulli <a(a)unstable.cc>
---
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 556f9a86..0334c56d 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -1497,7 +1497,7 @@ void batadv_tp_meter_recv(struct batadv_priv *bat_priv, struct sk_buff *skb)
/**
* batadv_tp_meter_init - initialize global tp_meter structures
*/
-void batadv_tp_meter_init(void)
+void __init batadv_tp_meter_init(void)
{
get_random_bytes(batadv_tp_prerandom, sizeof(batadv_tp_prerandom));
}
--
2.13.0
From: "David S. Miller" <davem(a)davemloft.net>
Network devices can allocate reasources and private memory using
netdev_ops->ndo_init(). However, the release of these resources
can occur in one of two different places.
Either netdev_ops->ndo_uninit() or netdev->destructor().
The decision of which operation frees the resources depends upon
whether it is necessary for all netdev refs to be released before it
is safe to perform the freeing.
netdev_ops->ndo_uninit() presumably can occur right after the
NETDEV_UNREGISTER notifier completes and the unicast and multicast
address lists are flushed.
netdev->destructor(), on the other hand, does not run until the
netdev references all go away.
Further complicating the situation is that netdev->destructor()
almost universally does also a free_netdev().
This creates a problem for the logic in register_netdevice().
Because all callers of register_netdevice() manage the freeing
of the netdev, and invoke free_netdev(dev) if register_netdevice()
fails.
If netdev_ops->ndo_init() succeeds, but something else fails inside
of register_netdevice(), it does call ndo_ops->ndo_uninit(). But
it is not able to invoke netdev->destructor().
This is because netdev->destructor() will do a free_netdev() and
then the caller of register_netdevice() will do the same.
However, this means that the resources that would normally be released
by netdev->destructor() will not be.
Over the years drivers have added local hacks to deal with this, by
invoking their destructor parts by hand when register_netdevice()
fails.
Many drivers do not try to deal with this, and instead we have leaks.
Let's close this hole by formalizing the distinction between what
private things need to be freed up by netdev->destructor() and whether
the driver needs unregister_netdevice() to perform the free_netdev().
netdev->priv_destructor() performs all actions to free up the private
resources that used to be freed by netdev->destructor(), except for
free_netdev().
netdev->needs_free_netdev is a boolean that indicates whether
free_netdev() should be done at the end of unregister_netdevice().
Now, register_netdevice() can sanely release all resources after
ndo_ops->ndo_init() succeeds, by invoking both ndo_ops->ndo_uninit()
and netdev->priv_destructor().
And at the end of unregister_netdevice(), we invoke
netdev->priv_destructor() and optionally call free_netdev().
Signed-off-by: David S. Miller <davem(a)davemloft.net>
---
It is an RFC because I need someone clever to create the compat code for this.
net/batman-adv/soft-interface.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index b25789a..10f7edf 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -1034,8 +1034,6 @@ static void batadv_softif_free(struct net_device *dev)
* netdev and its private data (bat_priv)
*/
rcu_barrier();
-
- free_netdev(dev);
}
/**
@@ -1047,7 +1045,8 @@ static void batadv_softif_init_early(struct net_device *dev)
ether_setup(dev);
dev->netdev_ops = &batadv_netdev_ops;
- dev->destructor = batadv_softif_free;
+ dev->needs_free_netdev = true;
+ dev->priv_destructor = batadv_softif_free;
dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL;
dev->priv_flags |= IFF_NO_QUEUE;
--
2.11.0
Hi community,
This email is mainly addressed to hostap/wpa_supplicant mailing list.
Descriptions of my issue:
- I am establishing IBSS/adhoc network using OpenWRT 15.05 + ath9k (AR9331).
- When nodes are relatively closely placed, the peers (the term is
'neighbors' in batman-adv mesh) reach 40, ath9k driver detects "tx hung,
resetting the chip" (for RESET_TYPE_TX_HANG).
- This ath9k "tx hung" randomly happens among the 40 nodes (in adhoc
network), and it happens relatively often (seemingly randomly for
nodes), and randomly makes some nodes un-usable.
- This appears to be an issue with ath9k kernel driver or ath9k hardware
that it can not handle ~40 peers.
- IBSS/adhoc with 20 peers work well.
Is there a config in wpa_supplicant that we can limit the number of peers?
In the other words, once the number of peers ('iw wlan0 station dump')
reaches a pre-configured number (e.g. 12 or 16), wpa_supplicant does not
authenticate any more, for IBSS/adhoc only?
- A subtle detail: once a new beacon with higher RSSI is detected, the
current connection with lowest RSSI will be de-authenticated, and to
authenticate this new peer (with higher RSSI in beacon).
Is this "limiting number of peers for IBSS/adhoc" a good work-around for
40+ peers adhoc network, although the ultimate root cause seemingly is
with ath9k kernel driver or ath9k hardware?
Also, if there are many (like 40+) peers in IBSS/adhoc network, I am not
sure how medium access contention and collisions factor in, for
management frames?
Here is my wpa_supplicant conf file:
------
ctrl_interface=/var/run/wpa_supplicant
# use 'ap_scan=2' on all devices connected to the network
# this is unnecessary if you only want the network to be created when no
other networks are available
ap_scan=2
network={
ssid="Net-xxxxxxxx"
mode=1
frequency=2462
proto=WPA2
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk="xxxxxxxx"
}
------
Another approach could be to use user-space shell script to "iw <dev>
ibss leave" for the lower RSSI stations?
- As I am using batman-adv to build mesh network on the top of
IBSS/adhoc, a similar approach can be done at batman-adv level.
Suggestions?
Thanks.
Xuebing Wang
Hi Simon, Sven,
Thanks for your excellent help. We have 50+ sites (and a total of 1000+
nodes running in the field) for over a month, and batman-adv works
perfectly, maybe I wasn't notified, but I did not hear a single failure.
We have an edge case:
Our nodes are relatively closely placed, which results in 40+ neighbors
for each node. And batman-adv seemingly does not work for this edge
case. The issue may be that with this many 40+ neighbors, and neighbors'
neighbors, ... it is complicated to calculate the route, is this the
possible cause?
The resolution I can think of is that we can choose the best 12 or so
(configurable) neighbors (based on signal strength). Is this choosing
configurable 12 or so best neighbors the best approach? I can try to
make the change, and upstream for your code-review / merge.
Thanks again.
Xuebing Wang
This patch prevents that entries in the global translation table are generated
for mac addresses used by loop detection frames.
Signed-off-by: Andreas Pape <apape(a)phoenixcontact.com>
---
net/batman-adv/translation-table.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index e75b493..ca1e0f7 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1618,8 +1618,10 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
struct batadv_tt_common_entry *common;
u16 local_flags;
- /* ignore global entries from backbone nodes */
- if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid))
+ /* ignore global entries from backbone nodes or
+ * adding of entries related to loop detect frames */
+ if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid) ||
+ batadv_bla_is_loopdetect_mac(tt_addr))
return true;
tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid);
--
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: Ulrich Leidecker, Christoph Leifer
__________________________________________________________________
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.
___________________________________________________________________
The return value check after the tg_hash_new call must actually check the
return value and not some other datastructure.
Fixes: a7bc3d9a2b3f ("alfred: Cache the global translation table entries")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server.c b/server.c
index 1e358cf..9774281 100644
--- a/server.c
+++ b/server.c
@@ -232,7 +232,7 @@ static void update_server_info(struct globals *globals)
if (strcmp(globals->mesh_iface, "none") != 0) {
tg_hash = tg_hash_new(globals->mesh_iface);
- if (!globals->data_hash) {
+ if (!tg_hash) {
fprintf(stderr, "Failed to create translation hash\n");
return;
}
--
2.11.0
Hello,
I stumbled across some weired MAC addresses starting with ba:be in the
global translation-table when running batman-adv-2017.0.1. I run my setup
with bla enabled.
Most of the entries in the global tt of my devices consist of these mac
addresses. Looking through the code they come from frames which seem to be
used for loop detection. Adding such MAC addresses to the local tt is
prevented with the help of the batadv_bla_is_loopdetect_mac function. I
wonder why adding these macs to the global tt is not prevented in a
simliar way. Would it be possible to add a corresponding check to
batadv_tt_global_add to prevent these macs from being added to the global
tt? Or is there a specific reason why these mac addresses must occur in
the global tt and which I have not understood so far?
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: Ulrich Leidecker, Christoph Leifer
__________________________________________________________________
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,
alfred uses the TQ from batman-adv to find its best alfred neighbor. This best
neighbor information is used by slave servers to request/publish data.
This is done for each server announcement packet by:
* requesting the global translation table (netlink or debugfs) and then
searching in it for the MAC address of the detected alfred server to find
its originator address
* requesting the originator table (netlink or debugfs) and then searching it
it for the originator address of the detected alfred server to find its TQ
value
This was previously done whenever a new announcement packet received by
alfred. We've observed that this can be a problem on networks with a lot of
master servers (~100) which can see each other, large translation tables and
slow CPUs. alfred still worked but the CPU load by alfred was rather high
(~20% on an 560MHz AR9344).
The idea is now to avoid this lookup for master servers. And (for slave
servers) to process all servers at once. This is done before the wants to push
its local data to a master server in an sync interval.
The process which was described earlier was now changed to:
* requesting the global translation table (netlink or debugfs) and then put
MAC address and corresponding originator address in tg hash
* requesting the originator table (netlink or debugfs) and then put
originator address and corresponding TQ value orig hash
* got through all servers:
- search in tg hash for for the MAC address of the alfred server to find
its originator address
- search in orig hash for for the originator address of the alfred server
to find its TQ value
These changes reduced the load on the previously mentioned devices
significantly.
Kind regards,
Sven
Sven Eckelmann (5):
alfred: Move alfred specific netlink code in separate file
alfred: Only query tq of remote master in slave mode
alfred: Check the TQ of master servers before pushing data
alfred: Cache the TQ values for each originator
alfred: Cache the global translation table entries
Makefile | 1 +
alfred.h | 1 -
batadv_query.c | 227 +++++++++++++++++++++++++++++++++++++++++--------------
batadv_query.h | 25 +++++-
batadv_querynl.c | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++
batadv_querynl.h | 34 +++++++++
netlink.c | 195 -----------------------------------------------
netlink.h | 7 --
recv.c | 15 +---
server.c | 56 +++++++++++++-
10 files changed, 501 insertions(+), 276 deletions(-)
create mode 100644 batadv_querynl.c
create mode 100644 batadv_querynl.h