summaryrefslogtreecommitdiff
path: root/lib/ofp-print.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2015-07-28 22:01:24 -0700
committerBen Pfaff <blp@nicira.com>2015-07-29 08:39:50 -0700
commit64e8c446ae140df25fa5976fa0a7f7c58f51ac55 (patch)
treea513ec36a0a894f128c1cfd37422594c7a639dc9 /lib/ofp-print.c
parent13d2c6894ec9dc9b70c109bd9c4dcc6610782821 (diff)
downloadopenvswitch-64e8c446ae140df25fa5976fa0a7f7c58f51ac55.tar.gz
Fix treatment of OpenFlow 1.1+ bucket weights.
Until now, OVS has parsed all OF1.1+ group buckets that lack a weight as having weight 1. Unfortunately, OpenFlow says that only "select" groups may have a nonzero weight, and requires reporting an error for other kinds of groups that have a nonzero weight. This commit fixes the problem by parsing only select groups with a default weight of 1 and other groups with a default weight of 0. It also adds the OpenFlow-required check for nonzero weights for other kinds of groups. This complies with OpenFlow 1.1 and later. OF1.1 says in section 5.8: If a specified group type is invalid (ie: includes fields such as weight that are undefined for the specified group type) then the switch must refuse to add the group entry and must send an ofp_error_msg with OFPET_GROUP_MOD_FAILED type and OFPGMFC_INVALID_GROUP code. Found by OFTest. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Flavio Leitner <fbl@sysclose.org>
Diffstat (limited to 'lib/ofp-print.c')
-rw-r--r--lib/ofp-print.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 44f3115bf..b8088f362 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -2376,7 +2376,7 @@ ofp_print_group(struct ds *s, uint32_t group_id, uint8_t type,
ds_put_cstr(s, "bucket=");
ofp_print_bucket_id(s, "bucket_id:", bucket->bucket_id, ofp_version);
- if (bucket->weight != 1) {
+ if (bucket->weight != (type == OFPGT11_SELECT ? 1 : 0)) {
ds_put_format(s, "weight:%"PRIu16",", bucket->weight);
}
if (bucket->watch_port != OFPP_NONE) {