render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7548c0
From 2439f55f8a44ae3bddde8098f3f6ea67ccfd1d9b Mon Sep 17 00:00:00 2001
7548c0
Message-Id: <2439f55f8a44ae3bddde8098f3f6ea67ccfd1d9b@dist-git>
7548c0
From: Laine Stump <laine@redhat.com>
7548c0
Date: Fri, 15 Jan 2021 22:51:47 -0500
7548c0
Subject: [PATCH] tests: fix iptables test case commandline options in
7548c0
 virfirewalltest.c
7548c0
7548c0
This test was created with all the commandlines erroneously having
7548c0
"--source-host", which is not a valid iptables option. The correct
7548c0
name for the option is "--source". However, since the test is just
7548c0
checking that the generated commandline matches what we told it to
7548c0
generate (and never actually runs iptables, as that would be a "Really
7548c0
Bad Idea"(tm)), the test has always succeeded. I only found it because
7548c0
I made a change to the code that caused the test to incorrectly try to
7548c0
run iptables during the test, and the error message I received was
7548c0
"odd" (it complained about the bad option, rather than complaining
7548c0
that I had insufficient privilege to run the command).
7548c0
7548c0
https://bugzilla.redhat.com/1607929
7548c0
7548c0
Signed-off-by: Laine Stump <laine@redhat.com>
7548c0
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
7548c0
(cherry picked from commit e9693502fb63ce5ddd07d2599daddc563c422eed)
7548c0
Message-Id: <20210116035151.1066734-5-laine@redhat.com>
7548c0
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7548c0
---
7548c0
 tests/virfirewalltest.c | 168 ++++++++++++++++++++--------------------
7548c0
 1 file changed, 84 insertions(+), 84 deletions(-)
7548c0
7548c0
diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c
7548c0
index 1ec768d302..40e7f4f00b 100644
7548c0
--- a/tests/virfirewalltest.c
7548c0
+++ b/tests/virfirewalltest.c
7548c0
@@ -206,8 +206,8 @@ testFirewallSingleGroup(const void *opaque)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host '!192.168.122.1' --jump REJECT\n";
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
     fwDisabled = data->fwDisabled;
7548c0
@@ -225,12 +225,12 @@ testFirewallSingleGroup(const void *opaque)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     if (virFirewallApply(fw) < 0)
7548c0
@@ -262,8 +262,8 @@ testFirewallRemoveRule(const void *opaque)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host '!192.168.122.1' --jump REJECT\n";
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
     virFirewallRulePtr fwrule;
7548c0
 
7548c0
@@ -282,17 +282,17 @@ testFirewallRemoveRule(const void *opaque)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     fwrule = virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                                 "-A", "INPUT", NULL);
7548c0
-    virFirewallRuleAddArg(fw, fwrule, "--source-host");
7548c0
+    virFirewallRuleAddArg(fw, fwrule, "--source");
7548c0
     virFirewallRemoveRule(fw, fwrule);
7548c0
 
7548c0
     fwrule = virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                                 "-A", "INPUT", NULL);
7548c0
-    virFirewallRuleAddArg(fw, fwrule, "--source-host");
7548c0
+    virFirewallRuleAddArg(fw, fwrule, "--source");
7548c0
     virFirewallRuleAddArgFormat(fw, fwrule, "%s", "!192.168.122.1");
7548c0
     virFirewallRuleAddArgList(fw, fwrule, "--jump", "REJECT", NULL);
7548c0
 
7548c0
@@ -325,9 +325,9 @@ testFirewallManyGroups(const void *opaque G_GNUC_UNUSED)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host '!192.168.122.1' --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A OUTPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
         IPTABLES_PATH " -w -A OUTPUT --jump DROP\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
@@ -346,19 +346,19 @@ testFirewallManyGroups(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallStartTransaction(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "OUTPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
@@ -416,9 +416,9 @@ testFirewallIgnoreFailGroup(const void *opaque G_GNUC_UNUSED)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.255 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A OUTPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
         IPTABLES_PATH " -w -A OUTPUT --jump DROP\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
@@ -439,19 +439,19 @@ testFirewallIgnoreFailGroup(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.255",
7548c0
+                       "--source", "192.168.122.255",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallStartTransaction(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "OUTPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
@@ -488,9 +488,9 @@ testFirewallIgnoreFailRule(const void *opaque G_GNUC_UNUSED)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.255 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A OUTPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
         IPTABLES_PATH " -w -A OUTPUT --jump DROP\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
@@ -511,18 +511,18 @@ testFirewallIgnoreFailRule(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRuleFull(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                            true, NULL, NULL,
7548c0
                            "-A", "INPUT",
7548c0
-                           "--source-host", "192.168.122.255",
7548c0
+                           "--source", "192.168.122.255",
7548c0
                            "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "OUTPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
@@ -559,8 +559,8 @@ testFirewallNoRollback(const void *opaque G_GNUC_UNUSED)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.255 --jump REJECT\n";
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
     fwDisabled = data->fwDisabled;
7548c0
@@ -580,17 +580,17 @@ testFirewallNoRollback(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.255",
7548c0
+                       "--source", "192.168.122.255",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     if (virFirewallApply(fw) == 0) {
7548c0
@@ -623,11 +623,11 @@ testFirewallSingleRollback(const void *opaque G_GNUC_UNUSED)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.255 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host 192.168.122.255 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host '!192.168.122.1' --jump REJECT\n";
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
     fwDisabled = data->fwDisabled;
7548c0
@@ -647,34 +647,34 @@ testFirewallSingleRollback(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.255",
7548c0
+                       "--source", "192.168.122.255",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallStartRollback(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "192.168.122.255",
7548c0
+                       "--source", "192.168.122.255",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     if (virFirewallApply(fw) == 0) {
7548c0
@@ -707,10 +707,10 @@ testFirewallManyRollback(const void *opaque G_GNUC_UNUSED)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.255 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host 192.168.122.255 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host '!192.168.122.1' --jump REJECT\n";
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
     fwDisabled = data->fwDisabled;
7548c0
@@ -730,38 +730,38 @@ testFirewallManyRollback(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallStartRollback(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallStartTransaction(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.255",
7548c0
+                       "--source", "192.168.122.255",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallStartRollback(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "192.168.122.255",
7548c0
+                       "--source", "192.168.122.255",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     if (virFirewallApply(fw) == 0) {
7548c0
@@ -794,14 +794,14 @@ testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.127 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host '!192.168.122.1' --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.255 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host 192.168.122.127 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host '!192.168.122.1' --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host 192.168.122.255 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -D INPUT --source-host '!192.168.122.1' --jump REJECT\n";
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.127 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source 192.168.122.127 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
     fwDisabled = data->fwDisabled;
7548c0
@@ -821,14 +821,14 @@ testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallStartRollback(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
 
7548c0
@@ -836,24 +836,24 @@ testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.127",
7548c0
+                       "--source", "192.168.122.127",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallStartRollback(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "192.168.122.127",
7548c0
+                       "--source", "192.168.122.127",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
 
7548c0
@@ -861,24 +861,24 @@ testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.255",
7548c0
+                       "--source", "192.168.122.255",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallStartRollback(fw, VIR_FIREWALL_ROLLBACK_INHERIT_PREVIOUS);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "192.168.122.255",
7548c0
+                       "--source", "192.168.122.255",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-D", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     if (virFirewallApply(fw) == 0) {
7548c0
@@ -962,7 +962,7 @@ testFirewallQueryCallback(virFirewallPtr fw,
7548c0
     size_t i;
7548c0
     virFirewallAddRule(fw, layer,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.129",
7548c0
+                       "--source", "!192.168.122.129",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     for (i = 0; lines[i] != NULL; i++) {
7548c0
@@ -990,15 +990,15 @@ testFirewallQuery(const void *opaque G_GNUC_UNUSED)
7548c0
     int ret = -1;
7548c0
     const char *actual = NULL;
7548c0
     const char *expected =
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.1 --jump ACCEPT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.127 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.127 --jump REJECT\n"
7548c0
         IPTABLES_PATH " -w -L\n"
7548c0
         IPTABLES_PATH " -w -t nat -L\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.130 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host '!192.168.122.129' --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host '!192.168.122.129' --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host 192.168.122.128 --jump REJECT\n"
7548c0
-        IPTABLES_PATH " -w -A INPUT --source-host '!192.168.122.1' --jump REJECT\n";
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.130 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.129' --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.129' --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source 192.168.122.128 --jump REJECT\n"
7548c0
+        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
7548c0
     const struct testFirewallData *data = opaque;
7548c0
 
7548c0
     expectedLineNum = 0;
7548c0
@@ -1020,14 +1020,14 @@ testFirewallQuery(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.1",
7548c0
+                       "--source", "192.168.122.1",
7548c0
                        "--jump", "ACCEPT", NULL);
7548c0
 
7548c0
     virFirewallStartTransaction(fw, 0);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.127",
7548c0
+                       "--source", "192.168.122.127",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRuleFull(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
@@ -1043,7 +1043,7 @@ testFirewallQuery(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.130",
7548c0
+                       "--source", "192.168.122.130",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
 
7548c0
@@ -1051,12 +1051,12 @@ testFirewallQuery(const void *opaque G_GNUC_UNUSED)
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "192.168.122.128",
7548c0
+                       "--source", "192.168.122.128",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
7548c0
                        "-A", "INPUT",
7548c0
-                       "--source-host", "!192.168.122.1",
7548c0
+                       "--source", "!192.168.122.1",
7548c0
                        "--jump", "REJECT", NULL);
7548c0
 
7548c0
     if (virFirewallApply(fw) < 0)
7548c0
-- 
7548c0
2.30.0
7548c0