From nobody Fri Dec 19 19:16:02 2025 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 1714500268192271.46423321798613; Tue, 30 Apr 2024 11:04:28 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 01264240F; Tue, 30 Apr 2024 14:04:26 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D2C8D2440; Tue, 30 Apr 2024 13:45:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5FD2F1AE4; Tue, 30 Apr 2024 13:44:31 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 1AF841AA1 for ; Tue, 30 Apr 2024 13:44:25 -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-205-1CC_fEkqPR6gyJYmxCcadQ-1; Tue, 30 Apr 2024 13:44:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 CF9AF3806735 for ; Tue, 30 Apr 2024 17:44:22 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.16.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9816581C8 for ; Tue, 30 Apr 2024 17:44:22 +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: 1CC_fEkqPR6gyJYmxCcadQ-1 From: Laine Stump To: devel@lists.libvirt.org Subject: [PATCH v4 17/30] util: add name attribute to virFirewall Date: Tue, 30 Apr 2024 13:44:06 -0400 Message-ID: <20240430174420.371179-18-laine@redhat.com> In-Reply-To: <20240430174420.371179-1-laine@redhat.com> References: <20240430174420.371179-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: S4KYPTJ3LN5MK6TDVKCDCI42IQ2SVXP2 X-Message-ID-Hash: S4KYPTJ3LN5MK6TDVKCDCI42IQ2SVXP2 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: 1714500268714100001 This will be used to label (via "name=3D'blah'") a firewall when it is formatted to XML and written to the network status. Signed-off-by: Laine Stump --- src/libvirt_private.syms | 2 ++ src/util/virfirewall.c | 20 +++++++++++++++++++- src/util/virfirewall.h | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b3cbe1a833..9e16ae4225 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2416,8 +2416,10 @@ virFirewallCmdGetArgCount; virFirewallCmdToString; virFirewallFree; virFirewallGetBackend; +virFirewallGetName; virFirewallNew; virFirewallRemoveCmd; +virFirewallSetName; virFirewallStartRollback; virFirewallStartTransaction; =20 diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index b9b4140ad6..fe8c09c0ed 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -78,6 +78,7 @@ struct _virFirewallGroup { struct _virFirewall { int err; =20 + char *name; size_t ngroups; virFirewallGroup **groups; size_t currentGroup; @@ -119,6 +120,22 @@ virFirewallGetBackend(virFirewall *firewall) } =20 =20 +const char * +virFirewallGetName(virFirewall *firewall) +{ + return firewall->name; +} + + +void +virFirewallSetName(virFirewall *firewall, + const char *name) +{ + g_free(firewall->name); + firewall->name =3D g_strdup(name); +} + + static void virFirewallCmdFree(virFirewallCmd *fwCmd) { @@ -169,8 +186,9 @@ void virFirewallFree(virFirewall *firewall) =20 for (i =3D 0; i < firewall->ngroups; i++) virFirewallGroupFree(firewall->groups[i]); - g_free(firewall->groups); =20 + g_free(firewall->groups); + g_free(firewall->name); g_free(firewall); } =20 diff --git a/src/util/virfirewall.h b/src/util/virfirewall.h index e6aac365f1..e8ad81056f 100644 --- a/src/util/virfirewall.h +++ b/src/util/virfirewall.h @@ -46,6 +46,8 @@ VIR_ENUM_DECL(virFirewallBackend); virFirewall *virFirewallNew(virFirewallBackend backend); void virFirewallFree(virFirewall *firewall); virFirewallBackend virFirewallGetBackend(virFirewall *firewall); +const char *virFirewallGetName(virFirewall *firewall); +void virFirewallSetName(virFirewall *firewall, const char *name); =20 /** * virFirewallAddCmd: --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org