An OFPGC_DELETE command deletes a whole group, including all of its
buckets, and so it doesn't make sense for the command itself to include any
specification of buckets.

ONF-JIRA: EXT-510
Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/ofp-util.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index bf55fb2..a503818 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -7992,6 +7992,7 @@ ofputil_pull_ofp11_group_mod(struct ofpbuf *msg, enum 
ofp_version ofp_version,
                              struct ofputil_group_mod *gm)
 {
     const struct ofp11_group_mod *ogm;
+    enum ofperr error;
 
     ogm = ofpbuf_pull(msg, sizeof *ogm);
     gm->command = ntohs(ogm->command);
@@ -7999,8 +8000,18 @@ ofputil_pull_ofp11_group_mod(struct ofpbuf *msg, enum 
ofp_version ofp_version,
     gm->group_id = ntohl(ogm->group_id);
     gm->command_bucket_id = OFPG15_BUCKET_ALL;
 
-    return ofputil_pull_ofp11_buckets(msg, ofpbuf_size(msg), ofp_version,
-                                      &gm->buckets);
+    error = ofputil_pull_ofp11_buckets(msg, ofpbuf_size(msg), ofp_version,
+                                       &gm->buckets);
+
+    /* OF1.3.5+ prescribes an error when an OFPGC_DELETE includes buckets. */
+    if (!error
+        && ofp_version >= OFP13_VERSION
+        && gm->command == OFPGC11_DELETE
+        && !list_is_empty(&gm->buckets)) {
+        error = OFPERR_OFPGMFC_INVALID_GROUP;
+    }
+
+    return error;
 }
 
 static enum ofperr
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to