vswitchd: Avoid output port explosion with mirrors that output to VLANs.
authorBen Pfaff <blp@nicira.com>
Mon, 24 Aug 2009 17:42:44 +0000 (10:42 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 26 Aug 2009 21:03:39 +0000 (14:03 -0700)
compose_dsts() was updating the VLAN of packets sent to VLAN mirrors
before it changed the VLAN value, but of course it's the final VLAN value
that actually matters.

Thanks to Reid for his good work tracking this one down.

Bug #1898.

vswitchd/bridge.c

index 7ec774aca3324e38b98746ef8a1152db837021ae..3ffa671a137283c78dd2df0f38aac4cb4fd2018f 100644 (file)
@@ -1710,12 +1710,14 @@ compose_dsts(const struct bridge *br, const flow_t *flow, uint16_t vlan,
                 for (i = 0; i < br->n_ports; i++) {
                     struct port *port = br->ports[i];
                     if (port_includes_vlan(port, m->out_vlan)
-                        && set_dst(dst, flow, in_port, port, tags)
-                        && !dst_is_duplicate(dsts, dst - dsts, dst))
+                        && set_dst(dst, flow, in_port, port, tags))
                     {
                         if (port->vlan < 0) {
                             dst->vlan = m->out_vlan;
                         }
+                        if (dst_is_duplicate(dsts, dst - dsts, dst)) {
+                            continue;
+                        }
                         if (dst->dp_ifidx == flow->in_port
                             && dst->vlan == vlan) {
                             /* Don't send out input port on same VLAN. */