Set up flow to drop packets that come in on their output port.
authorBen Pfaff <blp@nicira.com>
Fri, 8 Aug 2008 22:39:20 +0000 (15:39 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 8 Aug 2008 22:39:20 +0000 (15:39 -0700)
Commit 0a3d4ba3a, "Don't allow the learning switch to send packets back
out the incoming port," drops packets that come in on their incoming port,
but it does not set up a flow to drop those packets.  If we are connected
to a hub, then this can be very expensive, since we can continue to get
many packets in that flow and have to drop them in secchan one by one.  So
now we set up a flow to drop them for us.

lib/learning-switch.c

index e3b4df5d9617164a5a5f7336b0e1848b8ee6f5fa..0dfdeae5a0aea961876b232ab7833a672b2ee939 100644 (file)
@@ -224,9 +224,9 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn,
     }
 
     if (in_port == out_port) {
-        /* The input port and output port match, so just drop the packet 
-         * by returning. */
-        return;
+        /* The input and output port match.  Set up a flow to drop packets. */
+        queue_tx(sw, rconn, make_add_flow(&flow, ntohl(opi->buffer_id),
+                                          sw->max_idle, 0));
     } else if (sw->max_idle >= 0 && (!sw->ml || out_port != OFPP_FLOOD)) {
         /* The output port is known, or we always flood everything, so add a
          * new flow. */