From nobody Thu Jan 19 14:02:11 2023 X-Original-To: dev-commits-src-all@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 4NyPVC4h94z2t1Vl for ; Thu, 19 Jan 2023 14:03:15 +0000 (UTC) (envelope-from dbaio@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NyPVC4B1yz3MXQ; Thu, 19 Jan 2023 14:03:15 +0000 (UTC) (envelope-from dbaio@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674136995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HeQojazkEGRUftISaC1Md1zLMHhqFivgdLb9iyc9Adg=; b=mm6xflHtgqlOKJkFmENu7bat8haP85h1hmAz8umCRVl6JTpLGcWyvUnkFVBT/nig+JAt/g kP+l2VTTyDAnHvF/wDYtPAnCOWcSnl2jzSmZx/rGzKRIOd43MF3oCzbG3qif6oq0T7Geyk g40qCAlwKSb6INMElstxu16Sd0e/qELpgYabm6wQkPE6zLbyWAvopprmAh0L8q0xSJ9yN6 qu/Mt5IfEP3Mlfx9I3RxnypE1FmG8ZKjuNZJ9RQ7D5YxkRF1zR72Kk55BjpF7swVp+n0rg vGAhtnHrT7SVI5l+PJyOyx1DDr93D42Cj960T8SYcEF1rCIltmoynMjTKFJV0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674136995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HeQojazkEGRUftISaC1Md1zLMHhqFivgdLb9iyc9Adg=; b=cgu5k78zqoMKBFUOIbRY9IMYQQv+3xtW4/UJFBxksFHDY0j8QyWU5NOH+CV9VfWWPOQUh2 POcyYbGdBOsr+lXs30YNpJ//wptYBA0xpCXLTM98jbenIiQ7lbfC++bTURNDIedu7bCiVt kMyo3eqV8zjOfjY33DrJBCvGLf8gwI6jAo7DAI8Ayg7l7KN6RoNILSAsWF4xSUVqDzu89o katF2xHCwp/k7IxLez/lDexkQqYgtmLFl8Qqv4Di0h+2nzNFqPJW9hxvthEU37LbKI1MtX x9ZnWA0UJLKMvWAzAbKqM2eKBkAMC0qInhLy/5JN5wD9IsyotvYjnwTl6Y2vuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674136995; a=rsa-sha256; cv=none; b=QlE+TXGE1UlBJd2SdYdojipTo7RRsFWezaEwErDg1KNP6YM2r5M9naoF3k0PrVmKh79nnW dYKOURgmQT5Yksjb+IZIyGnDNeMXWwf80PaPgwVq6WB2sktiolKYozZACegzTp2ksov7Q5 oy1omI/IisZcYQU1ETVXEtFfKZ/4Gnzo+nC0Am5lJy3j8Z5hkyvV7N4yQ8xnL4CRPtPIuo HMF+EaIkXnKRzUFMZHe1knHcN5UQ1EURiB+x5naHetp91uW+FXP6hX+a4cpIM1qaWhdRAz KgtJCM1TQkXpMyuhpcGTKgtiFlBGrnVXqj/oMbKZZCse3PUexpR9c4JvJxIlNg== Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (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 did not present a certificate) (Authenticated sender: dbaio/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4NyPVC39Rrzkd6; Thu, 19 Jan 2023 14:03:15 +0000 (UTC) (envelope-from dbaio@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id F047827C0054; Thu, 19 Jan 2023 09:03:13 -0500 (EST) Received: from imap41 ([10.202.2.91]) by compute3.internal (MEProxy); Thu, 19 Jan 2023 09:03:13 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddutddgiedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvvefutgesth dtredtreertdenucfhrhhomhepfdffrghnihhlohcuifdruceurghiohdfuceouggsrghi oheshfhrvggvuefuffdrohhrgheqnecuggftrfgrthhtvghrnhepffdvvdeufffhleekvd ekkedvkeekieeigeethffgtedtjefgteehueetkeeukeegnecuffhomhgrihhnpehfrhgv vggsshgurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepuggsrghiohdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidquddu kedufeeluddvtddqvdeikedtvdejieekqdgusggrihhopeephfhrvggvuefuffdrohhrgh esfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i9d2946a4:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id ADE61234007B; Thu, 19 Jan 2023 09:03:13 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-85-gd6d859e0cf-fm-20230116.001-gd6d859e0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Message-Id: <2f4e4ccf-b19a-4f8f-a9e0-72298e500d7c@app.fastmail.com> In-Reply-To: <202301091857.309Iv87L068285@gitrepo.freebsd.org> References: <202301091857.309Iv87L068285@gitrepo.freebsd.org> Date: Thu, 19 Jan 2023 11:02:11 -0300 From: "Danilo G. Baio" To: asomers@FreeBSD.org Cc: dev-commits-src-all@freebsd.org Subject: Re: git: 2c24ad3377a6 - main - ifconfig: abort if loading a module fails other than for ENOENT Content-Type: text/plain X-ThisMailContainsUnwantedMimeParts: N On Mon, Jan 9, 2023, at 15:57, Alan Somers wrote: > The branch main has been updated by asomers: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=2c24ad3377a6f584e484656db8390e4eb7cfc119 > > commit 2c24ad3377a6f584e484656db8390e4eb7cfc119 > Author: Alan Somers > AuthorDate: 2022-12-26 02:06:21 +0000 > Commit: Alan Somers > CommitDate: 2023-01-10 02:56:18 +0000 > > ifconfig: abort if loading a module fails other than for ENOENT > > If "ifconfig create" tries to load a kernel module, and the module > exists but can't be loaded, fail the command with a useful error > message. This is helpful, for example, when trying to create a cloned > interface in a vnet jail. But ignore ENOENT, because sometimes ifconfig > can't correctly guess the name of the required kernel module. > > MFC after: 2 weeks > Reviewed by: jhb > Differential Revision: https://reviews.freebsd.org/D37873 > --- > sbin/ifconfig/ifconfig.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c > index 462d543125c4..120207a6927e 100644 > --- a/sbin/ifconfig/ifconfig.c > +++ b/sbin/ifconfig/ifconfig.c > @@ -1719,11 +1719,19 @@ ifmaybeload(const char *name) > } > } > > - /* > - * Try to load the module. But ignore failures, because ifconfig can't > - * infer the names of all drivers (eg mlx4en(4)). > - */ > - (void) kldload(ifkind); > + /* Try to load the module. */ > + if (kldload(ifkind) < 0) { > + switch (errno) { > + case ENOENT: > + /* > + * Ignore ENOENT, because ifconfig can't infer the > + * names of all drivers (eg mlx4en(4)). > + */ > + break; > + default: > + err(1, "kldload(%s)", ifkind); > + } > + } > } > > static struct cmd basic_cmds[] = { Hi. I have a jail with vnet where the interface is renamed that stopped working after this. from inside the jail: root@test:/ # ifconfig lo0: flags=8049 metric 0 mtu 16384 options=680003 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x10 inet 127.0.0.1 netmask 0xff000000 groups: lo nd6 options=21 vnet0b_test: flags=8862 metric 0 mtu 1500 options=8 ether 02:27:72:a7:28:0b groups: epair media: Ethernet 10Gbase-T (10Gbase-T ) status: active nd6 options=29 root@test:/ # ifconfig vnet0b_test ifconfig: kldload(if_vnet): Operation not permitted If I don't rename the interface, that works. jail.conf: test { vnet; $index = "0"; vnet.interface = "vnet${index}b_${name}"; exec.prestart += "ifconfig epair${index} create"; exec.prestart += "ifconfig ${bridge} addm epair${index}a"; exec.prestart += "ifconfig epair${index}a up name vnet${index}a_${name}"; exec.prestart += "ifconfig epair${index}b up name vnet${index}b_${name}"; exec.poststop += "ifconfig ${bridge} deletem vnet${index}a_${name}"; exec.poststop += "ifconfig vnet${index}a_${name} destroy"; devfs_ruleset = "11"; # add path 'bpf*' unhide (devfs.rules) } That's a bit odd, I know, could be using description instead. Just reporting. Regards. -- Danilo G. Baio