From nobody Sun Nov 19 16:30:25 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 4SYGMm32kjz5119P for ; Sun, 19 Nov 2023 16:30:28 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail2.karels.net (mail2.karels.net [3.19.118.201]) (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 (2048 bits) client-digest SHA256) (Client CN "freebsd", Issuer "freebsd" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SYGMl5yfSz4F7q; Sun, 19 Nov 2023 16:30:27 +0000 (UTC) (envelope-from mike@karels.net) Authentication-Results: mx1.freebsd.org; none Received: from mail2.karels.net (localhost [IPv6:0:0:0:0:0:0:0:1]) by mail2.karels.net (8.17.1/8.17.1) with ESMTP id 3AJGUQo8065063; Sun, 19 Nov 2023 10:30:27 -0600 (CST) (envelope-from mike@karels.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=karels.net; s=mail2; t=1700411427; bh=YQp2BSXjbDU957Qn2ls1N1EUSGu0Yv/LKkOj3VctHa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JC6uQQXOfUC8yjlpCHVx8P8wUgTMuXNrZh7LEOnf1+MrptpicMmO0zjBiOxBCTqpR b73htvqom3mlyXwCUvbsFX1e41Jsu62/rGtUaG8A0nSDBT1HZaM3zIQUdY+wW20jho EVi0dMQyFAE9/iCtzBe9540OK7V9cOxvRNmFjBFcCVhdj2KgPXXJ5NE+8xhWkRY4Gs gBhR1thB1DW8XwuHSE1Blkj03gVNrc/IhtEhzr8caHc2Bdq/OjvfmPDXz9wgAr0yn2 S2yzzumSMpceiyYOwTS9kS54IApQGQSMsnRsJvJUO1OjPNaWcFDPxZEE7rf1Cwej+x UfWTu8wZrC4Gw== Received: from [10.0.2.130] ([73.62.165.147]) by mail2.karels.net with ESMTPSA id WRcRMCI4WmUl/gAAs/W3XQ (envelope-from ); Sun, 19 Nov 2023 10:30:26 -0600 From: Mike Karels To: =?utf-8?q?Mina_Gali=C4=87?= Cc: Kyle Evans , freebsd-net@freebsd.org Subject: Re: How to tell if a network interface was renamed (and from what) Date: Sun, 19 Nov 2023 10:30:25 -0600 X-Mailer: MailMate (1.14r5964) Message-ID: <99D24919-A5DF-4A8B-882F-9D724AAD494F@karels.net> In-Reply-To: References: <9eef5488-e8da-4edd-bc00-baeb5aaf4a23@FreeBSD.org> 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-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16509, ipnet:3.16.0.0/14, country:US] X-Rspamd-Queue-Id: 4SYGMl5yfSz4F7q On 19 Nov 2023, at 8:34, Mina Gali=C4=87 wrote: >>> FreeBSD currently does not preserve the old ( original ) name of >>> interfaces if it is renamed ( either physical or cloned ones ). >>> While there's an attempt https://reviews.freebsd.org/D28247 >>> to get the device name (physical >>> ones) but it is not perfect and not completed. >>> >>> So may I ask why you need to know if a network interface was renamed = ? >> >> >> Just last week I found this quite a pain as well; once an interface ha= s >> been renamed, if it's not a pseudo-interface with an obvious group >> there's no clear way, AFAICT, to determine which driver created it > > I think the main reason that we need to know if and from what an interf= ace has been renamed is if we need to know what driver we're working with= =2E > > But given that a rename doesn't change =E2=80=94 or even just *alias* > the sysctl dev hierarchy, where a %driver is recorded, we can't > track it back. > > (but again, that's just for physical devices, then again virtual device= s record what type of device they are in their group which > is essentially the same thing) > > As soon as we have more than one interface with different drivers > it's impossible to parse out what we're dealing with without > parsing rc.conf, logs, or worse things I can't think of right now. The kernel has a driver name for each interface, which looks like it doesn't change currently in most cases. There is a kernel accessor function, but I don't think it is exported to user space now. It could be, though. Would this be sufficient for your purposes? There is also a unit number, which could also be exported. Mike