summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-xlate.c
diff options
context:
space:
mode:
authorNuman Siddique <numans@ovn.org>2021-11-04 19:51:34 -0400
committerIlya Maximets <i.maximets@ovn.org>2021-11-17 22:49:51 +0100
commit9fe0ce4f7258a8ac05dab2c8411a3073be0f36f9 (patch)
tree5c60fdc74080b79c8201b656e3839e2301d70058 /ofproto/ofproto-dpif-xlate.c
parenta83a406096e93f5b3bf4645a787e92acf251638d (diff)
downloadopenvswitch-9fe0ce4f7258a8ac05dab2c8411a3073be0f36f9.tar.gz
ofproto-dpif-xlate: Fix check_pkt_larger incomplete translation.
xlate_check_pkt_larger() sets ctx->exit to 'true' at the end causing the translation to stop. This results in incomplete datapath rules. For example, for the below OF rules configured on a bridge, table=0,in_port=1 actions=load:0x1->NXM_NX_REG1[[]],resubmit(,1), load:0x2->NXM_NX_REG1[[]],resubmit(,1), load:0x3->NXM_NX_REG1[[]],resubmit(,1) table=1,in_port=1,reg1=0x1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]], resubmit(,4) table=1,in_port=1,reg1=0x2 actions=output:2 table=1,in_port=1,reg1=0x3 actions=output:4 table=4,in_port=1 actions=output:3 The datapath flow should be: check_pkt_len(size=200,gt(3),le(3)),2,4 But right now it is: check_pkt_len(size=200,gt(3),le(3)) Actions after the first resubmit(,1) in the first flow in table 0 are never applied. This patch fixes this issue. Fixes: 5b34f8fc3b38 ("Add a new OVS action check_pkt_larger") Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2018365 Reported-by: Ihar Hrachyshka <ihrachys@redhat.com> Signed-off-by: Numan Siddique <numans@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ofproto/ofproto-dpif-xlate.c')
-rw-r--r--ofproto/ofproto-dpif-xlate.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 9d336bc6a..8ee6f5a4c 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -6371,6 +6371,7 @@ xlate_check_pkt_larger(struct xlate_ctx *ctx,
* then ctx->exit would be true. Reset to false so that we can
* do flow translation for 'IF_LESS_EQUAL' case. finish_freezing()
* would have taken care of Undoing the changes done for freeze. */
+ bool old_exit = ctx->exit;
ctx->exit = false;
offset_attr = nl_msg_start_nested(
@@ -6395,7 +6396,7 @@ xlate_check_pkt_larger(struct xlate_ctx *ctx,
ctx->was_mpls = old_was_mpls;
ctx->conntracked = old_conntracked;
ctx->xin->flow = old_flow;
- ctx->exit = true;
+ ctx->exit = old_exit;
}
static void
@@ -6776,6 +6777,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
return;
}
+ bool exit = false;
OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) {
struct ofpact_controller *controller;
const struct ofpact_metadata *metadata;
@@ -6790,7 +6792,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
recirc_for_mpls(a, ctx);
- if (ctx->exit) {
+ if (ctx->exit || exit) {
/* Check if need to store the remaining actions for later
* execution. */
if (ctx->freezing) {
@@ -7192,6 +7194,12 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
ofpacts_len);
xlate_check_pkt_larger(ctx, ofpact_get_CHECK_PKT_LARGER(a),
remaining_acts, remaining_acts_len);
+ if (ctx->xbridge->support.check_pkt_len) {
+ /* If datapath supports check_pkt_len, then
+ * xlate_check_pkt_larger() does the translation for the
+ * ofpacts following 'a'. */
+ exit = true;
+ }
break;
}
}