Signed-off-by: Eric Garver <eric(a)garver.life>
---
src/libvirt_private.syms | 1 +
src/util/virfirewalld.c | 24 ++++++++++++++++++++++++
src/util/virfirewalld.h | 2 ++
3 files changed, 27 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 97ff2a43e48a..c5882c535210 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2366,6 +2366,7 @@ virFirewallDGetZones;
virFirewallDInterfaceSetZone;
virFirewallDIsRegistered;
virFirewallDPolicyExists;
+virFirewallDSourceSetZone;
virFirewallDSynchronize;
virFirewallDZoneExists;
diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c
index d11e974cc2d5..07f9cdd1e485 100644
--- a/src/util/virfirewalld.c
+++ b/src/util/virfirewalld.c
@@ -451,6 +451,30 @@ virFirewallDInterfaceSetZone(const char *iface,
}
+int
+virFirewallDSourceSetZone(const char *source,
+ const char *zone)
+{
+ GDBusConnection *sysbus = virGDBusGetSystemBus();
+ g_autoptr(GVariant) message = NULL;
+
+ if (!sysbus)
+ return -1;
+
+ message = g_variant_new("(ss)", zone, source);
+
+ return virGDBusCallMethod(sysbus,
+ NULL,
+ NULL,
+ NULL,
+ VIR_FIREWALL_FIREWALLD_SERVICE,
+ "/org/fedoraproject/FirewallD1",
+ "org.fedoraproject.FirewallD1.zone",
+ "changeZoneOfSource",
+ message);
+}
+
+
void
virFirewallDSynchronize(void)
{
diff --git a/src/util/virfirewalld.h b/src/util/virfirewalld.h
index fa4c9e702ccb..11aad7786dfb 100644
--- a/src/util/virfirewalld.h
+++ b/src/util/virfirewalld.h
@@ -43,5 +43,7 @@ int virFirewallDApplyRule(virFirewallLayer layer,
int virFirewallDInterfaceSetZone(const char *iface,
const char *zone);
+int virFirewallDSourceSetZone(const char *source,
+ const char *zone);
void virFirewallDSynchronize(void);
--
2.37.3