From nobody Thu Oct 10 10:03:24 2024 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 4XPQLj0v7tz5YmRB; Thu, 10 Oct 2024 10:03:25 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XPQLh5VsMz4snt; Thu, 10 Oct 2024 10:03:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728554604; 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=EuGn/rq0CE+ifq9LRBCm0kTsCsRG1RoUHvGlTU8cyVc=; b=sdX60hfn3jGDPuCdPJAkORimXCMSTzs42zWYNVr1E5mJH1ey48a5wzr9Un0bDOY/si+Spx JQLFtZlOlYC+Y6nqtAXVQMebSDcC6G+WQFGfMPbGPV8P5nnYptcVkGfoLRrdZGxGwuFfWH BO3vUYecjotxl/0Ornd8kDYwemR4ejTGHTlCiNbEUiTrqiYjOH78DR6QpQ39mZt25flQAN RAJAt3RssVVmNboBijg608Djlv/bTS+TeIkfrNX2xYsSXVyHE9Y9z8eVp5C1ASBEKrf/KF 9vgWReBhyqMKA/tDK7mKNkaZlk4qvOCtRQ5aIqep1kMXp8dEL/9v/1nvkf0x0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728554604; 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=EuGn/rq0CE+ifq9LRBCm0kTsCsRG1RoUHvGlTU8cyVc=; b=qISh5P3eCeoINzjxydcOQR8i3Ken5TJdvgpfeQrqyT1QYfsjlekTJZuwCdpakg61aIiszJ ARkTzn68PVUeUqOxDnnvYHR65OlEzzWPAIuUxLaQc59ULHiyleLH1N5TfhGr9aTeuoEqar Pb/S6x2xw5m5ozvYPz332Q50C5rYmzI4eRyO7GFNaWvcd37zoUwsX5RZdlUf0FYq38Z9rR aSFly5xir6DH0ql2g1wOSus4J1CsHwoHlGWc2MB0YCe0v5D7pLm5Sy5Zp7DnYzQtV/j86K M7Wf1I5lvTMP6x4a+0LASxMyVDfjSQI2U9eELSM5//UV8KsXIWvXBGC07mKxhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728554604; a=rsa-sha256; cv=none; b=hHWL3hgVa/1Lwn24BGUTA+NnpIIaLSiXppZRVjnuU6ZGlD9JAGp7z5Lb4AypHFHAC4p95o ABG+iBaQuv/U5sj6QIlKgMAN8oYgn+E7v3c08FF7JAmPFTSHevy0g3SO+7NWkDDPG/RvD7 0QctlcyKknHoznwX03Xm+Pf48YLb1rnnG+/GYC2wcrwmsIyPJugag5QdBeG6BwXpTOKa79 vttyOBQu9H84CJmiX3jikC1XIj9ezh98LctK6roM0qZdXXY/HfsPclaVWpEJCxAIaYEtAn 0XNYYlZJqwmLxd4Mj0COkYQ3mdRa+dBchjxMoKcqXR5mD30Q9BowEpIJMU+t8Q== 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 4XPQLh56Wczt26; Thu, 10 Oct 2024 10:03:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49AA3Ol2052759; Thu, 10 Oct 2024 10:03:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49AA3ObH052756; Thu, 10 Oct 2024 10:03:24 GMT (envelope-from git) Date: Thu, 10 Oct 2024 10:03:24 GMT Message-Id: <202410101003.49AA3ObH052756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: ea980c17f48e - stable/13 - if_clone: correctly destroy a clone from a different vnet 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ea980c17f48e9307504d7567d8f2b37dc3181588 Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=ea980c17f48e9307504d7567d8f2b37dc3181588 commit ea980c17f48e9307504d7567d8f2b37dc3181588 Author: Gleb Smirnoff AuthorDate: 2022-01-25 05:07:16 +0000 Commit: Zhenlei Huang CommitDate: 2024-10-10 10:00:48 +0000 if_clone: correctly destroy a clone from a different vnet Try to live with cruel reality fact - if_vmove doesn't move an interface from previous vnet cloning infrastructure to the new one. Let's admit this as design feature and make it work better. * Delete two blocks of code that would fallback to vnet0, if a cloner isn't found. They didn't do any good job and also whole idea of treating vnet0 as special one is wrong. * When deleting a cloned interface, lookup its cloner using it's home vnet. With this change simple sequence works correctly: ifconfig foo0 create jail -c name=jj persist vnet vnet.interface=foo0 jexec jj ifconfig foo0 destroy Differential revision: https://reviews.freebsd.org/D33942 (cherry picked from commit 6d1808f051a5f8e3b546442b9bcab3d03f04ef8a) --- sys/net/if_clone.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c index 803d9b1f307a..98d2f4564db8 100644 --- a/sys/net/if_clone.c +++ b/sys/net/if_clone.c @@ -197,15 +197,6 @@ ifc_create_ifp(const char *name, struct ifc_data *ifd, LIST_FOREACH(ifc, &V_if_cloners, ifc_list) if (ifc->ifc_match(ifc, name)) break; -#ifdef VIMAGE - if (ifc == NULL && !IS_DEFAULT_VNET(curvnet)) { - CURVNET_SET_QUIET(vnet0); - LIST_FOREACH(ifc, &V_if_cloners, ifc_list) - if (ifc->ifc_match(ifc, name)) - break; - CURVNET_RESTORE(); - } -#endif IF_CLONERS_UNLOCK(); if (ifc == NULL) @@ -289,22 +280,15 @@ if_clone_destroy(const char *name) return (ENXIO); /* Find the cloner for this interface */ + CURVNET_SET_QUIET(ifp->if_home_vnet); IF_CLONERS_LOCK(); LIST_FOREACH(ifc, &V_if_cloners, ifc_list) { if (strcmp(ifc->ifc_name, ifp->if_dname) == 0) { break; } } -#ifdef VIMAGE - if (ifc == NULL && !IS_DEFAULT_VNET(curvnet)) { - CURVNET_SET_QUIET(vnet0); - LIST_FOREACH(ifc, &V_if_cloners, ifc_list) - if (ifc->ifc_match(ifc, name)) - break; - CURVNET_RESTORE(); - } -#endif IF_CLONERS_UNLOCK(); + CURVNET_RESTORE(); if (ifc == NULL) { if_rele(ifp); return (EINVAL);