diff --git a/include/ovn/actions.h b/include/ovn/actions.h index 6691116b7e0..1d7bd69e813 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 186552f1011..90a2addbe88 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 6171f9d12f3..f806af72daf 100644 --- a/ovn/ovn-sb.xml +++ b/ovn/ovn-sb.xml @@ -1143,6 +1143,10 @@

+
ct_clear;
+
+ Clears connection tracking state. +
clone { action; ... };
diff --git a/ovn/utilities/ovn-trace.c b/ovn/utilities/ovn-trace.c index 32129821c37..307556b9162 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 ecdb2be152b..126574c52d3 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)