X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Flearning-switch.c;h=e189f1e44320d8f8f415bf0e13a705b809ad6a52;hb=d295e8e97acae13552a5b220d3fbcff8201064a2;hp=bca479ef23cc33b92f7f2305be668063301a72a8;hpb=ba186119ca5f787486189c041d76d63dee629dc1;p=openvswitch diff --git a/lib/learning-switch.c b/lib/learning-switch.c index bca479ef..e189f1e4 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -63,7 +63,7 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300); static void queue_tx(struct lswitch *, struct rconn *, struct ofpbuf *); static void send_features_request(struct lswitch *, struct rconn *); -static void send_default_flows(struct lswitch *sw, struct rconn *rconn, +static void send_default_flows(struct lswitch *sw, struct rconn *rconn, FILE *default_flows); typedef void packet_handler_func(struct lswitch *, struct rconn *, void *); @@ -249,7 +249,7 @@ send_features_request(struct lswitch *sw, struct rconn *rconn) } static void -send_default_flows(struct lswitch *sw, struct rconn *rconn, +send_default_flows(struct lswitch *sw, struct rconn *rconn, FILE *default_flows) { char line[1024]; @@ -260,20 +260,20 @@ send_default_flows(struct lswitch *sw, struct rconn *rconn, uint16_t priority, idle_timeout, hard_timeout; uint64_t cookie; struct ofp_match match; - + char *comment; - + /* Delete comments. */ comment = strchr(line, '#'); - if (comment) { + if (comment) { *comment = '\0'; } - + /* Drop empty lines. */ if (line[strspn(line, " \t\n")] == '\0') { continue; - } - + } + /* Parse and send. str_to_flow() will expand and reallocate the data * in 'buffer', so we can't keep pointers to across the str_to_flow() * call. */ @@ -374,6 +374,13 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn, void *opi_) struct ofpbuf pkt; flow_t flow; + /* Ignore packets sent via output to OFPP_CONTROLLER. This library never + * uses such an action. You never know what experiments might be going on, + * though, and it seems best not to interfere with them. */ + if (opi->reason != OFPR_NO_MATCH) { + return; + } + /* Extract flow data from 'opi' into 'flow'. */ pkt_ofs = offsetof(struct ofp_packet_in, data); pkt_len = ntohs(opi->header.length) - pkt_ofs;