From 7db99cce0522571cda7572a1a6de32f10f79f81a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 17 Mar 2009 10:54:33 -0700 Subject: [PATCH] secchan: Remove idle flows from datapath even if their rules haven't expired. --- secchan/ofproto.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/secchan/ofproto.c b/secchan/ofproto.c index 3846ffbf..1eec332d 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -2886,6 +2886,19 @@ send_flow_exp(struct ofproto *p, struct rule *rule, } } +static void +uninstall_idle_flow(struct ofproto *ofproto, struct rule *rule) +{ + assert(rule->installed); + assert(!rule->cr.wc.wildcards); + + rule_uninstall(ofproto, rule); + if (rule->super) { + classifier_remove(&ofproto->cls, &rule->cr); + rule_destroy(rule); + } +} + static void expire_rule(struct cls_rule *cls_rule, void *p_) { @@ -2902,11 +2915,17 @@ expire_rule(struct cls_rule *cls_rule, void *p_) : LLONG_MAX); expire = MIN(hard_expire, idle_expire); if (expire == LLONG_MAX) { + if (rule->installed && time_msec() >= rule->used + 5000) { + uninstall_idle_flow(p, rule); + } return; } now = time_msec(); if (now < expire) { + if (rule->installed && now >= rule->used + 5000) { + uninstall_idle_flow(p, rule); + } return; } -- 2.30.2