]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nwfilter: changes to rules in VM->host table
authorStefan Berger <stefanb@us.ibm.com>
Tue, 19 Oct 2010 15:35:58 +0000 (11:35 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Tue, 19 Oct 2010 15:35:58 +0000 (11:35 -0400)
In the table built for traffic coming from the VM going to the host make the following changes:

- don't ACCEPT the packets but do a 'RETURN' and let the host-specific firewall rules in subsequent rules evaluate whether the traffic is allowed to enter

- use the '-m state' in the rules as everywhere else

src/nwfilter/nwfilter_ebiptables_driver.c

index 23afc5e3d802deee7f867549b9a1c2d3f5cedfb9..1115d15b67980f498f21c083c239c15abf9bb38d 100644 (file)
@@ -1790,6 +1790,10 @@ iptablesCreateRuleInstance(virNWFilterDefPtr nwfilter,
         return rc;
 
     maySkipICMP = directionIn;
+    if (needState)
+        matchState = directionIn ? MATCH_STATE_IN : MATCH_STATE_OUT;
+    else
+        matchState = NULL;
 
     chainPrefix[0] = 'H';
     chainPrefix[1] = CHAINPREFIX_HOST_IN_TEMP;
@@ -1800,8 +1804,8 @@ iptablesCreateRuleInstance(virNWFilterDefPtr nwfilter,
                                      ifname,
                                      vars,
                                      res,
-                                     NULL, true,
-                                     "ACCEPT",
+                                     matchState, true,
+                                     "RETURN",
                                      isIPv6,
                                      maySkipICMP);