if (setup_flow) {
struct ft_flow *f;
- bool queue;
+ int command;
f = ft_lookup(br->ft, flow, flow_hash(flow, 0));
if (f) {
if (!ftd_equal(dsts, n_dsts, f->dsts, f->n_dsts)) {
+ /* Update the flow. Use OFPFC_MODIFY_STRICT instead of
+ * OFPFC_ADD so that we don't reset the idle-timer
+ * countdown for this flow. */
ftf_set_dsts(f, dsts, n_dsts);
- queue = true;
+ command = OFPFC_MODIFY_STRICT;
} else {
/* Correct flow is already in the flow table, nothing to do.
* This should only happen on revalidate, since
* no-match packet-in message. (If it could happen in other
* circumstances then we'd want to arrange to send a packet-out
* below, but there's no need.) */
- queue = false;
+ command = -1;
}
f->tags = tags;
} else {
f = ftf_create(flow, dsts, n_dsts, tags);
ft_insert(br->ft, f);
- queue = true;
+ command = OFPFC_ADD;
}
f->need_drop = false;
- if (queue) {
- struct ofpbuf *fbuf = make_add_flow(flow, pkt->buffer_id,
- br->flow_idle_time,
- actions_len);
+ if (command >= 0) {
+ struct ofp_flow_mod *ofm;
+ struct ofpbuf *fbuf;
+
+ fbuf = make_add_flow(flow, pkt->buffer_id, br->flow_idle_time,
+ actions_len);
+ ofm = fbuf->data;
+ ofm->command = htons(command);
put_actions(dsts, n_dsts, ntohs(flow->dl_vlan), fbuf);
queue_tx(br, fbuf);