From: Ben Pfaff Date: Tue, 17 Mar 2009 17:54:33 +0000 (-0700) Subject: secchan: Remove idle flows from datapath even if their rules haven't expired. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7db99cce0522571cda7572a1a6de32f10f79f81a;p=openvswitch secchan: Remove idle flows from datapath even if their rules haven't expired. --- 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; }