From acbdfa2887c6937fa42f355efca1eb22c9c52c27 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 10 Mar 2009 09:55:41 -0700 Subject: [PATCH] secchan: Make ofproto_add_flow() able to add a permanent flow. --- secchan/fail-open.c | 5 +++-- secchan/in-band.c | 5 +++-- secchan/ofproto.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/secchan/fail-open.c b/secchan/fail-open.c index f3053a8d..1b3e75fd 100644 --- a/secchan/fail-open.c +++ b/secchan/fail-open.c @@ -116,11 +116,12 @@ fail_open_handle_flow_miss(struct fail_open *fo, struct ofproto *ofproto, action.output.len = htons(sizeof action); if (in_port == out_port || out_port == DROP) { /* Set up a flow to drop packets. */ - ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, NULL, 0, NULL, 0); + ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, NULL, 0, NULL, -1); } else if (out_port != FLOOD) { /* The output port is known, so add a new flow. */ action.output.port = htons(out_port); - ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, &action, 1, payload, 0); + ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, + &action, 1, payload, -1); } else { /* We don't know that MAC. Send along the packet without setting up a * flow. */ diff --git a/secchan/in-band.c b/secchan/in-band.c index 62fbef7e..6212061d 100644 --- a/secchan/in-band.c +++ b/secchan/in-band.c @@ -189,11 +189,12 @@ in_band_handle_flow_miss(struct in_band *in_band, struct ofproto *ofproto, action.output.len = htons(sizeof action); if (in_port == out_port || out_port == DROP) { /* Set up a flow to drop packets. */ - ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, NULL, 0, NULL, 0); + ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, NULL, 0, NULL, -1); } else if (out_port != FLOOD) { /* The output port is known, so add a new flow. */ action.output.port = htons(out_port); - ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, &action, 1, payload, 0); + ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, + &action, 1, payload, -1); } else { /* We don't know that MAC. Send along the packet without setting up a * flow. */ diff --git a/secchan/ofproto.c b/secchan/ofproto.c index f49ec56f..c30e6874 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -779,7 +779,7 @@ ofproto_add_flow(struct ofproto *p, rule = xmalloc(sizeof *rule); cls_rule_from_flow(&rule->cr, flow, wildcards, priority); - rule->idle_timeout = idle_timeout ? idle_timeout : 5; /* XXX */ + rule->idle_timeout = idle_timeout >= 0 ? idle_timeout : 5; /* XXX */ rule->hard_timeout = 0; /* XXX */ rule->used = rule->created = time_msec(); rule->packet_count = 0; -- 2.30.2