[ovs-dev] [PATCH 1/2] ovs-vsctl: Don't allow controller configuration on fake bridges
Justin Pettit
jpettit at nicira.com
Fri Dec 18 00:08:46 UTC 2009
Fake bridges can't have controller configuration separate from its
parent, so prevent this from happening.
Thanks to Ben Pfaff for pointing out the problem.
---
utilities/ovs-vsctl.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index c60fd43..0e2187a 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -1260,6 +1260,10 @@ cmd_del_controller(struct vsctl_context *ctx)
} else {
struct vsctl_bridge *br = find_bridge(&info, ctx->argv[1], true);
+ if (!br->br_cfg) {
+ vsctl_fatal("cannot configure controller on a fake bridge");
+ }
+
if (br->ctrl) {
ovsrec_controller_delete(br->ctrl);
ovsrec_bridge_set_controller(br->br_cfg, NULL);
@@ -1289,6 +1293,10 @@ cmd_set_controller(struct vsctl_context *ctx)
/* Set the controller for a particular bridge. */
struct vsctl_bridge *br = find_bridge(&info, ctx->argv[1], true);
+ if (!br->br_cfg) {
+ vsctl_fatal("cannot configure controller on a fake bridge");
+ }
+
if (br->ctrl) {
ovsrec_controller_delete(br->ctrl);
}
@@ -1348,6 +1356,10 @@ cmd_del_fail_mode(struct vsctl_context *ctx)
} else {
struct vsctl_bridge *br = find_bridge(&info, ctx->argv[1], true);
+ if (!br->br_cfg) {
+ vsctl_fatal("cannot configure fail-mode on a fake bridge");
+ }
+
if (br->ctrl && br->ctrl->fail_mode) {
ovsrec_controller_set_fail_mode(br->ctrl, NULL);
}
@@ -1379,6 +1391,10 @@ cmd_set_fail_mode(struct vsctl_context *ctx)
} else {
struct vsctl_bridge *br = find_bridge(&info, ctx->argv[1], true);
+ if (!br->br_cfg) {
+ vsctl_fatal("cannot configure fail-mode on a fake bridge");
+ }
+
if (!br->ctrl) {
vsctl_fatal("no controller declared for %s", br->name);
}
--
1.6.5.5
More information about the dev
mailing list