summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2017-01-20 09:06:23 -0800
committerBen Pfaff <blp@ovn.org>2017-01-21 12:25:14 -0800
commitdb0e819be065c1474ceef232dcc1260c9a2e7c0e (patch)
tree5a51d39b00ee0c3d60e8c7d1693e20024376c1c3
parent4c99cb181b6937efb3819cffc9765999fd7b7796 (diff)
downloadopenvswitch-db0e819be065c1474ceef232dcc1260c9a2e7c0e.tar.gz
actions: Add new "ct_clear" action.
Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
-rw-r--r--include/ovn/actions.h1
-rw-r--r--ovn/lib/actions.c16
-rw-r--r--ovn/ovn-sb.xml4
-rw-r--r--ovn/utilities/ovn-trace.c1
-rw-r--r--tests/ovn.at4
5 files changed, 26 insertions, 0 deletions
diff --git a/include/ovn/actions.h b/include/ovn/actions.h
index 6691116b7..1d7bd69e8 100644
--- a/include/ovn/actions.h
+++ b/include/ovn/actions.h
@@ -60,6 +60,7 @@ struct simap;
OVNACT(CT_DNAT, ovnact_ct_nat) \
OVNACT(CT_SNAT, ovnact_ct_nat) \
OVNACT(CT_LB, ovnact_ct_lb) \
+ OVNACT(CT_CLEAR, ovnact_null) \
OVNACT(CLONE, ovnact_nest) \
OVNACT(ARP, ovnact_nest) \
OVNACT(ND_NA, ovnact_nest) \
diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c
index 186552f10..90a2addbe 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -1056,6 +1056,20 @@ ovnact_ct_lb_free(struct ovnact_ct_lb *ct_lb)
free(ct_lb->dsts);
}
+static void
+format_CT_CLEAR(const struct ovnact_null *null OVS_UNUSED, struct ds *s)
+{
+ ds_put_cstr(s, "ct_clear;");
+}
+
+static void
+encode_CT_CLEAR(const struct ovnact_null *null OVS_UNUSED,
+ const struct ovnact_encode_params *ep OVS_UNUSED,
+ struct ofpbuf *ofpacts)
+{
+ ofpact_put_CT_CLEAR(ofpacts);
+}
+
/* Implements the "arp", "nd_na", and "clone" actions, which execute nested
* actions on a packet derived from the one being processed. */
static void
@@ -1750,6 +1764,8 @@ parse_action(struct action_context *ctx)
parse_CT_SNAT(ctx);
} else if (lexer_match_id(ctx->lexer, "ct_lb")) {
parse_ct_lb_action(ctx);
+ } else if (lexer_match_id(ctx->lexer, "ct_clear")) {
+ ovnact_put_CT_CLEAR(ctx->ovnacts);
} else if (lexer_match_id(ctx->lexer, "clone")) {
parse_CLONE(ctx);
} else if (lexer_match_id(ctx->lexer, "arp")) {
diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml
index 6171f9d12..f806af72d 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -1143,6 +1143,10 @@
</p>
</dd>
+ <dt><code>ct_clear;</code></dt>
+ <dd>
+ Clears connection tracking state.
+ </dd>
<dt><code>clone { <var>action</var>; </code>...<code> };</code></dt>
<dd>
diff --git a/ovn/utilities/ovn-trace.c b/ovn/utilities/ovn-trace.c
index 32129821c..307556b91 100644
--- a/ovn/utilities/ovn-trace.c
+++ b/ovn/utilities/ovn-trace.c
@@ -1453,6 +1453,7 @@ trace_actions(const struct ovnact *ovnacts, size_t ovnacts_len,
case OVNACT_CT_DNAT:
case OVNACT_CT_SNAT:
case OVNACT_CT_LB:
+ case OVNACT_CT_CLEAR:
ovntrace_node_append(super, OVNTRACE_NODE_ERROR,
"*** ct_* actions not implemented");
break;
diff --git a/tests/ovn.at b/tests/ovn.at
index ecdb2be15..126574c52 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -887,6 +887,10 @@ ct_snat(foo, bar);
ct_snat();
Syntax error at `)' expecting IPv4 address.
+# ct_clear
+ct_clear;
+ encodes as ct_clear
+
# clone
clone { ip4.dst = 255.255.255.255; output; }; next;
encodes as clone(set_field:255.255.255.255->ip_dst,resubmit(,64)),resubmit(,27)