bundles: Reject bundle add with bad flags.
authorJarno Rajahalme <jrajahalme@nicira.com>
Mon, 22 Dec 2014 19:31:18 +0000 (11:31 -0800)
committerJarno Rajahalme <jrajahalme@nicira.com>
Mon, 22 Dec 2014 19:39:35 +0000 (11:39 -0800)
OpenFlow 1.4 states that the switch must reject a bundle add message
whose flags are different from the ones in the bundle.  Do it.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto/bundles.c

index c443bdc..5244a26 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2013, 2014 Alexandru Copot <alex.mihai.c@gmail.com>, with support from IXIA.
  * Copyright (c) 2013, 2014 Daniel Baluta <dbaluta@ixiacom.com>
+ * Copyright (c) 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -237,11 +238,12 @@ ofp_bundle_add_message(struct ofconn *ofconn, struct ofputil_bundle_add_msg *bad
 
         bundles = ofconn_get_bundles(ofconn);
         hmap_insert(bundles, &bundle->node, bundle_hash(badd->bundle_id));
-    }
-
-    if (bundle->state == BS_CLOSED) {
+    } else if (bundle->state == BS_CLOSED) {
         ofp_bundle_remove(ofconn, bundle);
         return OFPERR_OFPBFC_BUNDLE_CLOSED;
+    } else if (badd->flags != bundle->flags) {
+        ofp_bundle_remove(ofconn, bundle);
+        return OFPERR_OFPBFC_BAD_FLAGS;
     }
 
     bmsg = xmalloc(sizeof *bmsg);