]> xenbits.xensource.com Git - libvirt.git/commitdiff
nwfilter: loop generated too many rules
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Thu, 30 Aug 2012 17:51:27 +0000 (13:51 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Thu, 30 Aug 2012 17:51:27 +0000 (13:51 -0400)
The loop processing the trusted DHCP server generated one too
many rules and added one final rules that accepted responses
from all DHCP servers. Below patch fixes this.

src/nwfilter/nwfilter_ebiptables_driver.c

index ad1d0555ebf40448b494ab32fc8c1faffb4ea6fe..701c55c58c99c4e24cc7d76428d96f42c9c170b6 100644 (file)
@@ -3374,10 +3374,10 @@ ebtablesApplyDHCPOnlyRules(const char *ifname,
 
         VIR_FREE(srcIPParam);
 
-        if (idx == num_dhcpsrvrs)
-            break;
-
         idx++;
+
+        if (idx >= num_dhcpsrvrs)
+            break;
     }
 
     virBufferAsprintf(&buf,