const struct cls_rule *target,
int include, cls_cb_func *cb, void *aux)
{
+ struct cls_rule *prev_rule;
+
+ prev_rule = NULL;
if (include & CLS_INC_WILD) {
const struct hmap *table;
for (table = &cls->tables[0]; table < &cls->tables[CLS_N_FIELDS];
LIST_FOR_EACH (pos, struct cls_rule, node.list,
&bucket->rules) {
if (rules_match_1wild(pos, target, 0)) {
- cb(pos, aux);
+ if (prev_rule) {
+ cb(prev_rule, aux);
+ }
+ prev_rule = pos;
}
}
}
HMAP_FOR_EACH (rule, struct cls_rule, node.hmap,
&cls->exact_table) {
if (rules_match_1wild(rule, target, 0)) {
- cb(rule, aux);
+ if (prev_rule) {
+ cb(prev_rule, aux);
+ }
+ prev_rule = rule;
}
}
} else {
struct cls_rule *rule = search_exact_table(cls, hash,
&target->flow);
if (rule) {
- cb(rule, aux);
+ if (prev_rule) {
+ cb(prev_rule, aux);
+ }
+ prev_rule = rule;
}
}
}
+ if (prev_rule) {
+ cb(prev_rule, aux);
+ }
}
void