X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ofproto%2Fofproto.c;h=bc27079867f77da0edd42d1960360a8db7296fac;hb=e503cc1993970ef27882a9b922efbd365d9da2be;hp=b6cd0829c2f2c81fd3f80a1b02858c30edacb4fb;hpb=4766ce7a6438c11743c354fddad9d1164c76c467;p=sliver-openvswitch.git diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index b6cd0829c..bc2707986 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -419,6 +419,7 @@ ofproto_create(const char *datapath_name, const char *datapath_type, ofproto->max_ports = OFPP_MAX; ofproto->tables = NULL; ofproto->n_tables = 0; + list_init(&ofproto->expirable); ofproto->connmgr = connmgr_create(ofproto, datapath_name, datapath_name); ofproto->state = S_OPENFLOW; list_init(&ofproto->pending); @@ -3164,6 +3165,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn, rule->ofpacts_len = fm->ofpacts_len; rule->evictable = true; rule->eviction_group = NULL; + list_init(&rule->expirable); rule->monitor_flags = 0; rule->add_seqno = 0; rule->modify_seqno = 0; @@ -4826,6 +4828,9 @@ oftable_remove_rule(struct rule *rule) classifier_remove(&table->cls, &rule->cr); eviction_group_remove_rule(rule); + if (!list_is_empty(&rule->expirable)) { + list_remove(&rule->expirable); + } } /* Inserts 'rule' into its oftable. Removes any existing rule from 'rule''s @@ -4837,6 +4842,11 @@ oftable_replace_rule(struct rule *rule) struct ofproto *ofproto = rule->ofproto; struct oftable *table = &ofproto->tables[rule->table_id]; struct rule *victim; + bool may_expire = rule->hard_timeout || rule->idle_timeout; + + if (may_expire) { + list_insert(&ofproto->expirable, &rule->expirable); + } victim = rule_from_cls_rule(classifier_replace(&table->cls, &rule->cr)); if (victim) {