From nobody Tue Jan 25 05:09:41 2022 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 569571980DAE; Tue, 25 Jan 2022 05:09:42 +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 4JjZfG05v6z3NrB; Tue, 25 Jan 2022 05:09:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643087382; 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=18ENtPLyOxHrQ/QZwwRyN44HEGWKugL9nrlwBXRkIyQ=; b=L2sZ69wjX69vrjvxJW4QQvCR2XJc2bpBnL1OSwoZg+U8+7vTUD8fL5XVd4z+NY6opewLRk VRjelVFG3vqkk5jo8zSi4GZEPnmT8kGCB4NHBjgR4NXgN/v5fkr3YnifirEg8XqrcICOlg kE8AIzRYzPZARKJv9DaM8emc9TxBm5D+SpFwfEjH5OnzPntpKBOxeoIB/Dm3GrLaBv78Ac 0BBfdaQ3WVhcUQv74XtPiF/YdxYLKd2LYUMzVdT6UUCpgGYe+LaWvB8EjSZuCRmuV2Rveh vgg+NfJH3u/a+cFU1pXOwcM8Kij7vweJwA9zxxVzhMTCQMaUCWD9+YYqZB6XJA== 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 C26E6239A2; Tue, 25 Jan 2022 05:09:41 +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 20P59fqT024369; Tue, 25 Jan 2022 05:09:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20P59fus024368; Tue, 25 Jan 2022 05:09:41 GMT (envelope-from git) Date: Tue, 25 Jan 2022 05:09:41 GMT Message-Id: <202201250509.20P59fus024368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 6d1808f051a5 - main - 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: 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d1808f051a5f8e3b546442b9bcab3d03f04ef8a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643087382; 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=18ENtPLyOxHrQ/QZwwRyN44HEGWKugL9nrlwBXRkIyQ=; b=Q3gJYdN5Ytvsqvn3vL1/x5gQydPdQTsFtYeDqfID1EfO6o7NjJ1zwX3Nvgh8QPGz2ZAm/d CY80ltsnn8C0Os0RjiNAy+k8vZN73OfAeg9gE0z3lF5rVKbCADaFxiZbhsGRKRIYCIdukK N3rFi+colNGbNNqAtW7/e29gHZfrMiVwQKzIx0lcyyVCQ0xYYrzg83z2Xt5lag138y1vxN b/c0kVLs318npdukt2uRB041YU6qhjsLJqnxN6MZGHshisonI3zfYbpx4AYD9CA0+Zu5SP ZWp3UJuCzNAw363x5mYj5XPoUjwMtZSlNUJZMgXfrEspab0e2Ocg3ul4HZOQzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643087382; a=rsa-sha256; cv=none; b=V8kymEAuA8/zBYUbjIOjXSOLrdvJS0m/dbeBAyuGpvYyyzxix/lcO8guIwCS9O2T5xsVfT 6Q7QS0TeL02Q59Ef53RYflUxlZcGiE8mEWa0MXJxUGXxngl+Dmc6aqCJSNo8CX36RpqV9m xyFrSe103b5MnUzfYtuffeU+CvbThlgQ6iMRml6dsnSyT/CvR1IKGKr5VslFme9fYLOeBZ xzG38HJBN0b8HKsDlO8Y0UPFVS+fvmLJ4vo6/jmRCFZIaeIn2wzrVizVOrV2LfEEf/Sn/P XMOP1hQRpYdSMuo/sSzRIxnA4ZYmJLKmvH46yCbBVsW8CzC0gL5jCTdSngA2gg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6d1808f051a5f8e3b546442b9bcab3d03f04ef8a commit 6d1808f051a5f8e3b546442b9bcab3d03f04ef8a Author: Gleb Smirnoff AuthorDate: 2022-01-25 05:07:16 +0000 Commit: Gleb Smirnoff CommitDate: 2022-01-25 05:07:16 +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 --- sys/net/if_clone.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c index 7660c91bd2e1..272a98f285d5 100644 --- a/sys/net/if_clone.c +++ b/sys/net/if_clone.c @@ -189,20 +189,6 @@ if_clone_create(char *name, size_t len, caddr_t params) 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_type == SIMPLE) { - if (ifc_simple_match(ifc, name)) - break; - } else { - if (ifc->ifc_match(ifc, name)) - break; - } - CURVNET_RESTORE(); - } -#endif IF_CLONERS_UNLOCK(); if (ifc == NULL) @@ -266,27 +252,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_type == SIMPLE) { - if (ifc_simple_match(ifc, name)) - break; - } else { - if (ifc->ifc_match(ifc, name)) - break; - } - CURVNET_RESTORE(); - } -#endif IF_CLONERS_UNLOCK(); + CURVNET_RESTORE(); if (ifc == NULL) { if_rele(ifp); return (EINVAL);