X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Flearning-switch.c;h=7a60f3c32adb92c5fe9fa0f044f66cc6629d8545;hb=bc7a5acdff087b7e7a162da42ae608a83f3cf902;hp=e4287c4e31f605a690bf3ff0cc4865d2ba5433af;hpb=3cbd99318d04d07cfce8469711fb0398a832c8a7;p=openvswitch diff --git a/lib/learning-switch.c b/lib/learning-switch.c index e4287c4e..7a60f3c3 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -535,7 +535,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, 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,7 +576,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); + 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; @@ -589,13 +592,13 @@ process_packet_in(struct lswitch *sw, const struct ofp_header *oh) /* If the switch didn't buffer the packet, we need to send a copy. */ if (pi.buffer_id == UINT32_MAX && out_port != OFPP_NONE) { - queue_tx(sw, ofputil_encode_packet_out(&po)); + queue_tx(sw, ofputil_encode_packet_out(&po, sw->protocol)); } } else { /* We don't know that MAC, or we don't set up flows. Send along the * packet without setting up a flow. */ if (pi.buffer_id != UINT32_MAX || out_port != OFPP_NONE) { - queue_tx(sw, ofputil_encode_packet_out(&po)); + queue_tx(sw, ofputil_encode_packet_out(&po, sw->protocol)); } } }