From: Andrew Yourtchenko Date: Mon, 3 Jul 2017 14:25:37 +0000 (+0200) Subject: acl-plugin: fix acl plugin test failing sporadically (VPP-898) X-Git-Tag: v17.10-rc1~381 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commitdiff_plain;h=130a75384f139f64a5fcf3d357a1fdc769503738 acl-plugin: fix acl plugin test failing sporadically (VPP-898) The "acl_plugin" tests has one of the tests sporadically fail with the following traceback: r.reply.decode().rstrip('\x00') UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 20666: ordinal not in range(128) This occurs in the newly added "show acl-plugin table" debug CLI. This CLI has only the numeric outputs, so the conclusion is that it is the incorrect termination (trailing zero) that might be most probably causing it. The other acl-plugins show commands also lack the zero-termination termination, so fix all of them. The particularity of this command vs. the other acl-plugin debug CLIs is that the accumulator is freed and allocated multiple times, this might explain the issue is not seen with them. Change-Id: I87b5c0d6152fbebcae9c7d0ce97155c1ae6666db Signed-off-by: Andrew Yourtchenko (cherry picked from commit be055bd719559fc79d8a4c06479497c4c0bfae93) --- diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c index 704a839c363..02fcb4fe5d9 100644 --- a/src/plugins/acl/acl.c +++ b/src/plugins/acl/acl.c @@ -1974,6 +1974,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm, #define _(cnt, desc) out0 = format(out0, " %20lu: %s\n", am->cnt, desc); foreach_fa_cleaner_counter; #undef _ + vec_terminate_c_string(out0); vlib_cli_output(vm, "\n\n%s\n\n", out0); vlib_cli_output(vm, "Sessions per interval: min %lu max %lu increment: %f ms current: %f ms", am->fa_min_deleted_sessions_per_interval, am->fa_max_deleted_sessions_per_interval, @@ -2011,6 +2012,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm, } } + vec_terminate_c_string(out0); vlib_cli_output(vm, "\n%s\n", out0); vec_free(out0); } @@ -2067,6 +2069,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm, out0 = format(out0, "\n"); } } + vec_terminate_c_string(out0); vlib_cli_output(vm, "\n%s\n", out0); vec_free(out0); } @@ -2138,6 +2141,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm, pa->src_portrange_not_powerof2, pa->dst_portrange_not_powerof2); } } + vec_terminate_c_string(out0); vlib_cli_output(vm, "\n%s\n", out0); vec_free(out0); } @@ -2184,6 +2188,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm, } } + vec_terminate_c_string(out0); vlib_cli_output(vm, "\n%s\n", out0); vec_free(out0); }