summaryrefslogtreecommitdiff
path: root/ovn
diff options
context:
space:
mode:
authorChandra S Vejendla <csvejend@us.ibm.com>2016-09-08 23:31:54 -0500
committerBen Pfaff <blp@ovn.org>2016-09-09 08:38:39 -0700
commitb81e5900ac0b79af62a7fc8ff813a1687a3038a6 (patch)
tree4eb259674ebb346d4734d556bd77726799794382 /ovn
parente4c61c65dec38ba0e5f0b74efc6b176869701be8 (diff)
downloadopenvswitch-b81e5900ac0b79af62a7fc8ff813a1687a3038a6.tar.gz
ovn-controller: Fix match crieria for dynamic mac binding flows
match struct is not initialized before adding flows for each entry in mac_bindings table. The matches for IPv4 and IPv6 entries don't have exactly the same form (IPv4 uses reg0, IPv6 uses xxreg0), so reusing a match structure can cause problems. Signed-off-by: Chandra Sekhar Vejendla <csvejend@us.ibm.com> Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Co-authored-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn')
-rw-r--r--ovn/controller/lflow.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c
index efac5b3b7..041462612 100644
--- a/ovn/controller/lflow.c
+++ b/ovn/controller/lflow.c
@@ -343,8 +343,6 @@ put_load(const uint8_t *data, size_t len,
static void
consider_neighbor_flow(const struct lport_index *lports,
const struct sbrec_mac_binding *b,
- struct ofpbuf *ofpacts_p,
- struct match *match_p,
struct hmap *flow_table)
{
const struct sbrec_port_binding *pb
@@ -360,7 +358,7 @@ consider_neighbor_flow(const struct lport_index *lports,
return;
}
-
+ struct match match = MATCH_CATCHALL_INITIALIZER;
if (strchr(b->ip, '.')) {
ovs_be32 ip;
if (!ip_parse(b->ip, &ip)) {
@@ -368,7 +366,7 @@ consider_neighbor_flow(const struct lport_index *lports,
VLOG_WARN_RL(&rl, "bad 'ip' %s", b->ip);
return;
}
- match_set_reg(match_p, 0, ntohl(ip));
+ match_set_reg(&match, 0, ntohl(ip));
} else {
struct in6_addr ip6;
if (!ipv6_parse(b->ip, &ip6)) {
@@ -378,16 +376,17 @@ consider_neighbor_flow(const struct lport_index *lports,
}
ovs_be128 value;
memcpy(&value, &ip6, sizeof(value));
- match_set_xxreg(match_p, 0, ntoh128(value));
+ match_set_xxreg(&match, 0, ntoh128(value));
}
- match_set_metadata(match_p, htonll(pb->datapath->tunnel_key));
- match_set_reg(match_p, MFF_LOG_OUTPORT - MFF_REG0, pb->tunnel_key);
-
- ofpbuf_clear(ofpacts_p);
- put_load(mac.ea, sizeof mac.ea, MFF_ETH_DST, 0, 48, ofpacts_p);
+ match_set_metadata(&match, htonll(pb->datapath->tunnel_key));
+ match_set_reg(&match, MFF_LOG_OUTPORT - MFF_REG0, pb->tunnel_key);
- ofctrl_add_flow(flow_table, OFTABLE_MAC_BINDING, 100, match_p, ofpacts_p);
+ uint64_t stub[1024 / 8];
+ struct ofpbuf ofpacts = OFPBUF_STUB_INITIALIZER(stub);
+ put_load(mac.ea, sizeof mac.ea, MFF_ETH_DST, 0, 48, &ofpacts);
+ ofctrl_add_flow(flow_table, OFTABLE_MAC_BINDING, 100, &match, &ofpacts);
+ ofpbuf_uninit(&ofpacts);
}
/* Adds an OpenFlow flow to flow tables for each MAC binding in the OVN
@@ -398,17 +397,10 @@ add_neighbor_flows(struct controller_ctx *ctx,
const struct lport_index *lports,
struct hmap *flow_table)
{
- struct ofpbuf ofpacts;
- struct match match;
- match_init_catchall(&match);
- ofpbuf_init(&ofpacts, 0);
-
const struct sbrec_mac_binding *b;
SBREC_MAC_BINDING_FOR_EACH (b, ctx->ovnsb_idl) {
- consider_neighbor_flow(lports, b, &ofpacts, &match, flow_table);
+ consider_neighbor_flow(lports, b, flow_table);
}
-
- ofpbuf_uninit(&ofpacts);
}
/* Translates logical flows in the Logical_Flow table in the OVN_SB database