Date: Tue, 18 Apr 2023 00:19:23 +0000 From: =?utf-8?Q?Mina_Gali=C4=87?= <freebsd@igalic.co> To: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, "freebsd-infiniband@FreeBSD.org" <freebsd-infiniband@FreeBSD.org> Subject: Ifconfig limitations Message-ID: <IVmRoS9TeDkyGukaM0qZFV5cJHYqgRVSK9j6QcGojTxcZO5PIXxaXLWyoMNCyfwsjJDMtGJpRy0wQlbZFHej-eOh8zg_HFPI6urBrV8FB9I=@igalic.co>
next in thread | raw e-mail | index | archive | help
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-f143a014d8daaa= 1671a7feef90cc2b3f5c5759e234e5cd3382e438dde3703fd3 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/freeb= sd-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=C4=87 Don't Try *my* PkgBase Repository: https://alpha.pkgbase.live/ =E2=80=94 un= til i have a new hardware sponsor=E2=80=A6
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?IVmRoS9TeDkyGukaM0qZFV5cJHYqgRVSK9j6QcGojTxcZO5PIXxaXLWyoMNCyfwsjJDMtGJpRy0wQlbZFHej-eOh8zg_HFPI6urBrV8FB9I=>