- ctx->ofproto = ofproto;
- ctx->flow = *flow;
- ctx->base_flow = ctx->flow;
- memset(&ctx->base_flow.tunnel, 0, sizeof ctx->base_flow.tunnel);
- ctx->orig_tunnel_ip_dst = flow->tunnel.ip_dst;
- ctx->rule = rule;
- ctx->packet = packet;
- ctx->may_learn = packet != NULL;
- ctx->tcp_flags = tcp_flags;
- ctx->resubmit_hook = NULL;
- ctx->report_hook = NULL;
- ctx->resubmit_stats = NULL;
-
- if (initial_vals) {
- ctx->base_flow.vlan_tci = initial_vals->vlan_tci;
+ ctx.xin = xin;
+ ctx.xout = xout;
+
+ ctx.ofproto = xin->ofproto;
+ ctx.rule = xin->rule;
+
+ ctx.base_flow = ctx.xin->flow;
+ ctx.base_flow.vlan_tci = xin->initial_vals.vlan_tci;
+ memset(&ctx.base_flow.tunnel, 0, sizeof ctx.base_flow.tunnel);
+ ctx.orig_tunnel_ip_dst = ctx.xin->flow.tunnel.ip_dst;
+
+ flow_wildcards_init_catchall(&ctx.xout->wc);
+ memset(&ctx.xout->wc.masks.in_port, 0xff,
+ sizeof ctx.xout->wc.masks.in_port);
+
+ if (tnl_port_should_receive(&ctx.xin->flow)) {
+ memset(&ctx.xout->wc.masks.tunnel, 0xff,
+ sizeof ctx.xout->wc.masks.tunnel);
+ }
+
+ /* Disable most wildcarding for NetFlow. */
+ if (xin->ofproto->netflow) {
+ memset(&ctx.xout->wc.masks.dl_src, 0xff,
+ sizeof ctx.xout->wc.masks.dl_src);
+ memset(&ctx.xout->wc.masks.dl_dst, 0xff,
+ sizeof ctx.xout->wc.masks.dl_dst);
+ memset(&ctx.xout->wc.masks.dl_type, 0xff,
+ sizeof ctx.xout->wc.masks.dl_type);
+ memset(&ctx.xout->wc.masks.vlan_tci, 0xff,
+ sizeof ctx.xout->wc.masks.vlan_tci);
+ memset(&ctx.xout->wc.masks.nw_proto, 0xff,
+ sizeof ctx.xout->wc.masks.nw_proto);
+ memset(&ctx.xout->wc.masks.nw_src, 0xff,
+ sizeof ctx.xout->wc.masks.nw_src);
+ memset(&ctx.xout->wc.masks.nw_dst, 0xff,
+ sizeof ctx.xout->wc.masks.nw_dst);
+ memset(&ctx.xout->wc.masks.tp_src, 0xff,
+ sizeof ctx.xout->wc.masks.tp_src);
+ memset(&ctx.xout->wc.masks.tp_dst, 0xff,
+ sizeof ctx.xout->wc.masks.tp_dst);
+ }
+
+ ctx.xout->tags = 0;
+ ctx.xout->slow = 0;
+ ctx.xout->has_learn = false;
+ ctx.xout->has_normal = false;
+ ctx.xout->has_fin_timeout = false;
+ ctx.xout->nf_output_iface = NF_OUT_DROP;
+ ctx.xout->mirrors = 0;
+
+ ofpbuf_use_stub(&ctx.xout->odp_actions, ctx.xout->odp_actions_stub,
+ sizeof ctx.xout->odp_actions_stub);
+ ofpbuf_reserve(&ctx.xout->odp_actions, NL_A_U32_SIZE);
+
+ ctx.recurse = 0;
+ ctx.max_resubmit_trigger = false;
+ ctx.orig_skb_priority = ctx.xin->flow.skb_priority;
+ ctx.table_id = 0;
+ ctx.exit = false;
+
+ if (xin->ofpacts) {
+ ofpacts = xin->ofpacts;
+ ofpacts_len = xin->ofpacts_len;
+ } else if (xin->rule) {
+ ofpacts = xin->rule->up.ofpacts;
+ ofpacts_len = xin->rule->up.ofpacts_len;
+ } else {
+ NOT_REACHED();