X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Flearning-switch.c;h=4a95dc1b8761c3a9104d2f9eee11e04f2a04b29c;hb=a39c3ff9f586d3416976d3c3bd095fa81d73efa0;hp=235e9d442d6a179aa9cc115f0e502e1784e1cee8;hpb=1e3f34c7693bcabae8e443ac1b246680ef9b60e2;p=sliver-openvswitch.git diff --git a/lib/learning-switch.c b/lib/learning-switch.c index 235e9d442..4a95dc1b8 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -200,15 +200,19 @@ lswitch_handshake(struct lswitch *sw) error = rconn_send(sw->rconn, msg, NULL); } } + if (protocol & usable_protocols) { + for (i = 0; !error && i < sw->n_default_flows; i++) { + msg = ofputil_encode_flow_mod(&sw->default_flows[i], protocol); + error = rconn_send(sw->rconn, msg, NULL); + } - for (i = 0; !error && i < sw->n_default_flows; i++) { - msg = ofputil_encode_flow_mod(&sw->default_flows[i], protocol); - error = rconn_send(sw->rconn, msg, NULL); - } - - if (error) { - VLOG_INFO_RL(&rl, "%s: failed to queue default flows (%s)", - rconn_get_name(sw->rconn), strerror(error)); + if (error) { + VLOG_INFO_RL(&rl, "%s: failed to queue default flows (%s)", + rconn_get_name(sw->rconn), strerror(error)); + } + } else { + VLOG_INFO_RL(&rl, "%s: failed to set usable protocol", + rconn_get_name(sw->rconn)); } } sw->protocol = protocol; @@ -342,6 +346,8 @@ lswitch_process_packet(struct lswitch *sw, const struct ofpbuf *msg) case OFPTYPE_PORT_MOD: case OFPTYPE_BARRIER_REQUEST: case OFPTYPE_BARRIER_REPLY: + case OFPTYPE_QUEUE_GET_CONFIG_REQUEST: + case OFPTYPE_QUEUE_GET_CONFIG_REPLY: case OFPTYPE_DESC_STATS_REQUEST: case OFPTYPE_DESC_STATS_REPLY: case OFPTYPE_FLOW_STATS_REQUEST: @@ -362,13 +368,30 @@ lswitch_process_packet(struct lswitch *sw, const struct ofpbuf *msg) case OFPTYPE_FLOW_MOD_TABLE_ID: case OFPTYPE_SET_PACKET_IN_FORMAT: case OFPTYPE_FLOW_AGE: - case OFPTYPE_SET_ASYNC_CONFIG: case OFPTYPE_SET_CONTROLLER_ID: case OFPTYPE_FLOW_MONITOR_STATS_REQUEST: case OFPTYPE_FLOW_MONITOR_STATS_REPLY: case OFPTYPE_FLOW_MONITOR_CANCEL: case OFPTYPE_FLOW_MONITOR_PAUSED: case OFPTYPE_FLOW_MONITOR_RESUMED: + case OFPTYPE_GET_ASYNC_REQUEST: + case OFPTYPE_GET_ASYNC_REPLY: + case OFPTYPE_SET_ASYNC_CONFIG: + case OFPTYPE_METER_MOD: + case OFPTYPE_GROUP_REQUEST: + case OFPTYPE_GROUP_REPLY: + case OFPTYPE_GROUP_DESC_REQUEST: + case OFPTYPE_GROUP_DESC_REPLY: + case OFPTYPE_GROUP_FEATURES_REQUEST: + case OFPTYPE_GROUP_FEATURES_REPLY: + case OFPTYPE_METER_REQUEST: + case OFPTYPE_METER_REPLY: + case OFPTYPE_METER_CONFIG_REQUEST: + case OFPTYPE_METER_CONFIG_REPLY: + case OFPTYPE_METER_FEATURES_REQUEST: + case OFPTYPE_METER_FEATURES_REPLY: + case OFPTYPE_TABLE_FEATURES_REQUEST: + case OFPTYPE_TABLE_FEATURES_REPLY: default: if (VLOG_IS_DBG_ENABLED()) { char *s = ofp_to_string(msg->data, msg->size, 2); @@ -386,7 +409,7 @@ send_features_request(struct lswitch *sw) struct ofp_switch_config *osc; int ofp_version = rconn_get_version(sw->rconn); - assert(ofp_version > 0 && ofp_version < 0xff); + ovs_assert(ofp_version > 0 && ofp_version < 0xff); /* Send OFPT_FEATURES_REQUEST. */ b = ofpraw_alloc(OFPRAW_OFPT_FEATURES_REQUEST, ofp_version, 0); @@ -535,7 +558,8 @@ process_packet_in(struct lswitch *sw, const struct ofp_header *oh) /* Extract flow data from 'opi' into 'flow'. */ ofpbuf_use_const(&pkt, pi.packet, pi.packet_len); - flow_extract(&pkt, 0, pi.fmd.tun_id, pi.fmd.in_port, &flow); + flow_extract(&pkt, 0, 0, NULL, pi.fmd.in_port, &flow); + flow.tunnel.tun_id = pi.fmd.tun_id; /* Choose output port. */ out_port = lswitch_choose_destination(sw, &flow); @@ -575,8 +599,9 @@ process_packet_in(struct lswitch *sw, const struct ofp_header *oh) /* The output port is known, or we always flood everything, so add a * new flow. */ memset(&fm, 0, sizeof fm); - cls_rule_init(&flow, &sw->wc, 0, &fm.cr); - ofputil_normalize_rule_quiet(&fm.cr); + match_init(&fm.match, &flow, &sw->wc); + ofputil_normalize_match_quiet(&fm.match); + fm.priority = 0; fm.table_id = 0xff; fm.command = OFPFC_ADD; fm.idle_timeout = sw->max_idle;