summaryrefslogtreecommitdiff
path: root/lib/command.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2015-05-12 17:18:04 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-06-08 14:58:36 -0400
commit27e7f290292b7789d750758e5feea18ee6ca2a14 (patch)
tree1119ef9c290f321b1aaccccad5635fff95238dd6 /lib/command.h
parent6b87f736187d1a40a6b4f8d4fe42716bac09e857 (diff)
lib: fix "reduce strcmp in CLI" fallout (10bac801)
In "lib/cli: reduce strcmp in CLI hot paths", I failed to notice that CMD_VARIABLE as a boolean test covers a superset of the other types of variables. Thus, the patch broke processing of IP/IPv6/Integer range parameters in the CLI. Fix by some reordering and introducing TERMINAL_RECORD macro (which marks whether a given terminal type is a parameter) to be used in places where the check is really for all kinds of variables. Reported-by: Timo Teräs <timo.teras@iki.fi> Tested-by: Martin Winter <mwinter@netdef.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command.h')
-rw-r--r--lib/command.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/command.h b/lib/command.h
index 56c1caceb2..523d1a2e4c 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -167,6 +167,9 @@ enum cmd_terminal_type
TERMINAL_IPV6_PREFIX,
};
+/* argument to be recorded on argv[] if it's not a literal */
+#define TERMINAL_RECORD(t) ((t) >= TERMINAL_OPTION)
+
/* Command description structure. */
struct cmd_token
{