summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-rid.c
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@ovn.org>2017-07-07 16:26:10 -0700
committerJustin Pettit <jpettit@ovn.org>2017-07-27 19:20:48 -0700
commit8014f465e27206638e2deb7bcfbb5aa75906778f (patch)
tree3e5904d95f9f31d2bce3ad379fbc19838bc2fb0b /ofproto/ofproto-dpif-rid.c
parent6cb5e507973f30e8ca14b4bb518173a9ef51acfa (diff)
downloadopenvswitch-8014f465e27206638e2deb7bcfbb5aa75906778f.tar.gz
ofproto-dpif-rid: Always store tunnel metadata.
Tunnel metadata was only stored if the tunnel destination was set. It's possible, for example, that a flow could set the tunnel id field before recirculation and then set the destination field afterwards. The previous behavior is that the tunnel id would be lost during recirculation under such a circumstance. This changes the behavior to always copy the tunnel metadata, regardless of whether the tunnel destination is set. It also adds a unit test. Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto/ofproto-dpif-rid.c')
-rw-r--r--ofproto/ofproto-dpif-rid.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/ofproto/ofproto-dpif-rid.c b/ofproto/ofproto-dpif-rid.c
index 5355a83a0..c447167dc 100644
--- a/ofproto/ofproto-dpif-rid.c
+++ b/ofproto/ofproto-dpif-rid.c
@@ -127,16 +127,9 @@ frozen_state_hash(const struct frozen_state *state)
hash = uuid_hash(&state->ofproto_uuid);
hash = hash_int(state->table_id, hash);
- if (flow_tnl_dst_is_set(&state->metadata.tunnel)) {
- /* We may leave remainder bytes unhashed, but that is unlikely as
- * the tunnel is not in the datapath format. */
- hash = hash_bytes64((const uint64_t *) &state->metadata.tunnel,
- flow_tnl_size(&state->metadata.tunnel), hash);
- }
+ hash = hash_bytes64((const uint64_t *) &state->metadata,
+ sizeof state->metadata, hash);
hash = hash_boolean(state->conntracked, hash);
- hash = hash_bytes64((const uint64_t *) &state->metadata.metadata,
- sizeof state->metadata - sizeof state->metadata.tunnel,
- hash);
if (state->stack && state->stack_size) {
hash = hash_bytes(state->stack, state->stack_size, hash);
}
@@ -158,9 +151,7 @@ frozen_state_equal(const struct frozen_state *a, const struct frozen_state *b)
{
return (a->table_id == b->table_id
&& uuid_equals(&a->ofproto_uuid, &b->ofproto_uuid)
- && flow_tnl_equal(&a->metadata.tunnel, &b->metadata.tunnel)
- && !memcmp(&a->metadata.metadata, &b->metadata.metadata,
- sizeof a->metadata - sizeof a->metadata.tunnel)
+ && !memcmp(&a->metadata, &b->metadata, sizeof a->metadata)
&& a->stack_size == b->stack_size
&& !memcmp(a->stack, b->stack, a->stack_size)
&& a->mirrors == b->mirrors
@@ -204,8 +195,6 @@ static void
frozen_state_clone(struct frozen_state *new, const struct frozen_state *old)
{
*new = *old;
- flow_tnl_copy__(&new->metadata.tunnel, &old->metadata.tunnel);
-
new->stack = (new->stack_size
? xmemdup(new->stack, new->stack_size)
: NULL);