ovn-northd: Fix shadowed iterators in port security functions.
authorJustin Pettit <jpettit@ovn.org>
Tue, 12 Jul 2016 18:15:00 +0000 (11:15 -0700)
committerJustin Pettit <jpettit@ovn.org>
Wed, 13 Jul 2016 07:37:28 +0000 (00:37 -0700)
Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
ovn/northd/ovn-northd.c

index 788d614..6712d21 100644 (file)
@@ -1144,18 +1144,18 @@ build_port_security_nd(struct ovn_port *op, struct hmap *lflows)
 
             if (ps->n_ipv4_addrs) {
                 ds_put_cstr(&match, " && arp.spa == {");
-                for (size_t i = 0; i < ps->n_ipv4_addrs; i++) {
+                for (size_t j = 0; j < ps->n_ipv4_addrs; j++) {
                     /* When the netmask is applied, if the host portion is
                      * non-zero, the host can only use the specified
                      * address in the arp.spa.  If zero, the host is allowed
                      * to use any address in the subnet. */
-                    if (ps->ipv4_addrs[i].plen == 32
-                        || ps->ipv4_addrs[i].addr & ~ps->ipv4_addrs[i].mask) {
-                        ds_put_cstr(&match, ps->ipv4_addrs[i].addr_s);
+                    if (ps->ipv4_addrs[j].plen == 32
+                        || ps->ipv4_addrs[j].addr & ~ps->ipv4_addrs[j].mask) {
+                        ds_put_cstr(&match, ps->ipv4_addrs[j].addr_s);
                     } else {
                         ds_put_format(&match, "%s/%d",
-                                      ps->ipv4_addrs[i].network_s,
-                                      ps->ipv4_addrs[i].plen);
+                                      ps->ipv4_addrs[j].network_s,
+                                      ps->ipv4_addrs[j].plen);
                     }
                     ds_put_cstr(&match, ", ");
                 }
@@ -1244,26 +1244,26 @@ build_port_security_ip(enum ovn_pipeline pipeline, struct ovn_port *op,
                               op->json_key, ps->ea_s);
             }
 
-            for (int i = 0; i < ps->n_ipv4_addrs; i++) {
-                ovs_be32 mask = ps->ipv4_addrs[i].mask;
+            for (int j = 0; j < ps->n_ipv4_addrs; j++) {
+                ovs_be32 mask = ps->ipv4_addrs[j].mask;
                 /* When the netmask is applied, if the host portion is
                  * non-zero, the host can only use the specified
                  * address.  If zero, the host is allowed to use any
                  * address in the subnet.
                  */
-                if (ps->ipv4_addrs[i].plen == 32
-                    || ps->ipv4_addrs[i].addr & ~mask) {
-                    ds_put_format(&match, "%s", ps->ipv4_addrs[i].addr_s);
-                    if (pipeline == P_OUT && ps->ipv4_addrs[i].plen != 32) {
+                if (ps->ipv4_addrs[j].plen == 32
+                    || ps->ipv4_addrs[j].addr & ~mask) {
+                    ds_put_format(&match, "%s", ps->ipv4_addrs[j].addr_s);
+                    if (pipeline == P_OUT && ps->ipv4_addrs[j].plen != 32) {
                         /* Host is also allowed to receive packets to the
                          * broadcast address in the specified subnet. */
                         ds_put_format(&match, ", %s",
-                                      ps->ipv4_addrs[i].bcast_s);
+                                      ps->ipv4_addrs[j].bcast_s);
                     }
                 } else {
                     /* host portion is zero */
-                    ds_put_format(&match, "%s/%d", ps->ipv4_addrs[i].network_s,
-                                  ps->ipv4_addrs[i].plen);
+                    ds_put_format(&match, "%s/%d", ps->ipv4_addrs[j].network_s,
+                                  ps->ipv4_addrs[j].plen);
                 }
                 ds_put_cstr(&match, ", ");
             }