On Tue, Jul 11, 2017 at 08:47:10AM +0800, ZhiPeng Lu wrote: > This fixes an assertion failure in command "ovs-vsctl list netflow br0", > if bridge br0 without any netflows. > $ovs-vsctl list netflow br0 > ovs-vsctl: lib/ovsdb-idl.c:2407: assertion column_idx < class->n_columns > failed > in ovsdb_idl_read() > Aborted > > Get_row_by_id() shoudle return NULL if not find by > ovsdb_idl_get_row_for_uuid(). > > Signed-off-by: Zhipeng Lu <[email protected]> > --- > lib/db-ctl-base.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c > index 7839389..90629d5 100644 > --- a/lib/db-ctl-base.c > +++ b/lib/db-ctl-base.c > @@ -346,6 +346,8 @@ get_row_by_id(struct ctl_context *ctx, > if (uuid->n == 1) { > final = ovsdb_idl_get_row_for_uuid(ctx->idl, table, > &uuid->keys[0].uuid); > + } else { > + final = NULL; > } > } > return final;
Thanks for the fix. I improved the commit message, added a test, and applied this to branch-2.7, branch-2.6, and branch-2.5. --8<--------------------------cut here-------------------------->8-- From: ZhiPeng Lu <[email protected]> Date: Tue, 11 Jul 2017 08:47:10 +0800 Subject: [PATCH] db-ctl-base: Fix reference-following feature in get_row_by_id(). If a particular column is supposed to be reached by following a reference from a UUID column, then that really needs to happen; if there's no reference, then we're probably starting from a row in the wrong table. This fixes an assertion failure in command "ovs-vsctl list netflow br0", if bridge br0 without any netflows. $ovs-vsctl list netflow br0 ovs-vsctl: lib/ovsdb-idl.c:2407: assertion column_idx < class->n_columns failed in ovsdb_idl_read() Aborted Fixes: 3f5b5f7b4115 ("db-ctl-base: Always support all tables in schema.") Signed-off-by: Zhipeng Lu <[email protected]> Signed-off-by: Ben Pfaff <[email protected]> --- lib/db-ctl-base.c | 2 ++ tests/ovs-vsctl.at | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c index 78393895c91b..90629d5d9913 100644 --- a/lib/db-ctl-base.c +++ b/lib/db-ctl-base.c @@ -346,6 +346,8 @@ get_row_by_id(struct ctl_context *ctx, if (uuid->n == 1) { final = ovsdb_idl_get_row_for_uuid(ctx->idl, table, &uuid->keys[0].uuid); + } else { + final = NULL; } } return final; diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index 08eb3287c6be..8861a4aad3b1 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -775,6 +775,9 @@ AT_CHECK([RUN_OVS_VSCTL([add-br br1])], [0], [ignore], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set-controller br1 tcp:127.0.0.1])], [0], [ignore], [], [OVS_VSCTL_CLEANUP]) +AT_CHECK([RUN_OVS_VSCTL([list netflow br0])], [1], [], + [ovs-vsctl: no row "br0" in table NetFlow +], [OVS_VSCTL_CLEANUP]) AT_CHECK([ RUN_OVS_VSCTL_TOGETHER([--id=@n create netflow targets='"1.2.3.4:567"'], [set bridge br0 netflow=@n])], -- 2.10.2 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
