Fix treatment of OpenFlow 1.1+ bucket weights.
authorBen Pfaff <blp@nicira.com>
Wed, 29 Jul 2015 05:01:24 +0000 (22:01 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 29 Jul 2015 16:10:19 +0000 (09:10 -0700)
commitb82ef59d9e299aa72c0ce8256bd98ba10cd441cb
tree84ad94a69c9976f119818c9f608f7f3959ab1b7b
parent277d3c451f0871ab5d7b96e0de4a5493c82b9598
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>
lib/ofp-parse.c
lib/ofp-print.c
lib/ofp-util.c