[ovs-dev] [PATCH 1/3] Check the number of buckets for indirect groups.
Jarno Rajahalme
jrajahalme at nicira.com
Fri Aug 30 20:40:16 UTC 2013
Indirect groups can have at most one bucket.
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
lib/ofp-parse.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 9098467..f17364f 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -2075,9 +2075,17 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command,
goto out;
}
/* Validate buckets. */
- LIST_FOR_EACH(bucket, list_node, &gm->buckets) {
- if (bucket->weight != 1 && gm->type != OFPGT11_SELECT) {
- error = xstrdup("Only select groups can have bucket weights.");
+ {
+ size_t n_buckets = 0;
+ LIST_FOR_EACH(bucket, list_node, &gm->buckets) {
+ ++n_buckets;
+ if (bucket->weight != 1 && gm->type != OFPGT11_SELECT) {
+ error = xstrdup("Only select groups can have bucket weights.");
+ goto out;
+ }
+ }
+ if (gm->type == OFPGT11_INDIRECT && n_buckets > 1) {
+ error = xstrdup("Indirect groups can have at most one bucket.");
goto out;
}
}
--
1.7.10.4
More information about the dev
mailing list