From 238761c9b5358f24ba2127dd3b6768a36030787e Mon Sep 17 00:00:00 2001 From: mitmitmitm Date: Wed, 29 May 2024 13:34:36 +0200 Subject: [PATCH] "show upf session limit" CLI command: better handling of limit arg Don't count gaps in gtm->sessions pool into specified limit. --- upf/upf_cli.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/upf/upf_cli.c b/upf/upf_cli.c index 9d3734b..32b8e0b 100644 --- a/upf/upf_cli.c +++ b/upf/upf_cli.c @@ -1211,9 +1211,11 @@ upf_show_session_command_fn (vlib_main_t *vm, unformat_input_t *main_input, } else { + int i = 0; + pool_foreach (sess, gtm->sessions) { - if (limit != 0 && sess - gtm->sessions >= limit) + if (limit != 0 && ++i > limit) { vlib_cli_output (vm, "Max number of sessions displayed: %u", limit);