Skip to content

Commit

Permalink
ovn-controller: Fix invalid br_int_name handling.
Browse files Browse the repository at this point in the history
While doing some testing, I noticed the following error message:

  Integration bridge '<garbage>' dissapeared

The reason is that the code kept around the value of the "ovn-bridge"
configuration without copying it.  The result was pointing to bogus
memory.  You would only see this if you set "ovn_bridge".  If you
relied on the default, the bug would not occur.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Kyle Mestery <mestery@mestery.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
  • Loading branch information
russellb authored and Justin Pettit committed May 1, 2015
1 parent e4901fe commit 71bf929
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions ovn/controller/ovn-controller.c
Expand Up @@ -102,14 +102,15 @@ get_core_config(struct controller_ctx *ctx)

while (1) {
const struct ovsrec_bridge *br_int;
const char *remote, *system_id;
const char *remote, *system_id, *br_int_name;

ovsdb_idl_run(ctx->ovs_idl);

ctx->br_int_name = smap_get(&cfg->external_ids, "ovn-bridge");
if (!ctx->br_int_name) {
ctx->br_int_name = DEFAULT_BRIDGE_NAME;
br_int_name = smap_get(&cfg->external_ids, "ovn-bridge");
if (!br_int_name) {
br_int_name = DEFAULT_BRIDGE_NAME;
}
ctx->br_int_name = xstrdup(br_int_name);

br_int = get_bridge(ctx, ctx->br_int_name);
if (!br_int) {
Expand Down Expand Up @@ -240,6 +241,8 @@ main(int argc, char *argv[])
ovsdb_idl_destroy(ctx.ovs_idl);
ovsdb_idl_destroy(ctx.ovnsb_idl);

free(ctx.br_int_name);

exit(retval);
}

Expand Down
2 changes: 1 addition & 1 deletion ovn/controller/ovn-controller.h
Expand Up @@ -19,7 +19,7 @@

struct controller_ctx {
char *chassis_id; /* ID for this chassis. */
const char *br_int_name; /* Name of local integration bridge. */
char *br_int_name; /* Name of local integration bridge. */
struct ovsdb_idl *ovnsb_idl;
struct ovsdb_idl *ovs_idl;

Expand Down

0 comments on commit 71bf929

Please sign in to comment.