From 63adcc7d3fa1e136685f44edb03887222ea74bd8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 19 Oct 2011 16:03:31 -0700 Subject: [PATCH] ofproto: Check for overlapping flows only in the target table. There's no reason to check for overlapping flows in table A if the flow is going to be inserted into table B. (I doubt anyone actually uses OFPFF_CHECK_OVERLAP though.) --- ofproto/ofproto.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 0d80e131..7543e114 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2356,17 +2356,6 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn, struct rule *rule; int error; - /* Check for overlap, if requested. */ - if (fm->flags & OFPFF_CHECK_OVERLAP) { - struct classifier *cls; - - FOR_EACH_MATCHING_TABLE (cls, fm->table_id, ofproto) { - if (classifier_rule_overlaps(cls, &fm->cr)) { - return ofp_mkerr(OFPET_FLOW_MOD_FAILED, OFPFMFC_OVERLAP); - } - } - } - /* Pick table. */ if (fm->table_id == 0xff) { uint8_t table_id; @@ -2387,6 +2376,12 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn, return ofp_mkerr_nicira(OFPET_FLOW_MOD_FAILED, NXFMFC_BAD_TABLE_ID); } + /* Check for overlap, if requested. */ + if (fm->flags & OFPFF_CHECK_OVERLAP + && classifier_rule_overlaps(table, &fm->cr)) { + return ofp_mkerr(OFPET_FLOW_MOD_FAILED, OFPFMFC_OVERLAP); + } + /* Serialize against pending deletion. */ if (is_flow_deletion_pending(ofproto, &fm->cr, table - ofproto->tables)) { return OFPROTO_POSTPONE; -- 2.30.2