From: Ethan Jackson Date: Sat, 15 Dec 2012 03:34:13 +0000 (-0800) Subject: ofproto-dpif: Don't output to nonexistent ports. X-Git-Tag: sliver-openvswitch-1.9.90-3~10^2~71 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a4454ac67c6d38740914d157f73b5083f6912172;p=sliver-openvswitch.git ofproto-dpif: Don't output to nonexistent ports. In older versions of Open vSwitch, one could reasonably predict that the datapath port number would be the same as the OpenFlow port number even for ports which may not exist yet. With the single datapath model, it's no possible longer to make this prediction. Therefore, instead of attempting to, this code simply drops packets which output to a nonexistent port. Signed-off-by: Ethan Jackson --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index d1064bc5a..d5155cf62 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -5384,28 +5384,24 @@ compose_output_action__(struct action_xlate_ctx *ctx, uint16_t ofp_port, uint32_t odp_port = ofp_port_to_odp_port(ctx->ofproto, ofp_port); ovs_be16 flow_vlan_tci = ctx->flow.vlan_tci; uint8_t flow_nw_tos = ctx->flow.nw_tos; + struct priority_to_dscp *pdscp; uint32_t out_port; - if (ofport) { - struct priority_to_dscp *pdscp; - - if (ofport->up.pp.config & OFPUTIL_PC_NO_FWD) { - xlate_report(ctx, "OFPPC_NO_FWD set, skipping output"); - return; - } else if (check_stp && !stp_forward_in_state(ofport->stp_state)) { - xlate_report(ctx, "STP not in forwarding state, skipping output"); - return; - } + if (!ofport) { + xlate_report(ctx, "Nonexistent output port"); + return; + } else if (ofport->up.pp.config & OFPUTIL_PC_NO_FWD) { + xlate_report(ctx, "OFPPC_NO_FWD set, skipping output"); + return; + } else if (check_stp && !stp_forward_in_state(ofport->stp_state)) { + xlate_report(ctx, "STP not in forwarding state, skipping output"); + return; + } - pdscp = get_priority(ofport, ctx->flow.skb_priority); - if (pdscp) { - ctx->flow.nw_tos &= ~IP_DSCP_MASK; - ctx->flow.nw_tos |= pdscp->dscp; - } - } else { - /* We may not have an ofport record for this port, but it doesn't hurt - * to allow forwarding to it anyhow. Maybe such a port will appear - * later and we're pre-populating the flow table. */ + pdscp = get_priority(ofport, ctx->flow.skb_priority); + if (pdscp) { + ctx->flow.nw_tos &= ~IP_DSCP_MASK; + ctx->flow.nw_tos |= pdscp->dscp; } out_port = vsp_realdev_to_vlandev(ctx->ofproto, odp_port,