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
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
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.
* fix tp_vars refcount on queue_work() failure
* squash batadv_tp_start_work() into batadv_tp_start()
* read tp measurement result only once
* 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
* 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
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
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(-)
Use 'skb_queue_purge()' instead of re-implementing it.
Signed-off-by: Christophe JAILLET <christophe.jaillet(a)wanadoo.fr>
BTW, I don't really see the need of 'aggr_list_lock'. I think that the code
could be refactored to drop 'aggr_list_lock' and use the already existing
This would require to use the lock-free __skb_... variants when working on
As far as I understand, the use of 'aggr_list' and 'aggr_list_lock' is
limited to bat_v_ogm.c'. So the impact would be limited.
This would avoid a useless locking that never fails, so the performance
gain should be really limited.
So, I'm not sure this would be more readable and/or future proof, so
I just note it here to open the discussion.
If interested, I have a (compiled tested only) patch that implements this
net/batman-adv/bat_v_ogm.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
index dc4f7430cb5a..b841c83d9c3b 100644
@@ -177,13 +177,9 @@ static bool batadv_v_ogm_queue_left(struct sk_buff *skb,
static void batadv_v_ogm_aggr_list_free(struct batadv_hard_iface *hard_iface)
- struct sk_buff *skb;
- while ((skb = skb_dequeue(&hard_iface->bat_v.aggr_list)))
hard_iface->bat_v.aggr_len = 0;
here are two bugfixes which we would like to have integrated into net.
Please pull or let me know of any problem!
The following changes since commit 54ecb8f7028c5eb3d740bb82b0f1d90f2df63c5c:
Linux 5.4-rc1 (2019-09-30 10:35:40 -0700)
are available in the Git repository at:
for you to fetch changes up to 40e220b4218bb3d278e5e8cc04ccdfd1c7ff8307:
batman-adv: Avoid free/alloc race when handling OGM buffer (2019-10-13 21:00:07 +0200)
Here are two batman-adv bugfixes:
* Fix free/alloc race for OGM and OGMv2, by Sven Eckelmann (2 patches)
Sven Eckelmann (2):
batman-adv: Avoid free/alloc race when handling OGM2 buffer
batman-adv: Avoid free/alloc race when handling OGM buffer
net/batman-adv/bat_iv_ogm.c | 61 +++++++++++++++++++++++++++++++++++------
net/batman-adv/bat_v_ogm.c | 41 +++++++++++++++++++++------
net/batman-adv/hard-interface.c | 2 ++
net/batman-adv/types.h | 7 +++++
4 files changed, 94 insertions(+), 17 deletions(-)
I'm considering a certain deployment model here and wanted to get some
The design would be
-batman-adv router (could be raspberry pi, or pcengines, etc)
-1,2,3 etc complete radio devices doing 802.11s or dynamic WDS etc
with that radio interface bridged to an ethernet port connected to the
This might be called 'radio on a stick'.
an example might be
2 mikrotik omnitik ac devices on different channels, each with their
5Ghz radio configured as ap-bridge with dynamic WDS, those WDS
interfaces would be bridged with horizon (to eliminate loops) and 1
ethernet interface w/o horizon. Those interfaces would connect to the
mikrotik has an hwmp based mesh, but it's primitive and I don't want
nodes responding to other nodes in that mesh, I want batman-adv magic
in the mix. I might utilize this interface but with a 1 hop limit so
it works a lot like a horizon bridge without using horizon.
this design appears as ptp links plugged into a switch and has no
opportunity for loops. Each batman-adv router can broadcast and each
other batman-adv will receive that through the bridge because it
doesn't have horizon set, but the A and C devices that are 'bridged'
by B can't because those interfaces share horizon on B, or the hop
limit depending on the interface used. I'm thinking that solves any
issues batman-adv might have with putting the 'switch/hub' of sorts in
One thing I'm trying to solve here is the classic single radio mesh
issue of halves bandwidth, as well as having link health in the mix
without taking an interface offline. I'd rather have 2% packet loss
on an interface that have 100% packet loss.
additionally, this is for a hybrid mesh design where there is a ~50
node mesh with 2-3 backhauls to a mesh entry point on a tower, and
then likely a 'midspan' link or two with high capacity radios to
reduce hop count.
finally, this allows me to use off-the-shelf devices with pole mounts
etc for this while running the batman-adv router on the ground in an
appropriate container. A raspberry pi4 would be a great router for
this and I could use VLANs up the feed ethernet link.