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 :-)
Hi Mokhi,
On Tuesday, February 13, 2018 6:52:51 PM CET Mahdi Mokhtari wrote:
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]
That sounds interesting ... will you be able to follow up the port with our development, or what is your plan on that? I'd assume that you need to rewrite a rather large chunk of "Linuxism" as you say, and I would assume that porting newer versions as we release would be quite some manual work.
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?
I don't have enough knowledge of FreeBSD to answer that. I would assume that the skb handling and netlink/debugfs parts are Linux specific. You'd at least need to rewrite those. You better don't touch the routing code, I would not advise rewriting that.
2- Any other efforts are being done out there?
I'm not aware. At least nothing serious (I remember someone demanding batman- adv to work in web browsers). :D
3- is batmand deprecated [So I should mainly focus on batman-adv.ko]?
We agreed to not call it deprecated, but there hasn't been any developments in the past 7 years except for some build-specific issues. I'd suggest to focus on batman-adv.ko. batmand may be easier to port though, but I see more people using batman-adv today.
4- any other comments do you have? :D
Good luck! :D
And please keep us posted!
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 :-)
Looking forward to it!
Cheers, Simon
Hi Mokhi -
batmand implements IP-based routing with an older version of the B.A.T.M.A.N. protocol. Development is stalled. It currently lacks originator message aggregation and IPv6 support. I might add some improvements and features one day, but don't bet your money on it.
However, it is a simple, lightweight and fully working mesh routing daemon that has been used mainly by Villagetelco and community networks. It can be used in high range, low bandwidth networks such as meshes between maritime sensors or short wave packet radio. For this, small packet size is required and using IPv6 addresses is unnecessary overhead.
Today most community networks that mainly deal with Internet traffic have replaced it with batman-adv, though. It offers more features and is under active development.
batman-adv is a different approach, as it doesn't implement IP-based routing but a virtual layer 2 switch via the mesh. batman-adv offers interesting and exciting capabilities, thanks to the different approach. However, the technical implementation is way more difficult and porting it to a different OS is probably a lot of work, as Simon has pointed out.
A IP-based fork of batmand is bmx6/7, which is actively developed, has IPv6 support, originator message aggregation support and many other bells and whistles.
There might be a *BSD port already, but I don't know. Porting bmx* should be relatively easy, as it is a IP routing daemon.
Cheers, Elektra
On Tue, 13 Feb 2018 18:52:51 +0330 Mahdi Mokhtari mmokhi@FreeBSD.org wrote:
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.
[please don't contact me privately (without Cc'ing the mailing list) about batman-adv - unless you have a good reason not to do so and state this in the mail]
On Saturday, 28 December 2019 14:39:05 CET Moritz Warning wrote:
I've met somebody who wants to port batman-adv to FreeBSD (in CC). The bigger task is to create a netlink glue layer that can be used for FreeBSD and other OSes.
I would guess that you should then get in contact with the netlink developers. batman-adv depends heavily on rtnetlink (only via the various hooks) and generic netlink. And they work quite differently.
There is already a (non-upstream?) hack to get some parts working [0]. But I haven't checked what it actually does and whether it can be used for anything at all.
But at the end we need a new new socket type (AF_NETLINK) and protocols on top of it. And the data from these protocols must not only be written/read but also the relevant infrastructure must be created to get the data to the correct receivers via the correct interfaces. Getting a good working AF_NETLINK with NETLINK_GENERIC already sounds like quite a big task for something as short as the GSoC. Don't forget that it has a lot of non-obvious features (multicast, [ext] ack, data type validation, subscriptions, attribute/command families, module autoloading, ...). So I would recommend to not even more on your plate for the first steps - maybe it is easier to avoid implementing NETLINK_ROUTE and the code to get rtnl_link_ops working to avoid a lot of wrapper code to reduce the implementation cost for the initial implementation.
Can he send you some specific netlink related questions? Or maybe you even know someone who would act as a mentor for is effort
I doubt that I can help a lot with the details about the inner workings of the various netlink (AF_NETLINK) based protocols. And I doubt that it is trivial to implement everything correctly in FreeBSD. You would have to:
1. implement AF_NETLINK 2. implement NETLINK_ROUTE for AF_NETLINK (maybe only minimal support for rtnl_link_ops) 3. implement NETLINK_GENERIC [1] for AF_NETLINK 4. port an userspace library like libnl3 (with the essential features) to freebsd 5. Get some applications working over both protocols
There are a lot more experienced people around. A good starting point would be to get the list of contributors from the Linux git tree. I would (as starting point) suggest
./scripts/get_maintainer.pl net/netlink ./scripts/get_maintainer.pl net/core/rtnetlink.c
(maybe even in a GSoC context).
Maybe it is a good idea to get in contact with the freifunk project and propose some (not overly complex) task for GSoC. But I would not know who is skilled enough and willingly to directly mentor him - and the last mentors in the open-mesh.org context were not eager to do it again.
He currently got stuck with netlink and his email to the batman-adv mailing list did not got far: https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2018-February/017562.html
There were two mails (Simon [2] + elektra [3]). But there were no further replies (or other mails) by him on the mailing list.
On Tuesday, 13 February 2018 16:22:51 CET Mahdi Mokhtari wrote:
P.S. sorry if I'm not really good at starting conversation from scratch and out-of-nowhere 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
Keep in mind that the batman-adv is primarily an in-tree module of Linux. So every change in our implementation has to be forwarded to the Linux networking developers (netdev) and later merged by Linus. So all changes which are implementing things in a non-Linux way will simply be rejected - either directly by us or by the next layer(s) (David S. Miller, Linus Torvalds, ...).
Kind regards, Sven
[0] https://github.com/luigirizzo/netlink-freebsd [1] https://wiki.linuxfoundation.org/networking/generic_netlink_howto [2] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2018-February/017563.html [3] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2018-February/017564.html
b.a.t.m.a.n@lists.open-mesh.org