From 3c2caef9fd680437c9b85b91928b7fe6ef2a0905 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 6 Oct 2016 04:08:34 +0000 Subject: [PATCH] zebra: Fix static route helper function Signed-off-by: Quentin Young --- zebra/zebra_vty.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index d755562759..b3164839fa 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -312,25 +312,25 @@ zebra_vty_ip_route_tdv_helper (int argc, struct cmd_token *argv[], int idx_curr, char **tag, char **distance, char **vrf) { - if (argc > idx_curr) - { - if (strmatch (argv[idx_curr]->text, "tag")) - { - *tag = argv[idx_curr]->arg; - idx_curr++; - } - - if (strmatch (argv[idx_curr]->text, "vrf")) - { - *distance = NULL; - *vrf = argv[idx_curr]->arg; - } - else - { - *distance = argv[idx_curr]->arg; - *vrf = argv[++idx_curr]->arg; - } - } + *distance = NULL; + while (idx_curr < argc) + { + if (strmatch (argv[idx_curr]->text, "tag")) + { + *tag = argv[idx_curr+1]->arg; + idx_curr += 2; + } + else if (strmatch (argv[idx_curr]->text, "vrf")) + { + *vrf = argv[idx_curr+1]->arg; + idx_curr += 2; + } + else + { + *distance = argv[idx_curr]->arg; + idx_curr++; + } + } return; } -- 2.39.5