|
|
9219d1 |
From bc0e773fa3620fa3c4fef817d3b2256542be6b11 Mon Sep 17 00:00:00 2001
|
|
|
9219d1 |
From: Mark Michelson <mmichels@redhat.com>
|
|
|
9219d1 |
Date: Thu, 6 Aug 2020 10:48:12 -0400
|
|
|
9219d1 |
Subject: [PATCH 15/22] Allow bare ct_commits when no nested actions are
|
|
|
9219d1 |
required.
|
|
|
9219d1 |
|
|
|
9219d1 |
In the fixes commit below, ct_commit was changed to use nested actions.
|
|
|
9219d1 |
This requires that curly braces be present for all ct_commits. When
|
|
|
9219d1 |
adjusting ovn-northd, some ct_commits were not updated to have them.
|
|
|
9219d1 |
This commit changes the behavior of the ct_commit action not to require
|
|
|
9219d1 |
curly braces if there are no nested actions required.
|
|
|
9219d1 |
|
|
|
9219d1 |
Fixes: 6cfb44a76c61("Used nested actions in ct_commit")
|
|
|
9219d1 |
Signed-off-by: Mark Michelson <mmichels@redhat.com>
|
|
|
9219d1 |
---
|
|
|
9219d1 |
lib/actions.c | 20 ++++++++++++++++----
|
|
|
9219d1 |
tests/ovn.at | 5 ++++-
|
|
|
9219d1 |
2 files changed, 20 insertions(+), 5 deletions(-)
|
|
|
9219d1 |
|
|
|
9219d1 |
diff --git a/lib/actions.c b/lib/actions.c
|
|
|
9219d1 |
index 79ac79a95..245486b0a 100644
|
|
|
9219d1 |
--- a/lib/actions.c
|
|
|
9219d1 |
+++ b/lib/actions.c
|
|
|
9219d1 |
@@ -630,15 +630,27 @@ ovnact_ct_next_free(struct ovnact_ct_next *a OVS_UNUSED)
|
|
|
9219d1 |
static void
|
|
|
9219d1 |
parse_CT_COMMIT(struct action_context *ctx)
|
|
|
9219d1 |
{
|
|
|
9219d1 |
-
|
|
|
9219d1 |
- parse_nested_action(ctx, OVNACT_CT_COMMIT, "ip",
|
|
|
9219d1 |
- WR_CT_COMMIT);
|
|
|
9219d1 |
+ if (ctx->lexer->token.type == LEX_T_LCURLY) {
|
|
|
9219d1 |
+ parse_nested_action(ctx, OVNACT_CT_COMMIT, "ip",
|
|
|
9219d1 |
+ WR_CT_COMMIT);
|
|
|
9219d1 |
+ } else {
|
|
|
9219d1 |
+ /* Add an empty nested action to allow for "ct_commit;" syntax */
|
|
|
9219d1 |
+ add_prerequisite(ctx, "ip");
|
|
|
9219d1 |
+ struct ovnact_nest *on = ovnact_put(ctx->ovnacts, OVNACT_CT_COMMIT,
|
|
|
9219d1 |
+ OVNACT_ALIGN(sizeof *on));
|
|
|
9219d1 |
+ on->nested_len = 0;
|
|
|
9219d1 |
+ on->nested = NULL;
|
|
|
9219d1 |
+ }
|
|
|
9219d1 |
}
|
|
|
9219d1 |
|
|
|
9219d1 |
static void
|
|
|
9219d1 |
format_CT_COMMIT(const struct ovnact_nest *on, struct ds *s)
|
|
|
9219d1 |
{
|
|
|
9219d1 |
- format_nested_action(on, "ct_commit", s);
|
|
|
9219d1 |
+ if (on->nested_len) {
|
|
|
9219d1 |
+ format_nested_action(on, "ct_commit", s);
|
|
|
9219d1 |
+ } else {
|
|
|
9219d1 |
+ ds_put_cstr(s, "ct_commit;");
|
|
|
9219d1 |
+ }
|
|
|
9219d1 |
}
|
|
|
9219d1 |
|
|
|
9219d1 |
static void
|
|
|
9219d1 |
diff --git a/tests/ovn.at b/tests/ovn.at
|
|
|
9219d1 |
index b626bcfcc..2651b3eac 100644
|
|
|
9219d1 |
--- a/tests/ovn.at
|
|
|
9219d1 |
+++ b/tests/ovn.at
|
|
|
9219d1 |
@@ -1047,8 +1047,11 @@ ct_next;
|
|
|
9219d1 |
has prereqs ip
|
|
|
9219d1 |
|
|
|
9219d1 |
# ct_commit
|
|
|
9219d1 |
+ct_commit;
|
|
|
9219d1 |
+ encodes as ct(commit,zone=NXM_NX_REG13[0..15])
|
|
|
9219d1 |
+ has prereqs ip
|
|
|
9219d1 |
ct_commit { };
|
|
|
9219d1 |
- formats as ct_commit { drop; };
|
|
|
9219d1 |
+ formats as ct_commit;
|
|
|
9219d1 |
encodes as ct(commit,zone=NXM_NX_REG13[0..15])
|
|
|
9219d1 |
has prereqs ip
|
|
|
9219d1 |
ct_commit { ct_mark=1; };
|
|
|
9219d1 |
--
|
|
|
9219d1 |
2.26.2
|
|
|
9219d1 |
|