From nobody Tue Apr 18 00:19:23 2023 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q0l0r52GXz45Q0L; Tue, 18 Apr 2023 00:19:40 +0000 (UTC) (envelope-from freebsd@igalic.co) Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q0l0p19Hdz3NW5; Tue, 18 Apr 2023 00:19:38 +0000 (UTC) (envelope-from freebsd@igalic.co) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=igalic.co header.s=protonmail header.b=v9tjJsCq; spf=pass (mx1.freebsd.org: domain of freebsd@igalic.co designates 185.70.40.136 as permitted sender) smtp.mailfrom=freebsd@igalic.co; dmarc=none Date: Tue, 18 Apr 2023 00:19:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igalic.co; s=protonmail; t=1681777175; x=1682036375; bh=g/uMAdP8k6o4n6HdWq/1LO9FAKsPTIlCOczOMleme5Q=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=v9tjJsCq2YRW4ON7bCDV2q+PxY6As86Vmkj9thrq7qW/YgUEeUmyoRFf+RBuyiS1A SGJfdCWSsIgi0+1jhZNRo/vDoA0umsNwruyxALq9w8OacphoUxYuZjN3iZ9QwCVQBX G6EoOH2TPDmTJLPEvpJdCY10epPnRHnGohyxJ1hr1Z0412OwhZUHTPwP9Ntm88V0MC JU9jLawsKu/R1lsWpY/cgi6Qz/edb5J7cygPBn1XCBZWlHG+O1E0wIB/UKNMLT+gx2 2avsaQwF3gZ/CV8N0VIEsAFgnXSlCG/Nz0kfU7RGdAfkaT3ByHBlBXVReIvCrGvf5i 5riOVLkVifxHg== To: "freebsd-net@freebsd.org" , "freebsd-infiniband@FreeBSD.org" From: =?utf-8?Q?Mina_Gali=C4=87?= Subject: Ifconfig limitations Message-ID: Feedback-ID: 66573723:user:proton List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.21 / 15.00]; R_MIXED_CHARSET(1.25)[subject]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.96)[-0.956]; R_SPF_ALLOW(-0.20)[+ip4:185.70.40.0/24]; R_DKIM_ALLOW(-0.20)[igalic.co:s=protonmail]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; ASN(0.00)[asn:62371, ipnet:185.70.40.0/24, country:CH]; MIME_TRACE(0.00)[0:+]; MLMMJ_DEST(0.00)[freebsd-infiniband@FreeBSD.org,freebsd-net@freebsd.org]; RCPT_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_EQ_ADDR_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[igalic.co:+]; DMARC_NA(0.00)[igalic.co]; RWL_MAILSPIKE_POSSIBLE(0.00)[185.70.40.136:from] X-Rspamd-Queue-Id: 4Q0l0p19Hdz3NW5 X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N 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//*` 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