diff options
| author | David Lamparter <equinox@diac24.net> | 2017-01-03 16:44:44 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-03 16:44:44 +0100 | 
| commit | 9b532e09f9a612884b2f394fe17d2d3386d3e3a9 (patch) | |
| tree | 416ce8e13e3fd965cee263946e6c86f7e2efa68b /lib/command.c | |
| parent | 9f221bd1a826f473b14393b1cf523543738c5050 (diff) | |
| parent | ff9eb96a93cdb5509a45f84bc557eb6dc9122c27 (diff) | |
Merge pull request #37 from LabNConsulting/working/2.0/patch-set-170102a
Working/2.0/patch set 170102a
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 28 | 
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/command.c b/lib/command.c index 399252777f..bc816dedea 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1061,6 +1061,7 @@ cmd_ipv6_prefix_match (const char *str)    const char *delim = "/\0";    char *dupe, *prefix, *mask, *context, *endptr;    int nmask = -1; +  enum match_type ret;    if (str == NULL)      return partly_match; @@ -1074,21 +1075,26 @@ cmd_ipv6_prefix_match (const char *str)    prefix = strtok_r(dupe, delim, &context);    mask   = strtok_r(NULL, delim, &context); +  ret = exact_match;    if (!mask) -    return partly_match; - -  /* validate prefix */ -  if (inet_pton(AF_INET6, prefix, &sin6_dummy.sin6_addr) != 1) -    return no_match; - -  /* validate mask */ -  nmask = strtol (mask, &endptr, 10); -  if (*endptr != '\0' || nmask < 0 || nmask > 128) -    return no_match; +    ret = partly_match; +  else +    { +      /* validate prefix */ +      if (inet_pton(AF_INET6, prefix, &sin6_dummy.sin6_addr) != 1) +        ret = no_match; +      else +        { +          /* validate mask */ +          nmask = strtol (mask, &endptr, 10); +          if (*endptr != '\0' || nmask < 0 || nmask > 128) +            ret = no_match; +        } +    }    XFREE(MTYPE_TMP, dupe); -  return exact_match; +  return ret;  }  #endif /* HAVE_IPV6  */  | 
