ofproto: Fix remaining incorrect users of OVSP_LOCAL.
authorJustin Pettit <jpettit@nicira.com>
Wed, 9 Jan 2013 00:39:15 +0000 (16:39 -0800)
committerJustin Pettit <jpettit@nicira.com>
Wed, 9 Jan 2013 05:30:13 +0000 (21:30 -0800)
In the switch to a single datapath, the simple mapping between
OFPP_LOCAL and OVSP_LOCAL was broken.  Unfortunately, a couple of
translations were missed, so this commit fixes them.

Reported-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
ofproto/connmgr.c
ofproto/connmgr.h
ofproto/in-band.c
ofproto/in-band.h
ofproto/ofproto-dpif.c

index 8a84da5..56971ce 100644 (file)
@@ -1638,10 +1638,12 @@ connmgr_msg_in_hook(struct connmgr *mgr, const struct flow *flow,
 
 bool
 connmgr_may_set_up_flow(struct connmgr *mgr, const struct flow *flow,
+                        uint32_t local_odp_port,
                         const struct nlattr *odp_actions,
                         size_t actions_len)
 {
-    return !mgr->in_band || in_band_rule_check(flow, odp_actions, actions_len);
+    return !mgr->in_band || in_band_rule_check(flow, local_odp_port,
+                                               odp_actions, actions_len);
 }
 \f
 /* Fail-open and in-band implementation. */
index a2f7d5a..6ce413e 100644 (file)
@@ -158,6 +158,7 @@ void connmgr_set_in_band_queue(struct connmgr *, int queue_id);
 bool connmgr_msg_in_hook(struct connmgr *, const struct flow *,
                          const struct ofpbuf *packet);
 bool connmgr_may_set_up_flow(struct connmgr *, const struct flow *,
+                             uint32_t local_odp_port,
                              const struct nlattr *odp_actions,
                              size_t actions_len);
 
index 81b330d..3b98005 100644 (file)
@@ -256,7 +256,7 @@ in_band_msg_in_hook(struct in_band *in_band, const struct flow *flow,
 /* Returns true if the rule that would match 'flow' with 'actions' is
  * allowed to be set up in the datapath. */
 bool
-in_band_rule_check(const struct flow *flow,
+in_band_rule_check(const struct flow *flow, uint32_t local_odp_port,
                    const struct nlattr *actions, size_t actions_len)
 {
     /* Don't allow flows that would prevent DHCP replies from being seen
@@ -270,7 +270,7 @@ in_band_rule_check(const struct flow *flow,
 
         NL_ATTR_FOR_EACH_UNSAFE (a, left, actions, actions_len) {
             if (nl_attr_type(a) == OVS_ACTION_ATTR_OUTPUT
-                && nl_attr_get_u32(a) == OVSP_LOCAL) {
+                && nl_attr_get_u32(a) == local_odp_port) {
                 return true;
             }
         }
index 7b610cb..71de6ff 100644 (file)
@@ -41,7 +41,7 @@ void in_band_wait(struct in_band *);
 
 bool in_band_msg_in_hook(struct in_band *, const struct flow *,
                          const struct ofpbuf *packet);
-bool in_band_rule_check(const struct flow *,
+bool in_band_rule_check(const struct flow *, uint32_t local_odp_port,
                         const struct nlattr *odp_actions, size_t actions_len);
 
 #endif /* in-band.h */
index 4d8540e..ae6d5c6 100644 (file)
@@ -2930,7 +2930,7 @@ port_get_stats(const struct ofport *ofport_, struct netdev_stats *stats)
 
     error = netdev_get_stats(ofport->up.netdev, stats);
 
-    if (!error && ofport->odp_port == OVSP_LOCAL) {
+    if (!error && ofport_->ofp_port == OFPP_LOCAL) {
         struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofport->up.ofproto);
 
         /* ofproto->stats.tx_packets represents packets that we created
@@ -6180,6 +6180,7 @@ xlate_actions(struct action_xlate_ctx *ctx,
     } else {
         static struct vlog_rate_limit trace_rl = VLOG_RATE_LIMIT_INIT(1, 1);
         ovs_be16 initial_tci = ctx->base_flow.vlan_tci;
+        uint32_t local_odp_port;
 
         add_sflow_action(ctx);
         do_xlate_actions(ofpacts, ofpacts_len, ctx);
@@ -6200,7 +6201,9 @@ xlate_actions(struct action_xlate_ctx *ctx,
             }
         }
 
+        local_odp_port = ofp_port_to_odp_port(ctx->ofproto, OFPP_LOCAL);
         if (!connmgr_may_set_up_flow(ctx->ofproto->up.connmgr, &ctx->flow,
+                                     local_odp_port,
                                      ctx->odp_actions->data,
                                      ctx->odp_actions->size)) {
             ctx->slow |= SLOW_IN_BAND;