Skip to content

Commit b827b23

Browse files
committed
ofproto-dpif-xlate: Make "clone" save action set and stack.
This is a design decision but it seems conceptually cleaner than having them leak through into the clone. Reported-by: Mickey Spiegel <mickeys.dev@gmail.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-January/326981.html Fixes: 7ae62a6 ("ofp-actions: Add clone action.") Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Mickey Spiegel <mickeys.dev@gmail.com> Tested-by: Dong Jun <dongj@dtdream.com>
1 parent 46437c5 commit b827b23

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

ofproto/ofproto-dpif-xlate.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
1+
/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc.
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
@@ -4318,8 +4318,24 @@ compose_clone_action(struct xlate_ctx *ctx, const struct ofpact_nest *oc)
43184318
bool old_conntracked = ctx->conntracked;
43194319
struct flow old_flow = ctx->xin->flow;
43204320

4321+
struct ofpbuf old_stack = ctx->stack;
4322+
union mf_subvalue new_stack[1024 / sizeof(union mf_subvalue)];
4323+
ofpbuf_use_stub(&ctx->stack, new_stack, sizeof new_stack);
4324+
ofpbuf_put(&ctx->stack, old_stack.data, old_stack.size);
4325+
4326+
struct ofpbuf old_action_set = ctx->action_set;
4327+
uint64_t actset_stub[1024 / 8];
4328+
ofpbuf_use_stub(&ctx->action_set, actset_stub, sizeof actset_stub);
4329+
ofpbuf_put(&ctx->action_set, old_action_set.data, old_action_set.size);
4330+
43214331
do_xlate_actions(oc->actions, ofpact_nest_get_action_len(oc), ctx);
43224332

4333+
ofpbuf_uninit(&ctx->action_set);
4334+
ctx->action_set = old_action_set;
4335+
4336+
ofpbuf_uninit(&ctx->stack);
4337+
ctx->stack = old_stack;
4338+
43234339
ctx->xin->flow = old_flow;
43244340

43254341
/* The clone's conntrack execution should have no effect on the original

utilities/ovs-ofctl.8.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2638,7 +2638,8 @@ in Open vSwitch 2.4.
26382638
Executes each nested \fIaction\fR, saving much of the packet and
26392639
pipeline state beforehand and then restoring it afterward. The state
26402640
that is saved and restored includes all flow data and metadata
2641-
(including, for example, \fBct_state\fR).
2641+
(including, for example, \fBct_state\fR), the stack accessed by
2642+
\fBpush\fR and \fBpop\fR actions, and the OpenFlow action set.
26422643
.IP
26432644
This action was added in Open vSwitch 2.6.90.
26442645
.RE

0 commit comments

Comments
 (0)