From nobody Mon Feb 9 03:29:55 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1714025103243901.0620622796645; Wed, 24 Apr 2024 23:05:03 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 332391AA7; Thu, 25 Apr 2024 02:05:02 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9C9872311; Thu, 25 Apr 2024 01:40:12 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 477CC2241; Thu, 25 Apr 2024 01:38:48 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E2778219A for ; Thu, 25 Apr 2024 01:38:39 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-198-xJaoL4CPMqKIEfmoKb36ow-1; Thu, 25 Apr 2024 01:38:37 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B8D13826104 for ; Thu, 25 Apr 2024 05:38:37 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.32.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7632E492BC6 for ; Thu, 25 Apr 2024 05:38:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: xJaoL4CPMqKIEfmoKb36ow-1 From: Laine Stump To: devel@lists.libvirt.org Subject: [PATCH v3 22/27] network: save network status when firewall rules are reloaded Date: Thu, 25 Apr 2024 01:38:28 -0400 Message-ID: <20240425053833.1066517-23-laine@redhat.com> In-Reply-To: <20240425053833.1066517-1-laine@redhat.com> References: <20240425053833.1066517-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: LM5WKUT4AWTA7J3INIW2UNUW42DJ2TD4 X-Message-ID-Hash: LM5WKUT4AWTA7J3INIW2UNUW42DJ2TD4 X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1714025104181100001 In the case that a new version of libvirt is started that uses different rules to build the network firewall, we need to re-save the status so that when the network is destroyed (or the *next* time libvirt is restarted and wants to remove/re-add the firewall), it will have the proper information to perform the firewall removal. Signed-off-by: Laine Stump --- src/conf/virnetworkobj.c | 1 + src/network/bridge_driver.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index fef4c69004..228d0a6585 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -840,6 +840,7 @@ virNetworkObjSaveStatus(const char *statusDir, int flags =3D 0; g_autofree char *xml =3D NULL; =20 + VIR_DEBUG("Writing network status to disk"); if (!(xml =3D virNetworkObjFormat(obj, xmlopt, flags))) return -1; =20 diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index c54a595d4d..c1dddd0550 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1685,6 +1685,7 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj, g_autoptr(virNetworkDriverConfig) cfg =3D virNetworkDriverGetConfig(ne= tworkGetDriver()); VIR_LOCK_GUARD lock =3D virObjectLockGuard(obj); virNetworkDef *def =3D virNetworkObjGetDef(obj); + bool saveStatus =3D false; =20 if (virNetworkObjIsActive(obj)) { switch ((virNetworkForwardType) def->forward.type) { @@ -1699,6 +1700,7 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj, networkRemoveFirewallRules(obj); ignore_value(networkAddFirewallRules(def, cfg->firewallBackend, virNetworkObjGetFwRemoval= Ptr(obj))); + saveStatus =3D true; break; =20 case VIR_NETWORK_FORWARD_OPEN: @@ -1716,6 +1718,11 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj, } } =20 + if (saveStatus) { + ignore_value(virNetworkObjSaveStatus(cfg->stateDir, obj, + network_driver->xmlopt)); + } + return 0; } =20 @@ -2362,7 +2369,6 @@ networkStartNetwork(virNetworkDriverState *driver, /* Persist the live configuration now that anything autogenerated * is setup. */ - VIR_DEBUG("Writing network status to disk"); if (virNetworkObjSaveStatus(cfg->stateDir, obj, network_driver->xmlopt) < 0) goto cleanup; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org