Hi,
After some time of playing with the B.A.T.M.A.N protocol and
net-interface on OpenWRT and Debian I was thinking to use it with
the servers I use everyday (and maybe on routers/appliances I have
nanoBSD on).
So I started an effort...
(As a background) I already ported some applications to FreeBSD [and I'm
maintaining them] and
also I did work already on the Linux emulation layer of FreeBSD (FreeBSD
has a Linux syscall-emulation and Linux-KPI layers).
So my approach (as naturally I didn't expect the build of batman-adv.ko
to be successful as is),
was based on the approach that we [at FreeBSD] did to port Linux's
drm... <https://github.com/FreeBSDDesktop/kms-drm>
I ended up in adding some header-files to FreeBSD Linux-KPI (like
average.h, percpu.h, ...).
Now I'm at a state that Netlink blocks me and I'm to determine next step :-)
[Which I don't assume it being trivial with my current approach]
So I'd like to ask:
1- Is it better approach to "rewrite" batman-adv.ko [at least
Netlink-ish (let's call "Linuxism") parts] than what I'm doing now?
2- Any other efforts are being done out there?
3- is batmand deprecated [So I should mainly focus on batman-adv.ko]?
4- any other comments do you have? :D
P.S. sorry if I'm not really good at starting conversation from scratch
and out-of-nowhere :D
but I hope by continuing the collaboration we can have better (more
enriched) FreeBSD and better (as in more portable) B.A.T.M.A.N :-)
--
Best regards, MMokhi.
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(-)
Instead of disabling multicast optimizations mesh-wide once a node with
no multicast optimizations capabilities joins the mesh, do the
following:
Just insert such nodes into the WANT_ALL_IPV4/IPV6 lists. This is
sufficient to avoid multicast packet loss to such unsupportive nodes.
Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue>
---
net/batman-adv/multicast.c | 29 ++++++-----------------------
net/batman-adv/soft-interface.c | 1 -
net/batman-adv/types.h | 3 ---
3 files changed, 6 insertions(+), 27 deletions(-)
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index a35f597e..86725d79 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -815,9 +815,6 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
if (!atomic_read(&bat_priv->multicast_mode))
return -EINVAL;
- if (atomic_read(&bat_priv->mcast.num_disabled))
- return -EINVAL;
-
switch (ntohs(ethhdr->h_proto)) {
case ETH_P_IP:
return batadv_mcast_forw_mode_check_ipv4(bat_priv, skb,
@@ -1183,33 +1180,23 @@ static void batadv_mcast_tvlv_ogm_handler(struct batadv_priv *bat_priv,
{
bool orig_mcast_enabled = !(flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND);
u8 mcast_flags = BATADV_NO_FLAGS;
- bool orig_initialized;
if (orig_mcast_enabled && tvlv_value &&
tvlv_value_len >= sizeof(mcast_flags))
mcast_flags = *(u8 *)tvlv_value;
+ if (!orig_mcast_enabled) {
+ mcast_flags |= BATADV_MCAST_WANT_ALL_IPV4;
+ mcast_flags |= BATADV_MCAST_WANT_ALL_IPV6;
+ }
+
spin_lock_bh(&orig->mcast_handler_lock);
- orig_initialized = test_bit(BATADV_ORIG_CAPA_HAS_MCAST,
- &orig->capa_initialized);
- /* If mcast support is turned on decrease the disabled mcast node
- * counter only if we had increased it for this node before. If this
- * is a completely new orig_node no need to decrease the counter.
- */
if (orig_mcast_enabled &&
!test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) {
- if (orig_initialized)
- atomic_dec(&bat_priv->mcast.num_disabled);
set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
- /* If mcast support is being switched off or if this is an initial
- * OGM without mcast support then increase the disabled mcast
- * node counter.
- */
} else if (!orig_mcast_enabled &&
- (test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) ||
- !orig_initialized)) {
- atomic_inc(&bat_priv->mcast.num_disabled);
+ test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) {
clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
}
@@ -1595,10 +1582,6 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
spin_lock_bh(&orig->mcast_handler_lock);
- if (!test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) &&
- test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized))
- atomic_dec(&bat_priv->mcast.num_disabled);
-
batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS);
batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS);
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index edeffcb9..67065e35 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -796,7 +796,6 @@ static int batadv_softif_init_late(struct net_device *dev)
bat_priv->mcast.querier_ipv6.shadowing = false;
bat_priv->mcast.flags = BATADV_NO_FLAGS;
atomic_set(&bat_priv->multicast_mode, 1);
- atomic_set(&bat_priv->mcast.num_disabled, 0);
atomic_set(&bat_priv->mcast.num_want_all_unsnoopables, 0);
atomic_set(&bat_priv->mcast.num_want_all_ipv4, 0);
atomic_set(&bat_priv->mcast.num_want_all_ipv6, 0);
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 476b052a..0174f79e 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -1212,9 +1212,6 @@ struct batadv_priv_mcast {
/** @bridged: whether the soft interface has a bridge on top */
bool bridged;
- /** @num_disabled: number of nodes that have no mcast tvlv */
- atomic_t num_disabled;
-
/**
* @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP
* traffic
--
2.11.0
All tools which were known to the batman-adv development team are
supporting the batman-adv netlink interface since a while. Also debugfs is
not supported for batman-adv interfaces in any non-default netns. Thus
disabling CONFIG_BATMAN_ADV_DEBUGFS by default should not cause problems on
most systems. It is still possible to enable it in case it is still
required in a specific setup.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Was already submitted as RFC in https://patchwork.open-mesh.org/patch/16498/
---
Makefile | 2 +-
README.external.rst | 2 +-
gen-compat-autoconf.sh | 2 +-
net/batman-adv/Kconfig | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index fe97d0aa..de607ad9 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@
# read README.external for more information about the configuration
# batman-adv DebugFS entries:
-export CONFIG_BATMAN_ADV_DEBUGFS=y
+export CONFIG_BATMAN_ADV_DEBUGFS=n
# B.A.T.M.A.N. debugging:
export CONFIG_BATMAN_ADV_DEBUG=n
# B.A.T.M.A.N. bridge loop avoidance:
diff --git a/README.external.rst b/README.external.rst
index 6379b4f5..4a2e9f6a 100644
--- a/README.external.rst
+++ b/README.external.rst
@@ -43,7 +43,7 @@ option can be set to to y (enabled), n (disabled) or m (build as
module). Available options and their possible values are
(default marked with an "*")
- * ``CONFIG_BATMAN_ADV_DEBUGFS=[y*|n]`` (B.A.T.M.A.N. debugfs entries)
+ * ``CONFIG_BATMAN_ADV_DEBUGFS=[y|n*]`` (B.A.T.M.A.N. debugfs entries)
* ``CONFIG_BATMAN_ADV_DEBUG=[y|n*]`` (B.A.T.M.A.N. debugging)
* ``CONFIG_BATMAN_ADV_BLA=[y*|n]`` (B.A.T.M.A.N. bridge loop avoidance)
* ``CONFIG_BATMAN_ADV_DAT=[y*|n]`` (B.A.T.M.A.N. Distributed ARP Table)
diff --git a/gen-compat-autoconf.sh b/gen-compat-autoconf.sh
index 5a4cdefc..071b6ccf 100755
--- a/gen-compat-autoconf.sh
+++ b/gen-compat-autoconf.sh
@@ -52,7 +52,7 @@ gen_config() {
}
# write config variables
-gen_config 'CONFIG_BATMAN_ADV_DEBUGFS' ${CONFIG_BATMAN_ADV_DEBUGFS:="y"} >> "${TMP}"
+gen_config 'CONFIG_BATMAN_ADV_DEBUGFS' ${CONFIG_BATMAN_ADV_DEBUGFS:="n"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_DEBUG' ${CONFIG_BATMAN_ADV_DEBUG:="n"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_BLA' ${CONFIG_BATMAN_ADV_BLA:="y"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_DAT' ${CONFIG_BATMAN_ADV_DAT:="y"} >> "${TMP}"
diff --git a/net/batman-adv/Kconfig b/net/batman-adv/Kconfig
index e4e2e02b..bee034a9 100644
--- a/net/batman-adv/Kconfig
+++ b/net/batman-adv/Kconfig
@@ -94,13 +94,13 @@ config BATMAN_ADV_DEBUGFS
bool "batman-adv debugfs entries"
depends on BATMAN_ADV
depends on DEBUG_FS
- default y
+ default n
help
Enable this to export routing related debug tables via debugfs.
The information for each soft-interface and used hard-interface can be
found under batman_adv/
- If unsure, say Y.
+ If unsure, say N.
config BATMAN_ADV_DEBUG
bool "B.A.T.M.A.N. debugging"
--
2.16.2
Hi all,
I'm new to batman. I was wandering if I can install batman-adv 2018.0 on
a linux kernel 4.13, or if there are some compatibility problems.
Thank you
Best
Angelo
Hi David,
here are two late bugfixes for batman-adv which we would like to have in net
if still possible.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit fc04fdb2c8a894283259f5621d31d75610701091:
batman-adv: Fix skbuff rcsum on packet reroute (2018-03-18 13:20:32 +0100)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-net-for-davem-20180326
for you to fetch changes up to a752c0a4524889cdc0765925258fd1fd72344100:
batman-adv: fix packet loss for broadcasted DHCP packets to a server (2018-03-24 10:25:49 +0100)
----------------------------------------------------------------
Here are some batman-adv bugfixes:
- fix multicast-via-unicast transmissions for AP isolation and gateway
extension, by Linus Luessing (2 patches)
----------------------------------------------------------------
Linus Lüssing (2):
batman-adv: fix multicast-via-unicast transmission with AP isolation
batman-adv: fix packet loss for broadcasted DHCP packets to a server
net/batman-adv/gateway_client.c | 5 ++++-
net/batman-adv/multicast.c | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
From: Colin Ian King <colin.king(a)canonical.com>
In the case where hard_iface is NULL, the error path may pass a null
pointer to batadv_hardif_put causing a null pointer dereference error.
Avoid this by only calling the function if hard_iface not null.
Detected by CoverityScan, CID#1466456 ("Explicit null dereferenced")
Fixes: 53dd9a68ba68 ("batman-adv: add multicast flags netlink support")
Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
---
net/batman-adv/multicast.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index de3a055f7dd8..bd0ea374d043 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -1536,7 +1536,7 @@ batadv_mcast_netlink_get_primary(struct netlink_callback *cb,
if (!ret && primary_if)
*primary_if = hard_iface;
- else
+ else if (hard_iface)
batadv_hardif_put(hard_iface);
return ret;
--
2.15.1
Hi community,
We have batman-adv mesh network of 136 nodes perfectly running for about
6 months.
Our configure is:
- OpenWRT tag 15.05.1
- wpa_supplicant hostap_2_4
- 802.11 IBSS
- proto=WPA2
- key_mgmt=WPA-PSK
- pairwise=CCMP
- group=CCMP
The minor issue we have is that memory is fragmented after running 6
months for a large network of 136 nodes. I am speculating that it is
because of the periodical RNSA reauthentication.
If I read 802.11 spec "11.5.10 RSNA authentication in an IBSS"
correctly, there is reauth timer. Is dot11RSNAConfigPMKLifetime in
wpa_supplicant.conf the setting for the reauthentication timer?
The default value is 43200 (12 hours). What about I change this value to
be 2 weeks or a year?
Thanks.
Xuebing Wang