From b54d8da8c6c36d9952ad86b5d9c2f1c10892ab55 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 9 Mar 2009 11:28:01 -0700 Subject: [PATCH] secchan: Keep track of ofproto even when translating nested actions. Allowing vswitch to hook OFPP_NORMAL will require nested actions (via NXAST_RESUBMIT) to access the ofproto, so we need to be able to get to it in that case. --- secchan/ofproto.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/secchan/ofproto.c b/secchan/ofproto.c index 39eb46da..019d51fb 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -1384,7 +1384,8 @@ struct action_xlate_ctx { const union ofp_action *in; /* OpenFlow actions. */ size_t n_in; /* Number of elements in 'in' array. */ const flow_t *flow; /* Flow to which these actions correspond. */ - struct ofproto *ofproto; /* For OFPP_TABLE, NXAST_RESUBMIT only. */ + int recurse; /* Recursion level, via xlate_table_action. */ + struct ofproto *ofproto; /* Output. */ struct odp_actions *out; /* Datapath actions. */ @@ -1400,7 +1401,7 @@ xlate_table_action(const struct action_xlate_ctx *ctx, uint16_t in_port) struct rule *rule; flow_t flow; - if (!p) { + if (ctx->recurse) { return; } @@ -1428,7 +1429,8 @@ xlate_table_action(const struct action_xlate_ctx *ctx, uint16_t in_port) nested_ctx.in = rule->actions; nested_ctx.n_in = rule->n_actions; nested_ctx.flow = ctx->flow; - nested_ctx.ofproto = NULL; /* Prevent recursion. */ + nested_ctx.recurse = ctx->recurse + 1; + nested_ctx.ofproto = ctx->ofproto; nested_ctx.out = ctx->out; do_xlate_actions(&nested_ctx); } @@ -1572,6 +1574,7 @@ xlate_actions(const union ofp_action *in, size_t n_in, ctx.in = in; ctx.n_in = n_in; ctx.flow = flow; + ctx.recurse = 0; ctx.ofproto = ofproto; ctx.out = out; do_xlate_actions(&ctx); -- 2.30.2