On Fri, May 1, 2015 at 1:22 PM, Russell Bryant <rbry...@redhat.com> wrote:
> 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 <rbry...@redhat.com> > --- > ovn/controller/ovn-controller.c | 11 +++++++---- > ovn/controller/ovn-controller.h | 2 +- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/ovn/controller/ovn-controller.c > b/ovn/controller/ovn-controller.c > index 477ad0a..778dd43 100644 > --- a/ovn/controller/ovn-controller.c > +++ b/ovn/controller/ovn-controller.c > @@ -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) { > @@ -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); > } > > diff --git a/ovn/controller/ovn-controller.h > b/ovn/controller/ovn-controller.h > index 9d2fb39..a1630f7 100644 > --- a/ovn/controller/ovn-controller.h > +++ b/ovn/controller/ovn-controller.h > @@ -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; > > Nice catch! Seems sensible too. :) Acked-by: Kyle Mestery <mest...@mestery.com> > -- > 2.1.0 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev