Skip to content

Commit

Permalink
actions: Add new "ct_clear" action.
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
  • Loading branch information
blp committed Jan 21, 2017
1 parent 4c99cb1 commit db0e819
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/ovn/actions.h
Expand Up @@ -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) \
Expand Down
16 changes: 16 additions & 0 deletions ovn/lib/actions.c
Expand Up @@ -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
Expand Down Expand Up @@ -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")) {
Expand Down
4 changes: 4 additions & 0 deletions ovn/ovn-sb.xml
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions ovn/utilities/ovn-trace.c
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions tests/ovn.at
Expand Up @@ -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)
Expand Down

0 comments on commit db0e819

Please sign in to comment.