Bugfix for check overlap flag

We didn't detect flow-mod conflict when adding a finer granularity
flow which conflicts with an installed, coarser granularity flow.

Thanks Justin for pointing this out :
https://mailman.stanford.edu/pipermail/openflow-dev/2009-November/000529.html
This commit is contained in:
Yiannis Yiakoumis authored and Glen Gibb committed 2009-12-11 18:15:45 -08:00
1 parent bb697af959
commit 9e82ac43ce
9 files changed
+72 -10

No files matched your search

+15
View File
@@ -105,6 +105,21 @@ flow_matches_desc(const struct sw_flow_key *t, const struct sw_flow_key *d,
return flow_matches_1wild(t, d);
}
/* Returns nonzero if 't' (the table entry's key) and 'd' (the key
* describing the match) match, that is, if their fields are
* equal modulo 't' or 'd' wildcards, zero otherwise. If 'strict' is nonzero, the
* wildcards must match in both 't_key' and 'd_key'. Note that the
* table's wildcards are ignored unless 'strict' is set. */
int
flow_matches_2desc(const struct sw_flow_key *t, const struct sw_flow_key *d,
int strict)
{
if (strict && d->wildcards != t->wildcards) {
return 0;
}
return flow_matches_2wild(t, d);
}
void
flow_extract_match(struct sw_flow_key* to, const struct ofp_match* from)
{
+2
View File
@@ -81,6 +81,8 @@ int flow_matches_1wild(const struct sw_flow_key *, const struct sw_flow_key *);
int flow_matches_2wild(const struct sw_flow_key *, const struct sw_flow_key *);
int flow_matches_desc(const struct sw_flow_key *, const struct sw_flow_key *,
int);
int flow_matches_2desc(const struct sw_flow_key *, const struct sw_flow_key *,
int);
int flow_has_out_port(struct sw_flow *flow, uint16_t out_port);
struct sw_flow *flow_alloc(size_t);
void flow_setup_actions(struct sw_flow *, const struct ofp_action_header *, int);
+2 -2
View File
@@ -133,7 +133,7 @@ static int table_hash_has_conflict(struct sw_table *swt,
if (key->wildcards == 0) {
struct sw_flow **bucket = find_bucket(swt, key);
struct sw_flow *flow = *bucket;
if (flow && flow_matches_desc(&flow->key, key,strict)
if (flow && flow_matches_2desc(&flow->key, key,strict)
&& (flow->priority == priority)) {
return true;
}
@@ -143,7 +143,7 @@ static int table_hash_has_conflict(struct sw_table *swt,
for (i = 0; i <= th->bucket_mask; i++) {
struct sw_flow **bucket = &th->buckets[i];
struct sw_flow *flow = *bucket;
if (flow && flow_matches_desc(&flow->key, key, strict)
if (flow && flow_matches_2desc(&flow->key, key, strict)
&& (flow->priority == priority)) {
return true;
}
+1 -1
View File
@@ -127,7 +127,7 @@ static int table_linear_has_conflict(struct sw_table *swt,
struct sw_flow *flow;
LIST_FOR_EACH (flow, struct sw_flow, node, &tl->flows) {
if (flow_matches_desc(&flow->key, key, strict)
if (flow_matches_2desc(&flow->key, key, strict)
&& (flow->priority == priority)) {
return true;
}