Ifconfig limitations
- Reply: Hans Petter Selasky : "Re: Ifconfig limitations"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Apr 2023 00:19:23 UTC
Hi folks! I've been working on getting better FreeBSD support into cloud-init. My working thesis has been that all I really need to replicate what cloud-init on Linux is doing with ip addr/ip link and its reading of `/sys/class/net/<device>/*` files is BSD's ifconfig(8) This ifconfig parser is the implementation of that thesis: https://github.com/canonical/cloud-init/blob/main/cloudinit/distros/parsers/ifconfig.py However, trying to port cloud-init's Infiniband code seems to have falsified my hypothesis. In some cases, it's easily possible to tell if an interface is an Infiniband interface: For example, it'll start with `ib`, or have a GUID as `lladdr`: https://github.com/canonical/cloud-init/pull/2003/files#diff-f143a014d8daaa1671a7feef90cc2b3f5c5759e234e5cd3382e438dde3703fd3 but in other cases, such as when the device is in Ethernet mode, it's impossible to tell. It means i would have to parse the highly verbose ibstat(8), then map the Infiniband device name to the ifconfig names and only then can I decide if the devices in ifconfig contain infiniband devices, which ones they are, and what state / mode they are in. (if they even show up in ifconfig to begin with! tho this might be a skill / knowledge issue, see: https://lists.freebsd.org/archives/freebsd-infiniband/2023-April/000011.html ) On Linux, cloud-init checks `/sys/net/mce0/type`. If that type is 32, it's infiniband, if it's 1, it's ethernet. We don't seem to have such a thing. Sometimes we have useful groups, but not as many useful groups as OpenBSD does, for instance. So I have determined that on FreeBSD, the absence of groups marks a physical device. But beyond that, there's not much overlap between Infiniband and ifconfig, and that's a real shame. Let's compare that to wlan! the actual wifi devices don't show up in ifconfig, but they can be easily found via `sysctl net.wlan.devices`. Once plumbed in, a wlanX device shows a parent device and belonging to the wlan group. How hard would it be to emulate that behaviour for Infiniband? What tooling do we have right now, that I may have missed? Kind regards, Mina Galić Don't Try *my* PkgBase Repository: https://alpha.pkgbase.live/ — until i have a new hardware sponsor…