This will be used to label (via "name='blah'") a firewall when it is
formatted to XML and written to the network status.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
This is new in V3.
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;
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;
+ char *name;
size_t ngroups;
virFirewallGroup **groups;
size_t currentGroup;
@@ -119,6 +120,22 @@ virFirewallGetBackend(virFirewall *firewall)
}
+const char *
+virFirewallGetName(virFirewall *firewall)
+{
+ return firewall->name;
+}
+
+
+void
+virFirewallSetName(virFirewall *firewall,
+ const char *name)
+{
+ g_free(firewall->name);
+ firewall->name = g_strdup(name);
+}
+
+
static void
virFirewallCmdFree(virFirewallCmd *fwCmd)
{
@@ -169,8 +186,9 @@ void virFirewallFree(virFirewall *firewall)
for (i = 0; i < firewall->ngroups; i++)
virFirewallGroupFree(firewall->groups[i]);
- g_free(firewall->groups);
+ g_free(firewall->groups);
+ g_free(firewall->name);
g_free(firewall);
}
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);
/**
* virFirewallAddCmd:
--
2.44.0