9c6c51
From da064c59cfc1f35f4638a9e05447c21fea88cb14 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <da064c59cfc1f35f4638a9e05447c21fea88cb14@dist-git>
9c6c51
From: Laine Stump <laine@laine.org>
9c6c51
Date: Fri, 1 Feb 2019 20:29:28 -0500
9c6c51
Subject: [PATCH] util: move all firewalld-specific stuff into its own files
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
In preparation for adding several other firewalld-specific functions,
9c6c51
separate the code that's unique to firewalld from the more-generic
9c6c51
"firewall" file.
9c6c51
9c6c51
Signed-off-by: Laine Stump <laine@laine.org>
9c6c51
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
9c6c51
(cherry picked from commit d8393b56e21708c219acc9bcd24a9c22ead4a3b4)
9c6c51
9c6c51
 Conflicts:
9c6c51
   src/util/virerror.c - ; added to end of MACRO in context upstream.
9c6c51
9c6c51
https://bugzilla.redhat.com/1650320
9c6c51
9c6c51
Signed-off-by: Laine Stump <laine@laine.org>
9c6c51
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9c6c51
---
9c6c51
 include/libvirt/virterror.h |   1 +
9c6c51
 src/libvirt_private.syms    |   5 ++
9c6c51
 src/util/Makefile.inc.am    |   3 +
9c6c51
 src/util/virerror.c         |   3 +-
9c6c51
 src/util/virfirewall.c      |  86 +-------------------
9c6c51
 src/util/virfirewalld.c     | 151 ++++++++++++++++++++++++++++++++++++
9c6c51
 src/util/virfirewalld.h     |  33 ++++++++
9c6c51
 src/util/virfirewalldpriv.h |  30 +++++++
9c6c51
 src/util/virfirewallpriv.h  |   2 -
9c6c51
 tests/virfirewalltest.c     |   2 +
9c6c51
 10 files changed, 231 insertions(+), 85 deletions(-)
9c6c51
 create mode 100644 src/util/virfirewalld.c
9c6c51
 create mode 100644 src/util/virfirewalld.h
9c6c51
 create mode 100644 src/util/virfirewalldpriv.h
9c6c51
9c6c51
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
9c6c51
index 57aadb8d16..30197adc3b 100644
9c6c51
--- a/include/libvirt/virterror.h
9c6c51
+++ b/include/libvirt/virterror.h
9c6c51
@@ -133,6 +133,7 @@ typedef enum {
9c6c51
     VIR_FROM_PERF = 65,         /* Error from perf */
9c6c51
     VIR_FROM_LIBSSH = 66,       /* Error from libssh connection transport */
9c6c51
     VIR_FROM_RESCTRL = 67,      /* Error from resource control */
9c6c51
+    VIR_FROM_FIREWALLD = 68,    /* Error from firewalld */
9c6c51
 
9c6c51
 # ifdef VIR_ENUM_SENTINELS
9c6c51
     VIR_ERR_DOMAIN_LAST
9c6c51
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
9c6c51
index 86846f3b08..57948d8049 100644
9c6c51
--- a/src/libvirt_private.syms
9c6c51
+++ b/src/libvirt_private.syms
9c6c51
@@ -1903,6 +1903,11 @@ virFirewallStartRollback;
9c6c51
 virFirewallStartTransaction;
9c6c51
 
9c6c51
 
9c6c51
+# util/virfirewalld.h
9c6c51
+virFirewallDApplyRule;
9c6c51
+virFirewallDIsRegistered;
9c6c51
+
9c6c51
+
9c6c51
 # util/virfirmware.h
9c6c51
 virFirmwareFreeList;
9c6c51
 virFirmwareParse;
9c6c51
diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
9c6c51
index a22265606c..2cef465208 100644
9c6c51
--- a/src/util/Makefile.inc.am
9c6c51
+++ b/src/util/Makefile.inc.am
9c6c51
@@ -57,6 +57,9 @@ UTIL_SOURCES = \
9c6c51
 	util/virfirewall.c \
9c6c51
 	util/virfirewall.h \
9c6c51
 	util/virfirewallpriv.h \
9c6c51
+	util/virfirewalld.c \
9c6c51
+	util/virfirewalld.h \
9c6c51
+	util/virfirewalldpriv.h \
9c6c51
 	util/virfirmware.c \
9c6c51
 	util/virfirmware.h \
9c6c51
 	util/virgettext.c \
9c6c51
diff --git a/src/util/virerror.c b/src/util/virerror.c
9c6c51
index f198f27957..1d46fcdc82 100644
9c6c51
--- a/src/util/virerror.c
9c6c51
+++ b/src/util/virerror.c
9c6c51
@@ -140,7 +140,8 @@ VIR_ENUM_IMPL(virErrorDomain, VIR_ERR_DOMAIN_LAST,
9c6c51
               "Perf", /* 65 */
9c6c51
               "Libssh transport layer",
9c6c51
               "Resource control",
9c6c51
-    )
9c6c51
+              "FirewallD",
9c6c51
+              );
9c6c51
 
9c6c51
 
9c6c51
 /*
9c6c51
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
9c6c51
index 10c370a2ae..4d084f6cbf 100644
9c6c51
--- a/src/util/virfirewall.c
9c6c51
+++ b/src/util/virfirewall.c
9c6c51
@@ -29,12 +29,12 @@
9c6c51
 
9c6c51
 #include "viralloc.h"
9c6c51
 #include "virfirewallpriv.h"
9c6c51
+#include "virfirewalld.h"
9c6c51
 #include "virerror.h"
9c6c51
 #include "virutil.h"
9c6c51
 #include "virstring.h"
9c6c51
 #include "vircommand.h"
9c6c51
 #include "virlog.h"
9c6c51
-#include "virdbus.h"
9c6c51
 #include "virfile.h"
9c6c51
 #include "virthread.h"
9c6c51
 
9c6c51
@@ -51,11 +51,6 @@ VIR_ENUM_IMPL(virFirewallLayerCommand, VIR_FIREWALL_LAYER_LAST,
9c6c51
               IPTABLES_PATH,
9c6c51
               IP6TABLES_PATH);
9c6c51
 
9c6c51
-VIR_ENUM_DECL(virFirewallLayerFirewallD)
9c6c51
-VIR_ENUM_IMPL(virFirewallLayerFirewallD, VIR_FIREWALL_LAYER_LAST,
9c6c51
-              "eb", "ipv4", "ipv6")
9c6c51
-
9c6c51
-
9c6c51
 struct _virFirewallRule {
9c6c51
     virFirewallLayer layer;
9c6c51
 
9c6c51
@@ -158,7 +153,7 @@ virFirewallValidateBackend(virFirewallBackend backend)
9c6c51
     VIR_DEBUG("Validating backend %d", backend);
9c6c51
     if (backend == VIR_FIREWALL_BACKEND_AUTOMATIC ||
9c6c51
         backend == VIR_FIREWALL_BACKEND_FIREWALLD) {
9c6c51
-        int rv = virDBusIsServiceRegistered(VIR_FIREWALL_FIREWALLD_SERVICE);
9c6c51
+        int rv = virFirewallDIsRegistered();
9c6c51
 
9c6c51
         VIR_DEBUG("Firewalld is registered ? %d", rv);
9c6c51
         if (rv < 0) {
9c6c51
@@ -726,81 +721,8 @@ virFirewallApplyRuleFirewallD(virFirewallRulePtr rule,
9c6c51
                               bool ignoreErrors,
9c6c51
                               char **output)
9c6c51
 {
9c6c51
-    const char *ipv = virFirewallLayerFirewallDTypeToString(rule->layer);
9c6c51
-    DBusConnection *sysbus = virDBusGetSystemBus();
9c6c51
-    DBusMessage *reply = NULL;
9c6c51
-    virError error;
9c6c51
-    int ret = -1;
9c6c51
-
9c6c51
-    if (!sysbus)
9c6c51
-        return -1;
9c6c51
-
9c6c51
-    memset(&error, 0, sizeof(error));
9c6c51
-
9c6c51
-    if (!ipv) {
9c6c51
-        virReportError(VIR_ERR_INTERNAL_ERROR,
9c6c51
-                       _("Unknown firewall layer %d"),
9c6c51
-                       rule->layer);
9c6c51
-        goto cleanup;
9c6c51
-    }
9c6c51
-
9c6c51
-    if (virDBusCallMethod(sysbus,
9c6c51
-                          &reply,
9c6c51
-                          &error,
9c6c51
-                          VIR_FIREWALL_FIREWALLD_SERVICE,
9c6c51
-                          "/org/fedoraproject/FirewallD1",
9c6c51
-                          "org.fedoraproject.FirewallD1.direct",
9c6c51
-                          "passthrough",
9c6c51
-                          "sa&s",
9c6c51
-                          ipv,
9c6c51
-                          (int)rule->argsLen,
9c6c51
-                          rule->args) < 0)
9c6c51
-        goto cleanup;
9c6c51
-
9c6c51
-    if (error.level == VIR_ERR_ERROR) {
9c6c51
-        /*
9c6c51
-         * As of firewalld-0.3.9.3-1.fc20.noarch the name and
9c6c51
-         * message fields in the error look like
9c6c51
-         *
9c6c51
-         *    name="org.freedesktop.DBus.Python.dbus.exceptions.DBusException"
9c6c51
-         * message="COMMAND_FAILED: '/sbin/iptables --table filter --delete
9c6c51
-         *          INPUT --in-interface virbr0 --protocol udp --destination-port 53
9c6c51
-         *          --jump ACCEPT' failed: iptables: Bad rule (does a matching rule
9c6c51
-         *          exist in that chain?)."
9c6c51
-         *
9c6c51
-         * We'd like to only ignore DBus errors precisely related to the failure
9c6c51
-         * of iptables/ebtables commands. A well designed DBus interface would
9c6c51
-         * return specific named exceptions not the top level generic python dbus
9c6c51
-         * exception name. With this current scheme our only option is todo a
9c6c51
-         * sub-string match for 'COMMAND_FAILED' on the message. eg like
9c6c51
-         *
9c6c51
-         * if (ignoreErrors &&
9c6c51
-         *     STREQ(error.name,
9c6c51
-         *           "org.freedesktop.DBus.Python.dbus.exceptions.DBusException") &&
9c6c51
-         *     STRPREFIX(error.message, "COMMAND_FAILED"))
9c6c51
-         *    ...
9c6c51
-         *
9c6c51
-         * But this risks our error detecting code being broken if firewalld changes
9c6c51
-         * ever alter the message string, so we're avoiding doing that.
9c6c51
-         */
9c6c51
-        if (ignoreErrors) {
9c6c51
-            VIR_DEBUG("Ignoring error '%s': '%s'",
9c6c51
-                      error.str1, error.message);
9c6c51
-        } else {
9c6c51
-            virReportErrorObject(&error);
9c6c51
-            goto cleanup;
9c6c51
-        }
9c6c51
-    } else {
9c6c51
-        if (virDBusMessageRead(reply, "s", output) < 0)
9c6c51
-            goto cleanup;
9c6c51
-    }
9c6c51
-
9c6c51
-    ret = 0;
9c6c51
-
9c6c51
- cleanup:
9c6c51
-    virResetError(&error);
9c6c51
-    virDBusMessageUnref(reply);
9c6c51
-    return ret;
9c6c51
+    /* wrapper necessary because virFirewallRule is a private struct */
9c6c51
+    return virFirewallDApplyRule(rule->layer, rule->args, rule->argsLen, ignoreErrors, output);
9c6c51
 }
9c6c51
 
9c6c51
 static int
9c6c51
diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c
9c6c51
new file mode 100644
9c6c51
index 0000000000..f27ec9c124
9c6c51
--- /dev/null
9c6c51
+++ b/src/util/virfirewalld.c
9c6c51
@@ -0,0 +1,151 @@
9c6c51
+/*
9c6c51
+ * virfirewalld.c: support for firewalld (https://firewalld.org)
9c6c51
+ *
9c6c51
+ * Copyright (C) 2019 Red Hat, Inc.
9c6c51
+ *
9c6c51
+ * This library is free software; you can redistribute it and/or
9c6c51
+ * modify it under the terms of the GNU Lesser General Public
9c6c51
+ * License as published by the Free Software Foundation; either
9c6c51
+ * version 2.1 of the License, or (at your option) any later version.
9c6c51
+ *
9c6c51
+ * This library is distributed in the hope that it will be useful,
9c6c51
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9c6c51
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9c6c51
+ * Lesser General Public License for more details.
9c6c51
+ *
9c6c51
+ * You should have received a copy of the GNU Lesser General Public
9c6c51
+ * License along with this library.  If not, see
9c6c51
+ * <http://www.gnu.org/licenses/>.
9c6c51
+ */
9c6c51
+
9c6c51
+#include <config.h>
9c6c51
+
9c6c51
+#include <stdarg.h>
9c6c51
+
9c6c51
+#include "virfirewall.h"
9c6c51
+#include "virfirewalld.h"
9c6c51
+#define LIBVIRT_VIRFIREWALLDPRIV_H_ALLOW
9c6c51
+#include "virfirewalldpriv.h"
9c6c51
+#include "virerror.h"
9c6c51
+#include "virutil.h"
9c6c51
+#include "virlog.h"
9c6c51
+#include "virdbus.h"
9c6c51
+
9c6c51
+#define VIR_FROM_THIS VIR_FROM_FIREWALLD
9c6c51
+
9c6c51
+VIR_LOG_INIT("util.firewalld");
9c6c51
+
9c6c51
+/* used to convert virFirewallLayer enum values to strings
9c6c51
+ * understood by the firewalld.direct "passthrough" method
9c6c51
+ */
9c6c51
+VIR_ENUM_DECL(virFirewallLayerFirewallD);
9c6c51
+VIR_ENUM_IMPL(virFirewallLayerFirewallD, VIR_FIREWALL_LAYER_LAST,
9c6c51
+              "eb",
9c6c51
+              "ipv4",
9c6c51
+              "ipv6",
9c6c51
+              );
9c6c51
+
9c6c51
+
9c6c51
+/**
9c6c51
+ * virFirewallDIsRegistered:
9c6c51
+ *
9c6c51
+ * Returns 0 if service is registered, -1 on fatal error, or -2 if service is not registered
9c6c51
+ */
9c6c51
+int
9c6c51
+virFirewallDIsRegistered(void)
9c6c51
+{
9c6c51
+    return virDBusIsServiceRegistered(VIR_FIREWALL_FIREWALLD_SERVICE);
9c6c51
+}
9c6c51
+
9c6c51
+
9c6c51
+/**
9c6c51
+ * virFirewallDApplyRule:
9c6c51
+ * @layer:        which layer to apply the rule to
9c6c51
+ * @args:         list of args to send to this layer's passthrough command.
9c6c51
+ * @argsLen:      number of items in @args
9c6c51
+ * @ignoreErrors: true to suppress logging of errors and return success
9c6c51
+ *                false to log errors and return actual status
9c6c51
+ * @output:       output of the direct passthrough command, if it was successful
9c6c51
+ */
9c6c51
+int
9c6c51
+virFirewallDApplyRule(virFirewallLayer layer,
9c6c51
+                      char **args, size_t argsLen,
9c6c51
+                      bool ignoreErrors,
9c6c51
+                      char **output)
9c6c51
+{
9c6c51
+    const char *ipv = virFirewallLayerFirewallDTypeToString(layer);
9c6c51
+    DBusConnection *sysbus = virDBusGetSystemBus();
9c6c51
+    DBusMessage *reply = NULL;
9c6c51
+    virError error;
9c6c51
+    int ret = -1;
9c6c51
+
9c6c51
+    if (!sysbus)
9c6c51
+        return -1;
9c6c51
+
9c6c51
+    memset(&error, 0, sizeof(error));
9c6c51
+
9c6c51
+    if (!ipv) {
9c6c51
+        virReportError(VIR_ERR_INTERNAL_ERROR,
9c6c51
+                       _("Unknown firewall layer %d"),
9c6c51
+                       layer);
9c6c51
+        goto cleanup;
9c6c51
+    }
9c6c51
+
9c6c51
+    if (virDBusCallMethod(sysbus,
9c6c51
+                          &reply,
9c6c51
+                          &error,
9c6c51
+                          VIR_FIREWALL_FIREWALLD_SERVICE,
9c6c51
+                          "/org/fedoraproject/FirewallD1",
9c6c51
+                          "org.fedoraproject.FirewallD1.direct",
9c6c51
+                          "passthrough",
9c6c51
+                          "sa&s",
9c6c51
+                          ipv,
9c6c51
+                          (int)argsLen,
9c6c51
+                          args) < 0)
9c6c51
+        goto cleanup;
9c6c51
+
9c6c51
+    if (error.level == VIR_ERR_ERROR) {
9c6c51
+        /*
9c6c51
+         * As of firewalld-0.3.9.3-1.fc20.noarch the name and
9c6c51
+         * message fields in the error look like
9c6c51
+         *
9c6c51
+         *    name="org.freedesktop.DBus.Python.dbus.exceptions.DBusException"
9c6c51
+         * message="COMMAND_FAILED: '/sbin/iptables --table filter --delete
9c6c51
+         *          INPUT --in-interface virbr0 --protocol udp --destination-port 53
9c6c51
+         *          --jump ACCEPT' failed: iptables: Bad rule (does a matching rule
9c6c51
+         *          exist in that chain?)."
9c6c51
+         *
9c6c51
+         * We'd like to only ignore DBus errors precisely related to the failure
9c6c51
+         * of iptables/ebtables commands. A well designed DBus interface would
9c6c51
+         * return specific named exceptions not the top level generic python dbus
9c6c51
+         * exception name. With this current scheme our only option is todo a
9c6c51
+         * sub-string match for 'COMMAND_FAILED' on the message. eg like
9c6c51
+         *
9c6c51
+         * if (ignoreErrors &&
9c6c51
+         *     STREQ(error.name,
9c6c51
+         *           "org.freedesktop.DBus.Python.dbus.exceptions.DBusException") &&
9c6c51
+         *     STRPREFIX(error.message, "COMMAND_FAILED"))
9c6c51
+         *    ...
9c6c51
+         *
9c6c51
+         * But this risks our error detecting code being broken if firewalld changes
9c6c51
+         * ever alter the message string, so we're avoiding doing that.
9c6c51
+         */
9c6c51
+        if (ignoreErrors) {
9c6c51
+            VIR_DEBUG("Ignoring error '%s': '%s'",
9c6c51
+                      error.str1, error.message);
9c6c51
+        } else {
9c6c51
+            virReportErrorObject(&error);
9c6c51
+            goto cleanup;
9c6c51
+        }
9c6c51
+    } else {
9c6c51
+        if (virDBusMessageRead(reply, "s", output) < 0)
9c6c51
+            goto cleanup;
9c6c51
+    }
9c6c51
+
9c6c51
+    ret = 0;
9c6c51
+
9c6c51
+ cleanup:
9c6c51
+    virResetError(&error);
9c6c51
+    virDBusMessageUnref(reply);
9c6c51
+    return ret;
9c6c51
+}
9c6c51
diff --git a/src/util/virfirewalld.h b/src/util/virfirewalld.h
9c6c51
new file mode 100644
9c6c51
index 0000000000..83fe1149cc
9c6c51
--- /dev/null
9c6c51
+++ b/src/util/virfirewalld.h
9c6c51
@@ -0,0 +1,33 @@
9c6c51
+/*
9c6c51
+ * virfirewalld.h: support for firewalld (https://firewalld.org)
9c6c51
+ *
9c6c51
+ * Copyright (C) 2019 Red Hat, Inc.
9c6c51
+ *
9c6c51
+ * This library is free software; you can redistribute it and/or
9c6c51
+ * modify it under the terms of the GNU Lesser General Public
9c6c51
+ * License as published by the Free Software Foundation; either
9c6c51
+ * version 2.1 of the License, or (at your option) any later version.
9c6c51
+ *
9c6c51
+ * This library is distributed in the hope that it will be useful,
9c6c51
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9c6c51
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9c6c51
+ * Lesser General Public License for more details.
9c6c51
+ *
9c6c51
+ * You should have received a copy of the GNU Lesser General Public
9c6c51
+ * License along with this library.  If not, see
9c6c51
+ * <http://www.gnu.org/licenses/>.
9c6c51
+ */
9c6c51
+
9c6c51
+#ifndef LIBVIRT_VIRFIREWALLD_H
9c6c51
+# define LIBVIRT_VIRFIREWALLD_H
9c6c51
+
9c6c51
+# define VIR_FIREWALL_FIREWALLD_SERVICE "org.fedoraproject.FirewallD1"
9c6c51
+
9c6c51
+int virFirewallDIsRegistered(void);
9c6c51
+
9c6c51
+int virFirewallDApplyRule(virFirewallLayer layer,
9c6c51
+                          char **args, size_t argsLen,
9c6c51
+                          bool ignoreErrors,
9c6c51
+                          char **output);
9c6c51
+
9c6c51
+#endif /* LIBVIRT_VIRFIREWALLD_H */
9c6c51
diff --git a/src/util/virfirewalldpriv.h b/src/util/virfirewalldpriv.h
9c6c51
new file mode 100644
9c6c51
index 0000000000..6c03b467c9
9c6c51
--- /dev/null
9c6c51
+++ b/src/util/virfirewalldpriv.h
9c6c51
@@ -0,0 +1,30 @@
9c6c51
+/*
9c6c51
+ * virfirewalldpriv.h: private APIs for firewalld
9c6c51
+ *
9c6c51
+ * Copyright (C) 2019 Red Hat, Inc.
9c6c51
+ *
9c6c51
+ * This library is free software; you can redistribute it and/or
9c6c51
+ * modify it under the terms of the GNU Lesser General Public
9c6c51
+ * License as published by the Free Software Foundation; either
9c6c51
+ * version 2.1 of the License, or (at your option) any later version.
9c6c51
+ *
9c6c51
+ * This library is distributed in the hope that it will be useful,
9c6c51
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9c6c51
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9c6c51
+ * Lesser General Public License for more details.
9c6c51
+ *
9c6c51
+ * You should have received a copy of the GNU Lesser General Public
9c6c51
+ * License along with this library.  If not, see
9c6c51
+ * <http://www.gnu.org/licenses/>.
9c6c51
+ */
9c6c51
+
9c6c51
+#ifndef LIBVIRT_VIRFIREWALLDPRIV_H_ALLOW
9c6c51
+# error "virfirewalldpriv.h may only be included by virfirewalld.c or test suites"
9c6c51
+#endif /* LIBVIRT_VIRFIREWALLDPRIV_H_ALLOW */
9c6c51
+
9c6c51
+#ifndef LIBVIRT_VIRFIREWALLDPRIV_H
9c6c51
+# define LIBVIRT_VIRFIREWALLDPRIV_H
9c6c51
+
9c6c51
+# define VIR_FIREWALL_FIREWALLD_SERVICE "org.fedoraproject.FirewallD1"
9c6c51
+
9c6c51
+#endif /* LIBVIRT_VIRFIREWALLDPRIV_H */
9c6c51
diff --git a/src/util/virfirewallpriv.h b/src/util/virfirewallpriv.h
9c6c51
index 130aaa1b73..bd6089bcc6 100644
9c6c51
--- a/src/util/virfirewallpriv.h
9c6c51
+++ b/src/util/virfirewallpriv.h
9c6c51
@@ -30,8 +30,6 @@
9c6c51
 
9c6c51
 # include "virfirewall.h"
9c6c51
 
9c6c51
-# define VIR_FIREWALL_FIREWALLD_SERVICE "org.fedoraproject.FirewallD1"
9c6c51
-
9c6c51
 typedef enum {
9c6c51
     VIR_FIREWALL_BACKEND_AUTOMATIC,
9c6c51
     VIR_FIREWALL_BACKEND_DIRECT,
9c6c51
diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c
9c6c51
index e6d68745ae..397abfcc60 100644
9c6c51
--- a/tests/virfirewalltest.c
9c6c51
+++ b/tests/virfirewalltest.c
9c6c51
@@ -30,6 +30,8 @@
9c6c51
 # include "virbuffer.h"
9c6c51
 # include "vircommandpriv.h"
9c6c51
 # include "virfirewallpriv.h"
9c6c51
+# define LIBVIRT_VIRFIREWALLDPRIV_H_ALLOW
9c6c51
+# include "virfirewalldpriv.h"
9c6c51
 # include "virmock.h"
9c6c51
 # include "virdbuspriv.h"
9c6c51
 
9c6c51
-- 
9c6c51
2.20.1
9c6c51