neli
neli copied to clipboard
FreeBSD 13.2 support
FreeBSD 13.2 introduces Netlink support. libc has to expose the necessary bits for netlink-sys to build (for which I started https://github.com/rust-lang/libc/pull/3201), but FreeBSD does not have the same wide support as Linux, and not all constants available on Linux are available on FreeBSD.
neli
currently assumes that all Linux-available constants are exported by libc, and thus cannot currently build on FreeBSD, even if above-mentionned PR would be extended to cover all constants effectively available in FreeBSD.
Such constants include socket families (AF_AX25
, ...), and other various enum values (NFULA_CT
, ...,NFULA_CFG_CMD
, etc)
The issue is the same that rust-netlink
has, reported there as https://github.com/rust-netlink/netlink-packet-route/issues/30. Likely a common solution could be worked out.
What would you recommend here? I think it may be a little bit hard to set up a CI job with FreeBSD with Github Actions because of the difference in kernel and userspace.
I don't have a full battle-plan for this, but my basic idea would be to decouple the neli enums from the libc consts: use auto-numbering for the neli enums, and use a match
statement to get the libc values when they are needed to make the effective calls. This should make it easier to deal with unavailable values using conditional compilation in this match
statement, once for each such value.
We discussed a few alternatives privately with @cathay4t about rust-netlink but no conclusion has been reached yet.
Hi @ydirson, I'm not entirely sure I understand the idea here. If I'm understanding the idea correctly, I don't see how preserving the enums but auto-numbering them results in less conditional compilation.
For rust-netlink we started to discuss concrete implementation at https://github.com/rust-netlink/netlink-packet-route/pull/56#issuecomment-1792136634, and there is concrete AddressFamily
implementation now in that PR.
Maybe this part could even be shared between the two projects?