From nobody Mon Jan 09 18:57:08 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 4NrNTw2tHCz2pHLn; Mon, 9 Jan 2023 18:57:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NrNTw2LDYz4NB5; Mon, 9 Jan 2023 18:57:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673290628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nQhUIjWCoZs2Pf4ta25X30RVP4ZbZDSHrh83QMBGDNg=; b=hPU7BNvwu1FGIgGmg797MfLZb8owUOmGPCRtAqvoKQAThtZelfAMGSCvgwE1TP9Q78ILDP sYgT82kpF/DR7bUnYyKqoZh5gxkewwAALGI3BFAgfMejdLPr3183wvc9QPSmiF/axdRkUk +KFV3KvNgJJBfTc8rxN5ZHVQZI59x0jSw+iXGtNSIx8MuzxZVn4LRMk0itPfp6l16Nircr zFLP7Jv0w/w5uokQiXv/PV4rKBdzdDL6lgHKx6q5zWUqPJNXi6z/QKyEHWTZTDOzLB4jYv hSTORv/RLVk3aLlEB++tQyz1BfrGXOMCqgeUk0B0eUEsP3p/kX/ph74Cb6oegg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673290628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nQhUIjWCoZs2Pf4ta25X30RVP4ZbZDSHrh83QMBGDNg=; b=pQD4vxR40EK8Lc+AEt4oPMBxW85kL0XVF1lEH0ISf+B4JQoolDr/MV4ik7v0nGGPxIsLK6 hKgJxHGfuyTLITSV3R7ekwNZhPep1vdaMuHgsYRhuxVVBeyAS6cYSpQqlkXHFz6zx7vQ6J Ycf6sMLkxWzQXYd2YslvvN/tbDDD175vOKUdKDRqWW4gUfCbj2teDfMZFMWQOPFS9XYebL CNf7XbBpm4lmZj6ET5VdDKHpBJtP2qs70ZBNT2eWbRiTTTJo3RaKtYxeTYPN7uqA72G8ua BqqUZhG7+uHgWlh8QmMrdWHZv8WqZwAhGJIUEP42lr2L9QbvonsXU7TT0HdOUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673290628; a=rsa-sha256; cv=none; b=eqwf7uQ4L7IfzbhTdI0TN7LQf3q2xvT1r2aPpqDkSyc3GktwQbLX4HsrfN/3bwg5EmHKSX 9siug5kR9dy5zdUjeMRC6gldX4JE6h36Y8soiNv8J0fWsTm3DYRHbIDZdQwe6H+CUOp1MC FghPnL3ypmos5AjBaLwlw/Z7G6I4a5AUN9PWi2VVWXomHKVwZy3JZsf+kEi0mEOLyKJMIc xModO8Aq6JOvNbJE24BrHduCjT7Iaki9Q+vUonM8/DxG4YKLeOycTssz/gnLUzXjHUPExe yqkVrmrpyda0U9epFpRymxx8/sahRdy1NyHnzmk8PvcI+WFHYBnqjExd/O8gkw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NrNTw1MpbzfTx; Mon, 9 Jan 2023 18:57:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 309Iv8fL068286; Mon, 9 Jan 2023 18:57:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 309Iv87L068285; Mon, 9 Jan 2023 18:57:08 GMT (envelope-from git) Date: Mon, 9 Jan 2023 18:57:08 GMT Message-Id: <202301091857.309Iv87L068285@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 2c24ad3377a6 - main - ifconfig: abort if loading a module fails other than for ENOENT 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c24ad3377a6f584e484656db8390e4eb7cfc119 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N 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[] = {