From: Justin Pettit Date: Wed, 30 Jul 2008 06:43:58 +0000 (-0700) Subject: Don't allow the learning switch to send packets back out the incoming port. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a3d4ba3a48cb679ff366298a2e8b75214646e75;p=openvswitch Don't allow the learning switch to send packets back out the incoming port. The learning switch functionality included in OpenFlow will send packets out the port they arrived on if the learned destination is from that port. This causes problems when newer switches flood packets for destinations they don't know and OpenFlow reinjects packets back into the network. The correct behavior is to just drop the packet. --- diff --git a/lib/learning-switch.c b/lib/learning-switch.c index b477e705..e3b4df5d 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -223,7 +223,11 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn, out_port = mac_learning_lookup(sw->ml, flow.dl_dst); } - if (sw->max_idle >= 0 && (!sw->ml || out_port != OFPP_FLOOD)) { + if (in_port == out_port) { + /* The input port and output port match, so just drop the packet + * by returning. */ + return; + } 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. */ queue_tx(sw, rconn, make_add_simple_flow(&flow, ntohl(opi->buffer_id),