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.
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
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
Hi,
on an AWS server I get this error:
$ modprobe batman-adv
$ dmesg
...
[ 1310.125438] batman_adv: Unknown symbol cfg80211_get_station (err 0)
$ uname -a
Linux ip-172-31-47-217 4.15.0-1032-aws #34-Ubuntu SMP Thu Jan 17 15:18:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Hello all!
I recently configured a mesh with two nodes running Debian and
batman-adv and two wireless adapters TP-LINK TL-WN422G configured in
IBSS mode, and to allow non-mesh clients (like my cellphone) to use
the mesh I had to use another wireless adapter (same TL-WN422G)
configured in AP mode and bridged to the mesh interface (bat0).
Recently I found in the FAQ:
"Can batman-adv run on interfaces in AP / Station / etc mode ?
Q: Can BATMAN advanced run on interfaces in AP / Station mode?
A: Yes, because batman-adv doesn't know anything about stuff below the
ethernet interface. So you could also use it over layer 2 ethernet
tunnels, wifi ap, wifi sta, wifi adhoc, ethernet or even write a
virtual interface which prints everything on paper and scans the paper
on the remote machine (but you should be fast or increase the ogm
interval)."
I guess it is possible use the same adapter as AP and mesh client..
I my tests I found the AP mode and IBSS modes are mutually exclusive,
but I didn't find examples on how to create a mesh without IBSS...
Could you provide and example of configuration or some information
about how to do this?
I would like to create a mesh and allow non-mesh clients (like any
mobile) to connect and use a messenger service that will run over that
mesh and it would be great if every node of the mesh (using one
TL-WN422G adapter) can be also an AP for any client.
The adapters have the following supported modes and combinations:
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* monitor
* mesh point
* P2P-client
* P2P-GO
* outside context of a BSS
valid interface combinations:
* #{ managed, P2P-client } <= 2, #{ AP, mesh point, P2P-GO } <= 2,
total <= 2, #channels <= 1
I'm using Debian Stretch on the nodes
Thanks in advance!
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
=======
v3
--
* drop prefix "dev" and "slave"
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 | 271 ++++++++++++++++++++++++++++++++++++----
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, 770 insertions(+), 103 deletions(-)
create mode 100644 elp_interval.c
create mode 100644 throughput_override.c
--
2.20.1
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
The multicast code uses the lists bat_priv->mcast.want_all_rtr*_list to
store all all originator nodes which don't have the flag no-RTR4 or no-RTR6
set. When an originator is purged, it has to be removed from these lists.
Since all entries without the BATADV_MCAST_WANT_NO_RTR4/6 are stored in
these lists, they have to be handled like entries which have these flags
set to force the update routines to remove them from the lists when purging
the originator.
Not doing so will leave a pointer to a freed memory region inside the list.
Trying to operate on these lists will then cause an use-after-free error:
BUG: KASAN: use-after-free in batadv_mcast_want_rtr4_update+0x335/0x3a0 [batman_adv]
Write of size 8 at addr ffff888007b41a38 by task swapper/0/0
Fixes: 0a7733468f95 ("batman-adv: mcast: detect, distribute and maintain multicast router presence")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Cc: Linus Lüssing <linus.luessing(a)c0d3.blue>
See https://www.open-mesh.org/issues/395
---
net/batman-adv/multicast.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index a3488cfb..1d5bdf3a 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -2420,8 +2420,10 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
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);
- batadv_mcast_want_rtr4_update(bat_priv, orig, BATADV_NO_FLAGS);
- batadv_mcast_want_rtr6_update(bat_priv, orig, BATADV_NO_FLAGS);
+ batadv_mcast_want_rtr4_update(bat_priv, orig,
+ BATADV_MCAST_WANT_NO_RTR4);
+ batadv_mcast_want_rtr6_update(bat_priv, orig,
+ BATADV_MCAST_WANT_NO_RTR6);
spin_unlock_bh(&orig->mcast_handler_lock);
}
--
2.20.1
The bucket variable is only updated outside the loop over the mcast_flags
buckets. It will only be updated during a dumping run when the dumping has
to be interrupted and a new message has to be started.
This could result in repeated or missing entries when the multicast flags
are dumped to userspace.
Fixes: 06c82b7b15b1 ("batman-adv: Add inconsistent multicast netlink dump detection")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
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 67d7f830..a3488cfb 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -2303,7 +2303,7 @@ __batadv_mcast_flags_dump(struct sk_buff *msg, u32 portid,
while (bucket_tmp < hash->size) {
if (batadv_mcast_flags_dump_bucket(msg, portid, cb, hash,
- *bucket, &idx_tmp))
+ bucket_tmp, &idx_tmp))
break;
bucket_tmp++;
--
2.20.1
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