secchan: Keep track of ofproto even when translating nested actions.
authorBen Pfaff <blp@nicira.com>
Mon, 9 Mar 2009 18:28:01 +0000 (11:28 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 10 Mar 2009 21:00:34 +0000 (14:00 -0700)
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

index 39eb46da334a24d3bd908e2b0f77f450e6be3939..019d51fb8fec0d573466f42d680fc7555ca8be4d 100644 (file)
@@ -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);