Signed-off-by: Ben Pfaff <b...@ovn.org>
---
 include/ovn/actions.h     |  1 +
 ovn/lib/actions.c         | 16 ++++++++++++++++
 ovn/ovn-sb.xml            |  4 ++++
 ovn/utilities/ovn-trace.c |  1 +
 tests/ovn.at              |  4 ++++
 5 files changed, 26 insertions(+)

diff --git a/include/ovn/actions.h b/include/ovn/actions.h
index 6691116..1d7bd69 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 5aef9f9..34c7d2e 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -1055,6 +1055,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
@@ -1749,6 +1763,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 6171f9d..f806af7 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 35d0645..d4060b8 100644
--- a/ovn/utilities/ovn-trace.c
+++ b/ovn/utilities/ovn-trace.c
@@ -1427,6 +1427,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 ecdb2be..126574c 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)
-- 
2.10.2

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to