diff options
author | Ben Pfaff <blp@ovn.org> | 2018-03-19 13:11:26 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-03-31 11:31:36 -0700 |
commit | 1f7270d737c7fc1b2cd49bc34048198f0201201b (patch) | |
tree | 741f123b426eb9c7b19296aebaaf35ccfedce4bf /lib/match.c | |
parent | 3829cad68a7e68760046a4903d60c0a4ee9b65c2 (diff) | |
download | openvswitch-1f7270d737c7fc1b2cd49bc34048198f0201201b.tar.gz |
match: Add 'tun_md' member to struct minimatch.
struct match has had a 'tun_md' member for a long time, but struct
minimatch has never had one. This doesn't matter for the purposes for
which minimatch is currently used, but it means that a minimatch is not
completely substitutable for a match and therefore blocks some new uses.
This patch adds the member.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Armando Migliaccio <armamig@gmail.com>
Diffstat (limited to 'lib/match.c')
-rw-r--r-- | lib/match.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/match.c b/lib/match.c index 97a528299..3eab0fd5d 100644 --- a/lib/match.c +++ b/lib/match.c @@ -1663,6 +1663,8 @@ minimatch_init(struct minimatch *dst, const struct match *src) miniflow_alloc(dst->flows, 2, &tmp); miniflow_init(dst->flow, &src->flow); minimask_init(dst->mask, &src->wc); + + dst->tun_md = tun_metadata_allocation_clone(&src->tun_md); } /* Initializes 'dst' as a copy of 'src'. The caller must eventually free 'dst' @@ -1677,6 +1679,7 @@ minimatch_clone(struct minimatch *dst, const struct minimatch *src) miniflow_get_values(src->flow), data_size); memcpy(miniflow_values(&dst->mask->masks), miniflow_get_values(&src->mask->masks), data_size); + dst->tun_md = tun_metadata_allocation_clone(src->tun_md); } /* Initializes 'dst' with the data in 'src', destroying 'src'. The caller must @@ -1686,6 +1689,7 @@ minimatch_move(struct minimatch *dst, struct minimatch *src) { dst->flow = src->flow; dst->mask = src->mask; + dst->tun_md = src->tun_md; } /* Frees any memory owned by 'match'. Does not free the storage in which @@ -1694,6 +1698,7 @@ void minimatch_destroy(struct minimatch *match) { free(match->flow); + free(match->tun_md); } /* Initializes 'dst' as a copy of 'src'. */ @@ -1702,7 +1707,7 @@ minimatch_expand(const struct minimatch *src, struct match *dst) { miniflow_expand(src->flow, &dst->flow); minimask_expand(src->mask, &dst->wc); - memset(&dst->tun_md, 0, sizeof dst->tun_md); + tun_metadata_allocation_copy(&dst->tun_md, src->tun_md); } /* Returns true if 'a' and 'b' match the same packets, false otherwise. */ |