From: Andreas Pape <apape(a)phoenixcontact.com>
Like in the case of the patch for batadv_bla_tx to handle a race
condition when claiming a mac address for bla, a similar situation
can occur when claiming is triggered via batadv_bla_rx. This patch
solves this with a similar approach as for batadv_bla_tx.
Signed-off-by: Andreas Pape <apape(a)phoenixcontact.com>
---
net/batman-adv/bridge_loop_avoidance.c | 31 ++++++++++++++++++++-----------
net/batman-adv/translation-table.c | 26 ++++++++++++++++++++++++++
net/batman-adv/translation-table.h | 3 +++
3 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index d07e89e..cab8980 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1847,19 +1847,28 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
if (!claim) {
/* possible optimization: race for a claim */
- /* No claim exists yet, claim it for us!
+ /* Make sure this packet is not looping back
+ * from our own backbone.
*/
- batadv_dbg(BATADV_DBG_BLA, bat_priv,
- "bla_rx(): Unclaimed MAC %pM found. Claim it. Local: %s\n",
- ethhdr->h_source,
- batadv_is_my_client(bat_priv,
- ethhdr->h_source, vid) ?
- "yes" : "no");
- batadv_handle_claim(bat_priv, primary_if,
- primary_if->net_dev->dev_addr,
- ethhdr->h_source, vid);
- goto allow;
+ if (batadv_tt_local_has_timed_out(bat_priv, ethhdr->h_source,
+ vid, 100)) {
+ /* No claim exists yet, claim it for us!
+ */
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
+ "bla_rx(): Unclaimed MAC %pM found. Claim it. Local: %s\n",
+ ethhdr->h_source,
+ batadv_is_my_client(bat_priv,
+ ethhdr->h_source, vid) ?
+ "yes" : "no");
+
+ batadv_handle_claim(bat_priv, primary_if,
+ primary_if->net_dev->dev_addr,
+ ethhdr->h_source, vid);
+ goto allow;
+ } else {
+ goto handled;
+ }
}
/* if it is our own claim ... */
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index e75b493..b908195 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -4380,3 +4380,29 @@ void batadv_tt_cache_destroy(void)
kmem_cache_destroy(batadv_tt_req_cache);
kmem_cache_destroy(batadv_tt_roam_cache);
}
+
+bool batadv_tt_local_has_timed_out(struct batadv_priv *bat_priv,
+ const u8 *addr, unsigned short vid,
+ unsigned int timeout)
+{
+ struct batadv_tt_local_entry *tt_local_entry;
+ bool ret = true;
+
+ tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
+ if (!tt_local_entry)
+ goto out;
+ /* Check if the client has been logically deleted (but is kept for
+ * consistency purpose)
+ */
+ if ((tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING) ||
+ (tt_local_entry->common.flags & BATADV_TT_CLIENT_ROAM))
+ goto out;
+ /* Check that the tt_local_entry has a certain age */
+ if (!batadv_has_timed_out(tt_local_entry->last_seen, timeout))
+ ret = false;
+
+out:
+ if (tt_local_entry)
+ batadv_tt_local_entry_put(tt_local_entry);
+ return ret;
+}
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h
index 411d586..b05d0d8 100644
--- a/net/batman-adv/translation-table.h
+++ b/net/batman-adv/translation-table.h
@@ -65,5 +65,8 @@ bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv,
int batadv_tt_cache_init(void);
void batadv_tt_cache_destroy(void);
+bool batadv_tt_local_has_timed_out(struct batadv_priv *bat_priv,
+ const u8 *addr, unsigned short vid,
+ unsigned int timeout);
#endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
--
1.7.0.4
Hi David,
this is our first feature pull request for batman-adv (mostly containing
code cleanup stuff), there are at least two more to come.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit 29fbff8698fc0ac1a1d74584b258e0bf18b469f9:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2016-10-13 21:40:23 -0700)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-next-for-davem-20161027
for you to fetch changes up to 4c7da0f6dbcde2431d773ce03cde5e7abede54e0:
batman-adv: Avoid precedence issues in macros (2016-10-19 08:37:54 +0200)
----------------------------------------------------------------
This code cleanup patchset includes the following changes (chronological
order):
- bump version strings, by Simon Wunderlich
- README updates/clean up, by Sven Eckelmann (4 patches)
- Code clean up and restructuring by Sven Eckelmann (2 patches)
- Kerneldoc fix in forw_packet structure, by Linus Luessing
- Remove unused argument in dbg_arp, by Antonio Quartulli
- Add support to build batman-adv without wireless, by Linus Luessing
- Restructure error handling for is_ap_isolated, by Markus Elfring
- Remove unused initialization in various functions, by Sven Eckelmann
- Use better names for fragment and gateway list heads, by Sven
Eckelmann (2 patches)
- Convert to octal permissions for files, by Sven Eckelmann
- Avoid precedence issues for some macros, by Sven Eckelmann
----------------------------------------------------------------
Antonio Quartulli (1):
batman-adv: remove unsed argument from batadv_dbg_arp() function
Linus Lüssing (2):
batman-adv: fix batadv_forw_packet kerneldoc for list attribute
batman-adv: Allow selecting BATMAN V if CFG80211 is not built
Markus Elfring (1):
batman-adv: Less function calls in batadv_is_ap_isolated() after error detection
Simon Wunderlich (1):
batman-adv: Start new development cycle
Sven Eckelmann (12):
batman-adv: Add B.A.T.M.A.N. V sysfs files to README
batman-adv: Add network_coding and mcast sysfs files to README
batman-adv: Add dat, mcast, nc and neighbor debugfs files to README
batman-adv: Document new nc, mcast and tpmeter log levels
batman-adv: Remove unused function batadv_hash_delete
batman-adv: Move batadv_sum_counter to soft-interface.c
batman-adv: Remove unused batadv_icmp_user_cmd_type
batman-adv: Remove needless init of variables on stack
batman-adv: Use proper name for fragments list head
batman-adv: Use proper name for gateway list head
batman-adv: Use octal permissions instead of macros
batman-adv: Avoid precedence issues in macros
Documentation/networking/batman-adv.txt | 35 ++++++++++++----------
net/batman-adv/Kconfig | 2 +-
net/batman-adv/bat_iv_ogm.c | 6 ++--
net/batman-adv/bat_v.c | 8 ++---
net/batman-adv/bat_v_ogm.c | 4 +--
net/batman-adv/debugfs.c | 26 ++++++++--------
net/batman-adv/distributed-arp-table.c | 17 ++++-------
net/batman-adv/fragmentation.c | 18 +++++------
net/batman-adv/fragmentation.h | 2 +-
net/batman-adv/gateway_client.c | 9 +++---
net/batman-adv/hash.h | 30 -------------------
net/batman-adv/icmp_socket.c | 5 ++--
net/batman-adv/log.c | 4 +--
net/batman-adv/log.h | 12 ++++----
net/batman-adv/main.c | 2 +-
net/batman-adv/main.h | 27 ++---------------
net/batman-adv/network-coding.c | 8 ++---
net/batman-adv/originator.c | 10 +++----
net/batman-adv/packet.h | 12 +-------
net/batman-adv/send.c | 2 +-
net/batman-adv/soft-interface.c | 21 +++++++++++++
net/batman-adv/sysfs.c | 53 ++++++++++++++-------------------
net/batman-adv/translation-table.c | 25 +++++++---------
net/batman-adv/types.h | 16 +++++-----
24 files changed, 149 insertions(+), 205 deletions(-)
On Mittwoch, 25. Januar 2017 03:18:10 CET jens wrote:
> On 24.01.2017 14:39, Sven Eckelmann wrote:
> > There is no artificial limit added by batman-adv. But transmitting a lot of
> > broadcasts over 255 virtual links sharing the same physical link
> > might get interesting (independent of batman-adv).
>
> this made me curious , and i modified your script a bit - turns out
> after the 127. IF you add to batman-adv you get an Error -
> all 510 gretap links was succesfully build ...
> # ifconfig |grep gre| wc -l
> 515
> # batctl if|sort|wc -l
> 127
> the error is mainly
> *Error - can't write to file
> '/sys/class/net/gre128/batman_adv/mesh_iface': Cannot allocate memory
[...]
> [113990.684947] [<ffffffff8107c16e>] ? __warn+0xbe/0xe0 [113990.684955]
> [<ffffffffc017a804>] ? batadv_orig_hash_add_if+0x94/0x140 [batman_adv]
> [113990.684961] [<ffffffff811a7b10>] ? kmalloc_slab+0x90/0xa0
> [113990.684966] [<ffffffff811e08c5>] ? __kmalloc+0x25/0x580
> [113990.684971] [<ffffffff815ef9d7>] ? _raw_spin_lock_irqsave+0x17/0x39
> [113990.684977] [<ffffffff81432c11>] ? _crng_backtrack_protect+0x31/0x70
> [113990.684981] [<ffffffff811e0ebc>] ? kmem_cache_alloc_trace+0x9c/0x540
> [113990.684986] [<ffffffff814340b7>] ? get_random_bytes+0xe7/0x1c0
> [113990.684991] [<ffffffffc017a804>] ?
[...]
I would guess that your system mostly fails becauseit cannot handle the
allocation of the "large" arrays which store:
* @bcast_own: set of bitfields (one per hard-interface) where each one counts
* the number of our OGMs this orig_node rebroadcasted "back" to us (relative
* to last_real_seqno). Every bitfield is BATADV_TQ_LOCAL_WINDOW_SIZE bits long.
* @bcast_own_sum: sum of bcast_own
Kind regards,
Sven
Hi,
I have two access points with 2.4GHz and 5GHz radios.
Node A and Node B
Both radios are mesh via batman-adv. I can see them with batctl if.
Node A is server - batctl gw server
Node B is client
So here is my problem:
When I check batctl gwl, it shows that it uses Node A's 2.4GHz
interface. How can I set it so that it prefers 5GHz as mesh backhaul?
Thanks!
Hi,
the kernel community is currently trying to make the licensing status more
clear in each file. This is mostly done by adding SPDX license identifiers
and defining a set of rules how these license related information has to
be stored.
I've used this opportunity to also go through all files of alfred (for
example with FSFE's `reuse lint`) and to annotate the files according to
the "Linux licensing rules" and FSFE's REUSE practices.
There are two things which could be seen as controversial:
* change of batman_adv.h to the Linux preferred license
(I am waiting for Acks in the batman-adv patchset)
* explicitly mark remaining files as licensed under the GPL-2.0
Kind regards,
Sven
Sven Eckelmann (6):
alfred: Rename LICENSE to Linux's LICENSES/preferred/GPL-2.0
alfred: Add License-Filename to GPL-2.0 files
alfred: Import Linux's LICENSES/preferred/MIT
alfred: Add SPDX license identifier above copyright header
alfred: Mark remaining files as GPL-2.0
alfred: Change batman_adv.h license to MIT
.gitattributes | 3 +++
CHANGELOG.license | 2 ++
LICENSE => LICENSES/preferred/GPL-2.0 | 13 +++++++++++++
LICENSES/preferred/MIT | 30 ++++++++++++++++++++++++++++++
Makefile | 2 ++
README.license | 2 ++
alfred.h | 5 +++--
batadv_query.c | 5 +++--
batadv_query.h | 5 +++--
batadv_querynl.c | 5 +++--
batadv_querynl.h | 5 +++--
batman_adv.h | 27 +++++++++++++++++----------
bitops.h | 1 +
client.c | 5 +++--
debugfs.c | 5 +++--
debugfs.h | 5 +++--
gpsd/Makefile | 2 ++
gpsd/alfred-gpsd.c | 5 +++--
gpsd/alfred-gpsd.h | 5 +++--
gpsd/man/alfred-gpsd.8 | 2 ++
hash.c | 5 +++--
hash.h | 5 +++--
list.h | 5 +++--
main.c | 5 +++--
man/alfred.8 | 2 ++
netlink.c | 5 +++--
netlink.h | 5 +++--
netsock.c | 5 +++--
packet.h | 5 +++--
recv.c | 5 +++--
send.c | 5 +++--
server.c | 5 +++--
unix_sock.c | 5 +++--
util.c | 5 +++--
vis/Makefile | 2 ++
vis/man/batadv-vis.8 | 2 ++
vis/vis.c | 5 +++--
vis/vis.h | 5 +++--
38 files changed, 155 insertions(+), 60 deletions(-)
create mode 100644 CHANGELOG.license
rename LICENSE => LICENSES/preferred/GPL-2.0 (97%)
create mode 100644 LICENSES/preferred/MIT
create mode 100644 README.license
--
2.11.0
Hi,
I went through the build_test.git's testhelpers/kernel_mappings.iwyu and
cleaned that up a little bit. This requires that we have to adjust the
batman-adv sources slighty.
I have also found a build problem when you try to build B.A.T.M.A.N. V
against Linux < 3.7 and fixed it in the same patchset.
Kind regards,
Sven
Sven Eckelmann (6):
batman-adv: include gfp.h for GFP_* defines
batman-adv: include build_bug.h for BUILD_BUG_ON define
batman-adv: Include net.h for net_ratelimited_function
batman-adv: include kobject.h for kobject_* functions
batman-adv: Remove unused sched.h include
batman-adv: compat: Map to linux/nl80211.h for Linux < 3.7
compat-include/linux/build_bug.h | 34 ++++++++++++++++++++++++++++++++++
compat-include/uapi/linux/nl80211.h | 4 ++++
net/batman-adv/bat_iv_ogm.c | 2 +-
net/batman-adv/bat_v_elp.c | 2 +-
net/batman-adv/bat_v_ogm.c | 2 +-
net/batman-adv/bridge_loop_avoidance.c | 2 +-
net/batman-adv/debugfs.c | 1 -
net/batman-adv/distributed-arp-table.c | 2 +-
net/batman-adv/fragmentation.c | 2 +-
net/batman-adv/gateway_client.c | 2 +-
net/batman-adv/hard-interface.c | 2 +-
net/batman-adv/hash.c | 2 +-
net/batman-adv/icmp_socket.c | 1 +
net/batman-adv/log.c | 1 +
net/batman-adv/main.c | 4 ++--
net/batman-adv/multicast.c | 2 +-
net/batman-adv/netlink.c | 2 +-
net/batman-adv/network-coding.c | 3 ++-
net/batman-adv/originator.c | 2 +-
net/batman-adv/send.c | 2 +-
net/batman-adv/soft-interface.c | 2 +-
net/batman-adv/sysfs.c | 3 ++-
net/batman-adv/tp_meter.c | 4 ++--
net/batman-adv/translation-table.c | 5 +++--
net/batman-adv/tvlv.c | 2 +-
25 files changed, 66 insertions(+), 24 deletions(-)
create mode 100644 compat-include/linux/build_bug.h
--
2.11.0
Hi,
I was talking today with Simon about the "License cleanup" changes. He
would prefer when the *.license files don't exist (when possible). Luckily,
I already wanted to convert these files (or at least the READMEs) to
reStructuredText and I've already shown in these patchsets how the
SPDX annotation should be done for the lrest files. So it was just
logically to immediately post the conversion to rst and integration
of this tag.
We've also discussed how the changelog should look like. It should be
simple and we only wanted to show the date (not the time) anymore.
And the actual changelog lists should be kept (mostly untouched - beside
some minor format fixes to make it reStructuredText compatible).
This patchset is based on the "batman-adv: License cleanup" patchset.
Kind regards,
Sven
Sven Eckelmann (3):
batman-adv: Add .rst to README symlink
batman-adv: Convert CHANGELOG to reStructuredText
batman-adv: Convert README to reStructuredText
CHANGELOG | 634 ---------------------------------------------
CHANGELOG.license | 2 -
CHANGELOG.rst | 666 ++++++++++++++++++++++++++++++++++++++++++++++++
README.external | 51 ----
README.external.license | 2 -
README.external.rst | 59 +++++
README => README.rst | 0
7 files changed, 725 insertions(+), 689 deletions(-)
delete mode 100644 CHANGELOG
delete mode 100644 CHANGELOG.license
create mode 100644 CHANGELOG.rst
delete mode 100644 README.external
delete mode 100644 README.external.license
create mode 100644 README.external.rst
rename README => README.rst (100%)
--
2.11.0