From ee382d89186673e2308b6fca5e4904279600c25b Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Tue, 8 Jan 2013 16:39:15 -0800 Subject: [PATCH] ofproto: Fix remaining incorrect users of OVSP_LOCAL. 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 Signed-off-by: Justin Pettit --- ofproto/connmgr.c | 4 +++- ofproto/connmgr.h | 1 + ofproto/in-band.c | 4 ++-- ofproto/in-band.h | 2 +- ofproto/ofproto-dpif.c | 5 ++++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 8a84da5e..56971ce0 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -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); } /* Fail-open and in-band implementation. */ diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h index a2f7d5a6..6ce413e8 100644 --- a/ofproto/connmgr.h +++ b/ofproto/connmgr.h @@ -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); diff --git a/ofproto/in-band.c b/ofproto/in-band.c index 81b330d2..3b98005f 100644 --- a/ofproto/in-band.c +++ b/ofproto/in-band.c @@ -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; } } diff --git a/ofproto/in-band.h b/ofproto/in-band.h index 7b610cbb..71de6ffd 100644 --- a/ofproto/in-band.h +++ b/ofproto/in-band.h @@ -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 */ diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 4d8540ec..ae6d5c62 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -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;