[B.A.T.M.A.N.] batman-adv and/or batmand porting effort to FreeBSD
by Mahdi Mokhtari
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.
3 years, 1 month
[B.A.T.M.A.N.] [PATCH v5 0/7] B.A.T.M.A.N. V - fallback to tp meter estimation if throughput otherwise not available
by Marek Lindner
Under normal circumstances B.A.T.M.A.N. V retrieves the neighbor
throughput values to populate its metric tables from the various
drivers such as WiFi throughput tables and Ethernet throughput..
Whenever the interface drivers do not export link throughput
information manual overrides become necessary. To further
automate and thus better support these setups, ELP may call the
batman-adv throughput meter to schedule a throughput estimation
to be used to populate the metric table.
v5:
* fix tp_vars refcount on queue_work() failure
* squash batadv_tp_start_work() into batadv_tp_start()
v4:
* read tp measurement result only once
v3:
* fix ELP tp meter result computation
* use batadv_has_timed_out() instead of custom implementation
* set ELP tp meter test duration to 1000ms in patch #6
* add comment explaining periodic scheduling
v2:
* added sysfs attribute to configure tp meter test duration
* fixed null pointer dereference in TP meter packet sending routine
* fixed storing the measured throughput in the correct variable
* checkpatch/kerneldoc/sparse/smatch cleanup
Antonio Quartulli (3):
batman-adv: tp_meter - prevent concurrent tp_meter sessions by using
workqueue
batman-adv: tp_meter - don't check for existing session
batman-adv: tp_meter - add option to perform one-hop test
Marek Lindner (4):
batman-adv: tp_meter - allow up to 10 queued sessions
batman-adv: tp_meter - add caller distinction
batman-adv: ELP - use tp meter to estimate the throughput if otherwise
not available
batman-adv: ELP - add throughput meter test duration attribute
.../ABI/testing/sysfs-class-net-batman-adv | 7 +
include/uapi/linux/batadv_packet.h | 2 +
net/batman-adv/bat_v.c | 1 +
net/batman-adv/bat_v_elp.c | 69 ++-
net/batman-adv/bat_v_elp.h | 21 +
net/batman-adv/main.c | 10 +-
net/batman-adv/main.h | 7 +-
net/batman-adv/netlink.c | 3 +-
net/batman-adv/routing.c | 6 +-
net/batman-adv/sysfs.c | 3 +
net/batman-adv/tp_meter.c | 484 +++++++++++-------
net/batman-adv/tp_meter.h | 11 +-
net/batman-adv/types.h | 36 ++
13 files changed, 453 insertions(+), 207 deletions(-)
--
2.18.0
3 years, 2 months
[PATCH] batman-adv: Use wifi rx/tx as fallback throughput
by René Treffer
From: rtreffer <treffer(a)measite.de>
Some wifi drivers (e.g. ath10k) provide per-station rx/tx values but no
estimated throughput. Setting a better estimate than the default 1MBit
makes these devices work well with BATMAN V.
Signed-off-by: René Treffer <treffer(a)measite.de>
---
net/batman-adv/bat_v_elp.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 2614a9ca..ce3b52f1 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -68,7 +68,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
struct ethtool_link_ksettings link_settings;
struct net_device *real_netdev;
struct station_info sinfo;
- u32 throughput;
+ u32 throughput, rx, tx;
int ret;
/* if the user specified a customised value for this interface, then
@@ -107,10 +107,25 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
}
if (ret)
goto default_throughput;
- if (!(sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
- goto default_throughput;
- return sinfo.expected_throughput / 100;
+ if (sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT)) {
+ return sinfo.expected_throughput / 100;
+ }
+
+ // try to estimate en expected throughput based on reported rx/tx rates
+ // 1/3 of tx or 1/3 of the average of rx and tx, whichever is smaller
+ if (sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE)) {
+ tx = cfg80211_calculate_bitrate(&sinfo.txrate);
+ if (sinfo.filled & BIT(NL80211_STA_INFO_RX_BITRATE)) {
+ rx = cfg80211_calculate_bitrate(&sinfo.rxrate);
+ if (rx < tx) {
+ return (rx + tx) / 6;
+ }
+ }
+ return tx / 3;
+ }
+
+ goto default_throughput;
}
/* if not a wifi interface, check if this device provides data via
--
2.20.1
3 years, 5 months
[PATCH v2 0/6] batctl: Add vid support and hardif settings
by Sven Eckelmann
Hi,
I've asked a quite while back for some ideas regarding the support for hard
interface settings in batctl [1]. The current consensus seems to be that
a more iw-like interface is prefered.
vlan settings
=============
The requirement to have a VLAN master device on top of the batadv mesh
interface is artificially limiting the capabilities of batctl. Not all
master devices in linux which register a VLAN are from type "vlan" and are
only registering a single VLAN.
For example VLAN aware bridges can create multiple VLANs. These require
that the VLAN is identified using the VID and not the vlan device.
It is now possible to specify the vlan using:
$ batctl vlan bat0.8 ap_isolation enable
$ batctl meshif bat0 vid 8 ap_isolation enable
hardif settings
===============
The infrastructure for the new vlan/vid prefix of commands can now be used
to introduce another prefix: "hardif".
B.A.T.M.A.N. V introduced two additional settings which are hard (slave)
interface specific. These can can finally be implemented in batctl. This
will allow to change/read these settings when sysfs support is not enabled
in the kernel.
$ batctl hardif eth0 throughput_override 15mbit
$ batctl hardif eth0 elp_interval
Changes
=======
v2
--
* replaced (while still being compatible) -m option with "meshif"/"dev" prefix
* added alternative "slave" for "hardif" prefix
* automatically detect meshif for "hardif"/"slave"
* introduced enum selector_prefix to make code to select correct
subcommands/code paths better readable
* add helper to automatically guess the type of netdev to allow omission of
meshif/slave/vlan/... in some situations
v1
--
* initial version
[1] https://www.open-mesh.org/issues/373
Kind regards,
Sven
Sven Eckelmann (6):
batctl: Make vlan setting explicit
batctl: Integrate hardif setting framework
batctl: Add elp_interval setting command
batctl: Add throughput_override setting command
batctl: Replace '-m meshif' option with selector prefix
batctl: Allow to omit explicit prefix name
Makefile | 2 +
README.rst | 33 +++++
aggregation.c | 2 +-
ap_isolation.c | 15 ++-
bonding.c | 2 +-
bridge_loop_avoidance.c | 2 +-
distributed_arp_table.c | 2 +-
elp_interval.c | 111 ++++++++++++++++
fragmentation.c | 2 +-
functions.c | 119 +++++++++++++++---
functions.h | 8 +-
gw_mode.c | 2 +-
hop_penalty.c | 2 +-
interface.c | 2 +-
isolation_mark.c | 2 +-
loglevel.c | 2 +-
main.c | 273 ++++++++++++++++++++++++++++++++++++----
main.h | 23 +++-
man/batctl.8 | 60 +++++----
multicast_fanout.c | 2 +-
multicast_forceflood.c | 2 +-
multicast_mode.c | 2 +-
network_coding.c | 2 +-
orig_interval.c | 2 +-
ping.c | 2 +-
statistics.c | 2 +-
sys.c | 73 +++++++++--
sys.h | 5 +-
throughput_override.c | 113 +++++++++++++++++
throughputmeter.c | 2 +-
traceroute.c | 2 +-
translate.c | 2 +-
32 files changed, 772 insertions(+), 103 deletions(-)
create mode 100644 elp_interval.c
create mode 100644 throughput_override.c
--
2.20.1
3 years, 6 months
Re: [RFC net-next] net: dsa: add support for MC_DISABLED attribute
by Linus Lüssing
On Sat, Jun 29, 2019 at 07:29:45PM +0300, Ido Schimmel wrote:
> I would like to avoid having drivers take the querier state into account
> as it will only complicate things further.
I absolutely share your pain. Initially in the early prototypes of
multicast awareness in batman-adv we did not consider the querier state.
And doing so later did indeed complicate the code a good bit in batman-adv
(together with the IGMP/MLD suppression issues). I would have loved to
avoid that.
> Is there anything we can do about it? Enable the bridge querier if no
> other querier was detected? Commit c5c23260594c ("bridge: Add
> multicast_querier toggle and disable queries by default") disabled
> queries by default, but I'm only suggesting to turn them on if no other
> querier was detected on the link. Do you think it's still a problem?
As soon as you start becoming the querier, you will not be able to reliably
detect anymore whether you are the only querier candidate.
If any random Linux host using a bridge device were potentially becoming
a querier, that would cause quite some trouble when this host is
behind some bad, bottleneck connection. This host will receive
all multicast traffic, not just IGMP/MLD reports. And with a
congested connection and then unreliable IGMP/MLD, multicast would
become unreliable overall in this domain. So it's important that
your querier is not running in the "dark, remote, dusty closet" of
your network (topologically speaking).
> On Sun, Jun 23, 2019 at 10:44:27AM +0300, Ido Schimmel wrote:
> > See commit b00589af3b04 ("bridge: disable snooping if there is no
> > querier"). I think that's unfortunate behavior that we need because
> > multicast snooping is enabled by default. If it weren't enabled by
> > default, then anyone enabling it would also make sure there's a querier
> > in the network.
I do not quite understand that point. In a way, that's what we
have right now, isn't it? By default it's disabled, because by
default there is no querier on the link. So anyone wanting to use
multicast snooping will need to make sure there's a querier in the
network.
Overall I think the querier (election) mechanism in the standards could
need an update. While the lowest-address first might have
worked well back then, in uniform, fully wired networks where the
position of the querier did not matter, this is not a good
solution anymore in networks involving wireless, dynamic connections.
Especially in wireless mesh networks this is a bit of an issue for
us. Ideally, the querier mechanism were dismissed in favour of simply
unsolicited, periodic IGMP/MLD reports...
But of course, updating IETF standards is no solution for now.
While more complicated, it would not be impossible to consider the
querier state, would it? I mean you probably already need to
consider the case of a user disabling multicast snooping during
runtime, right? So similarly, you could react to appearing or
disappearing queriers?
Cheers, Linus
3 years, 6 months
[B.A.T.M.A.N.] [PATCH] batman-adv: handle race condition for claims also in batadv_bla_rx
by Simon Wunderlich
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
3 years, 7 months
[PATCH 1/2] batctl: tcpdump: Add support for MCASTv2 RTR(4|6) flags
by Sven Eckelmann
The batman-adv commit 0a7733468f95 ("batman-adv: mcast: detect, distribute
and maintain multicast router presence") added support for two new flags
BATADV_MCAST_WANT_NO_RTR4 and BATADV_MCAST_WANT_NO_RTR6. These are
announced in IV_OGM and OGMv2.
batctl's tcpdump requires support for it to make debugging of
router-to-router multicast problems in networks easier.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
tcpdump.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tcpdump.c b/tcpdump.c
index 158b82e..0e2ae8e 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -230,10 +230,12 @@ static void batctl_tvlv_parse_mcast_v2(void *buff, ssize_t buff_len)
flags = tvlv->flags;
- printf("\tTVLV MCASTv2: [%c%c%c]\n",
+ printf("\tTVLV MCASTv2: [%c%c%c%s%s]\n",
flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES ? 'U' : '.',
flags & BATADV_MCAST_WANT_ALL_IPV4 ? '4' : '.',
- flags & BATADV_MCAST_WANT_ALL_IPV6 ? '6' : '.');
+ flags & BATADV_MCAST_WANT_ALL_IPV6 ? '6' : '.',
+ !(flags & BATADV_MCAST_WANT_NO_RTR4) ? "R4" : ". ",
+ !(flags & BATADV_MCAST_WANT_NO_RTR6) ? "R6" : ". ");
}
typedef void (*batctl_tvlv_parser_t)(void *buff, ssize_t buff_len);
--
2.20.1
3 years, 7 months
[PATCH 00/10] pull request for net-next: batman-adv 2019-06-27 v2
by Simon Wunderlich
Hi David,
here is the updated feature/cleanup pull request of batman-adv for net-next
from yesterday. Your change suggestions have been integrated into Patch 6
of the series, everything else is unchanged.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit a188339ca5a396acc588e5851ed7e19f66b0ebd9:
Linux 5.2-rc1 (2019-05-19 15:47:09 -0700)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-next-for-davem-20190627v2
for you to fetch changes up to 11d458c1cb9b24ac899b1ec6284676f6b1914305:
batman-adv: mcast: apply optimizations for routable packets, too (2019-06-27 19:25:05 +0200)
----------------------------------------------------------------
This feature/cleanup patchset includes the following patches:
- bump version strings, by Simon Wunderlich
- fix includes for _MAX constants, atomic functions and fwdecls,
by Sven Eckelmann (3 patches)
- shorten multicast tt/tvlv worker spinlock section, by Linus Luessing
- routeable multicast preparations: implement MAC multicast filtering,
by Linus Luessing (2 patches, David Millers comments integrated)
- remove return value checks for debugfs_create, by Greg Kroah-Hartman
- add routable multicast optimizations, by Linus Luessing (2 patches)
----------------------------------------------------------------
Greg Kroah-Hartman (1):
batman-adv: no need to check return value of debugfs_create functions
Linus Lüssing (5):
batman-adv: mcast: shorten multicast tt/tvlv worker spinlock section
batman-adv: mcast: collect softif listeners from IP lists instead
batman-adv: mcast: avoid redundant multicast TT entries with bridges
batman-adv: mcast: detect, distribute and maintain multicast router presence
batman-adv: mcast: apply optimizations for routable packets, too
Simon Wunderlich (1):
batman-adv: Start new development cycle
Sven Eckelmann (3):
batman-adv: Fix includes for *_MAX constants
batman-adv: Add missing include for atomic functions
batman-adv: Use includes instead of fwdecls
include/uapi/linux/batadv_packet.h | 8 +
net/batman-adv/bat_algo.h | 7 +-
net/batman-adv/bat_v.c | 3 +-
net/batman-adv/bat_v_elp.h | 4 +-
net/batman-adv/bat_v_ogm.h | 3 +-
net/batman-adv/bridge_loop_avoidance.h | 9 +-
net/batman-adv/debugfs.c | 99 +--
net/batman-adv/debugfs.h | 9 +-
net/batman-adv/distributed-arp-table.h | 7 +-
net/batman-adv/fragmentation.h | 3 +-
net/batman-adv/gateway_client.h | 9 +-
net/batman-adv/gateway_common.c | 1 +
net/batman-adv/gateway_common.h | 3 +-
net/batman-adv/hard-interface.c | 7 +-
net/batman-adv/hard-interface.h | 5 +-
net/batman-adv/hash.h | 3 +-
net/batman-adv/icmp_socket.c | 20 +-
net/batman-adv/icmp_socket.h | 5 +-
net/batman-adv/log.c | 17 +-
net/batman-adv/log.h | 1 +
net/batman-adv/main.h | 12 +-
net/batman-adv/multicast.c | 1092 +++++++++++++++++++++++++-------
net/batman-adv/multicast.h | 6 +-
net/batman-adv/netlink.c | 4 +-
net/batman-adv/netlink.h | 3 +-
net/batman-adv/network-coding.c | 29 +-
net/batman-adv/network-coding.h | 14 +-
net/batman-adv/originator.c | 4 +-
net/batman-adv/originator.h | 7 +-
net/batman-adv/routing.h | 3 +-
net/batman-adv/send.h | 3 +-
net/batman-adv/soft-interface.c | 6 +-
net/batman-adv/soft-interface.h | 7 +-
net/batman-adv/sysfs.c | 1 +
net/batman-adv/sysfs.h | 5 +-
net/batman-adv/tp_meter.c | 1 +
net/batman-adv/tp_meter.h | 3 +-
net/batman-adv/translation-table.h | 9 +-
net/batman-adv/tvlv.h | 3 +-
net/batman-adv/types.h | 69 +-
40 files changed, 1041 insertions(+), 463 deletions(-)
3 years, 7 months
[PATCH 0/2] pull request for net: batman-adv 2019-06-27
by Simon Wunderlich
Hi David,
here are some bugfixes which we would like to have integrated into net.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit a188339ca5a396acc588e5851ed7e19f66b0ebd9:
Linux 5.2-rc1 (2019-05-19 15:47:09 -0700)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-net-for-davem-20190627
for you to fetch changes up to 9e6b5648bbc4cd48fab62cecbb81e9cc3c6e7e88:
batman-adv: Fix duplicated OGMs on NETDEV_UP (2019-06-02 13:33:48 +0200)
----------------------------------------------------------------
Here are some batman-adv bugfixes:
- fix a leaked TVLV handler which wasn't unregistered, by Jeremy Sowden
- fix duplicated OGMs when interfaces are set UP, by Sven Eckelmann
----------------------------------------------------------------
Jeremy Sowden (1):
batman-adv: fix for leaked TVLV handler.
Sven Eckelmann (1):
batman-adv: Fix duplicated OGMs on NETDEV_UP
net/batman-adv/bat_iv_ogm.c | 4 ++--
net/batman-adv/hard-interface.c | 3 +++
net/batman-adv/translation-table.c | 2 ++
net/batman-adv/types.h | 3 +++
4 files changed, 10 insertions(+), 2 deletions(-)
3 years, 7 months