diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-29 20:34:10 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-29 20:34:10 +0200 |
commit | 3a7f5493619d20e7087536edbe694f9f2761ace5 (patch) | |
tree | c58b4a7ee55348c04d029333452c3973310619e9 /lib | |
parent | lib: Re-add partial IPV4 matching support (diff) | |
download | frr-3a7f5493619d20e7087536edbe694f9f2761ace5.tar.xz frr-3a7f5493619d20e7087536edbe694f9f2761ace5.zip |
lib: Retab command_match.c
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/command_match.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/lib/command_match.c b/lib/command_match.c index 984813d0d..f02b7c821 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -379,38 +379,38 @@ match_ipv4 (const char *str) memset (buf, 0, sizeof (buf)); sp = str; while (*str != '\0') - { - if (*str == '.') - { - if (dots >= 3) - return no_match; + { + if (*str == '.') + { + if (dots >= 3) + return no_match; - if (*(str + 1) == '.') - return no_match; + if (*(str + 1) == '.') + return no_match; - if (*(str + 1) == '\0') - return partly_match; + if (*(str + 1) == '\0') + return partly_match; - dots++; - break; - } - if (!isdigit ((int) *str)) - return no_match; + dots++; + break; + } + if (!isdigit ((int) *str)) + return no_match; - str++; - } + str++; + } if (str - sp > 3) - return no_match; + return no_match; strncpy (buf, sp, str - sp); if (atoi (buf) > 255) - return no_match; + return no_match; nums++; if (*str == '\0') - break; + break; str++; } @@ -436,51 +436,51 @@ match_ipv4_prefix (const char *str) memset (buf, 0, sizeof (buf)); sp = str; while (*str != '\0' && *str != '/') - { - if (*str == '.') - { - if (dots == 3) - return no_match; + { + if (*str == '.') + { + if (dots == 3) + return no_match; - if (*(str + 1) == '.' || *(str + 1) == '/') - return no_match; + if (*(str + 1) == '.' || *(str + 1) == '/') + return no_match; - if (*(str + 1) == '\0') - return partly_match; + if (*(str + 1) == '\0') + return partly_match; - dots++; - break; - } + dots++; + break; + } - if (!isdigit ((int) *str)) - return no_match; + if (!isdigit ((int) *str)) + return no_match; - str++; - } + str++; + } if (str - sp > 3) - return no_match; + return no_match; strncpy (buf, sp, str - sp); if (atoi (buf) > 255) - return no_match; + return no_match; if (dots == 3) - { - if (*str == '/') - { - if (*(str + 1) == '\0') - return partly_match; - - str++; - break; - } - else if (*str == '\0') - return partly_match; - } + { + if (*str == '/') + { + if (*(str + 1) == '\0') + return partly_match; + + str++; + break; + } + else if (*str == '\0') + return partly_match; + } if (*str == '\0') - return partly_match; + return partly_match; str++; } @@ -489,7 +489,7 @@ match_ipv4_prefix (const char *str) while (*str != '\0') { if (!isdigit ((int) *str)) - return no_match; + return no_match; str++; } |