[ovs-dev] [vsctl 2/6] ovs-vsctl: Verify VLAN bridge controllers in cmd_get_controller().

Ben Pfaff blp at nicira.com
Wed Apr 18 00:23:07 UTC 2012


A VLAN bridge uses its parent's controllers, so checking the controller
should verify the parent's set of controllers.

The change to verify_controllers() isn't necessary; it just deletes
the check for a null 'bridge' because verify_controllers() can no
longer be called with a null 'bridge'.

This fixes a bug, but it is unlikely to ever have caused a real problem for
users.

Found by inspection.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 utilities/ovs-vsctl.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 567defb..1e04410 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -1947,13 +1947,11 @@ cmd_iface_to_br(struct vsctl_context *ctx)
 static void
 verify_controllers(struct ovsrec_bridge *bridge)
 {
-    if (bridge) {
-        size_t i;
+    size_t i;
 
-        ovsrec_bridge_verify_controller(bridge);
-        for (i = 0; i < bridge->n_controller; i++) {
-            ovsrec_controller_verify_target(bridge->controller[i]);
-        }
+    ovsrec_bridge_verify_controller(bridge);
+    for (i = 0; i < bridge->n_controller; i++) {
+        ovsrec_controller_verify_target(bridge->controller[i]);
     }
 }
 
@@ -1975,6 +1973,9 @@ cmd_get_controller(struct vsctl_context *ctx)
 
     get_info(ctx, &info);
     br = find_bridge(&info, ctx->argv[1], true);
+    if (br->parent) {
+        br = br->parent;
+    }
     verify_controllers(br->br_cfg);
 
     /* Print the targets in sorted order for reproducibility. */
-- 
1.7.2.5




More information about the dev mailing list