This fixes ofp_bundle_commit() in two ways:

- Always remove the bundle regardless of the error condition.
- A commit of an empty bundle must be successful.

The actual commit is still not supported.

Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
---
 lib/ofp-parse.c   |    1 -
 ofproto/bundles.c |   15 ++++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 16c7cdc..9bb46fc 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -22,7 +22,6 @@
 #include <errno.h>
 #include <stdlib.h>
 
-#include "bundle.h"
 #include "byte-order.h"
 #include "dynamic-string.h"
 #include "learn.h"
diff --git a/ofproto/bundles.c b/ofproto/bundles.c
index a6637d9..4184a33 100644
--- a/ofproto/bundles.c
+++ b/ofproto/bundles.c
@@ -187,6 +187,8 @@ ofp_bundle_commit(struct ofconn *ofconn, uint32_t id, 
uint16_t flags)
 {
     struct hmap *bundles;
     struct ofp_bundle *bundle;
+    enum ofperr error = 0;
+    struct bundle_message *msg;
 
     bundles = ofconn_get_bundles(ofconn);
     bundle = ofp_bundle_find(bundles, id);
@@ -195,13 +197,16 @@ ofp_bundle_commit(struct ofconn *ofconn, uint32_t id, 
uint16_t flags)
         return OFPERR_OFPBFC_BAD_ID;
     }
     if (bundle->flags != flags) {
-        ofp_bundle_remove(ofconn, bundle);
-        return OFPERR_OFPBFC_BAD_FLAGS;
+        error = OFPERR_OFPBFC_BAD_FLAGS;
+    } else {
+        LIST_FOR_EACH (msg, node, &bundle->msg_list) {
+            /* XXX: actual commit */
+            error = OFPERR_OFPBFC_MSG_FAILED;
+        }
     }
 
-    /* XXX: actual commit */
-
-    return OFPERR_OFPBFC_MSG_UNSUP;
+    ofp_bundle_remove(ofconn, bundle);
+    return error;
 }
 
 enum ofperr
-- 
1.7.10.4

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

Reply via email to