From 7ae20bb3feb9f4a3543b659d1cc9d32c1b4ce95c Mon Sep 17 00:00:00 2001 From: fenglei <1579628578@qq.com> Date: Sat, 14 Dec 2024 11:56:01 +0800 Subject: policer: Add return_dsc for policer_add_command_fn Type: improvement add return_desc for except failure Change-Id: Idcec0f8833fc264f66d2e0a784ece2a62c425263 Signed-off-by: fenglei <1579628578@qq.com> --- src/vnet/policer/policer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/vnet/policer/policer.c b/src/vnet/policer/policer.c index 1c575c84ccd..00180d9c993 100644 --- a/src/vnet/policer/policer.c +++ b/src/vnet/policer/policer.c @@ -608,10 +608,13 @@ policer_add_command_fn (vlib_main_t *vm, unformat_input_t *input, policer_index = p[0]; } - if (~0 != policer_index) + if (~0 == policer_index) { - rv = policer_update (vm, policer_index, &c); + error = clib_error_return (0, "Update policer failure"); + goto done; } + + rv = policer_update (vm, policer_index, &c); } else { -- cgit 1.2.3-korg