diff options
author | Joe Stringer <joe@ovn.org> | 2017-06-20 15:17:33 -0700 |
---|---|---|
committer | Joe Stringer <joe@ovn.org> | 2017-06-21 16:08:45 -0700 |
commit | a9fedc789078024cce8af6af267521f58760f31f (patch) | |
tree | aec274f191d70aa61ee87a913c32c33291903e0b /lib/ofp-actions.c | |
parent | b49a959bac4731a6203cc6f846967d96e51180ab (diff) | |
download | openvswitch-a9fedc789078024cce8af6af267521f58760f31f.tar.gz |
ofp-actions: Store raw type for NXAST_LEARN2.
Previously, if a controller wrote a flow with action NXAST_LEARN2, then
OVS would internally store an ofpact_learn structure with the raw type
set to NXAST_LEARN. When re-encoding, if the learn action happened to
have a limit or dst_ofs specified (which can only be specified for
NXAST_LEARN2), then it would re-encode using NXAST_LEARN2. However, if
these fields were both zero then OVS relies on the ofpact 'raw' type to
re-encode the action, so would end up encoding it as NXAST_LEARN in
subsequent serialization.
Fix this issue by storing the raw type when decoding learn actions.
VMWare-BZ: #1897275
Fixes: 4c71600d2256 ("ofp-actions: Add limit to learn action.")
Reported-by: Harold Lim <haroldl@vmware.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
Diffstat (limited to 'lib/ofp-actions.c')
-rw-r--r-- | lib/ofp-actions.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index a66cadcb5..ae27d9d88 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -4541,12 +4541,14 @@ learn_min_len(uint16_t header) static enum ofperr decode_LEARN_common(const struct nx_action_learn *nal, + enum ofp_raw_action_type raw, struct ofpact_learn *learn) { if (nal->pad) { return OFPERR_OFPBAC_BAD_ARGUMENT; } + learn->ofpact.raw = raw; learn->idle_timeout = ntohs(nal->idle_timeout); learn->hard_timeout = ntohs(nal->hard_timeout); learn->priority = ntohs(nal->priority); @@ -4658,7 +4660,7 @@ decode_NXAST_RAW_LEARN(const struct nx_action_learn *nal, learn = ofpact_put_LEARN(ofpacts); - error = decode_LEARN_common(nal, learn); + error = decode_LEARN_common(nal, NXAST_RAW_LEARN, learn); if (error) { return error; } @@ -4689,7 +4691,7 @@ decode_NXAST_RAW_LEARN2(const struct nx_action_learn2 *nal, } learn = ofpact_put_LEARN(ofpacts); - error = decode_LEARN_common(&nal->up, learn); + error = decode_LEARN_common(&nal->up, NXAST_RAW_LEARN2, learn); if (error) { return error; } |