summaryrefslogtreecommitdiffstats
path: root/lib/command_match.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-08-04 18:18:31 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-08-04 18:18:31 +0200
commit5a8bbed0b1e9b22526fd23946593f47487709497 (patch)
treed5ae90ecc60f95fc814d96e6326bab2a25cd6dd5 /lib/command_match.c
parentlib: Refactor format parser (diff)
downloadfrr-5a8bbed0b1e9b22526fd23946593f47487709497.tar.xz
frr-5a8bbed0b1e9b22526fd23946593f47487709497.zip
lib: Add support for negative ranges
And convert range delimiters to signed int Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_match.c')
-rw-r--r--lib/command_match.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/command_match.c b/lib/command_match.c
index 305e3b1a6..aac2edc48 100644
--- a/lib/command_match.c
+++ b/lib/command_match.c
@@ -622,7 +622,7 @@ match_ipv6_prefix (const char *str)
return no_match;
/* validate mask */
- nmask = strtol (mask, &endptr, 10);
+ nmask = strtoimax (mask, &endptr, 10);
if (*endptr != '\0' || nmask < 0 || nmask > 128)
return no_match;
@@ -636,15 +636,14 @@ static enum match_type
match_range (struct graph_node *rangenode, const char *str)
{
char *endptr = NULL;
- signed long long val;
+ signed int val;
if (str == NULL)
return 1;
- val = strtoll (str, &endptr, 10);
+ val = strtoimax (str, &endptr, 10);
if (*endptr != '\0')
return 0;
- val = llabs(val);
if (val < rangenode->min || val > rangenode->max)
return no_match;
@@ -675,7 +674,7 @@ match_number(struct graph_node *numnode, const char *word)
{
if (!strcmp("\0", word)) return no_match;
char *endptr;
- long num = strtol(word, &endptr, 10);
+ int num = strtoimax(word, &endptr, 10);
if (endptr != '\0') return no_match;
return num == numnode->value ? exact_match : no_match;
}