mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 18:48:14 +00:00
Merge pull request #13882 from opensourcerouting/fix/dead_code
bgpd: Drop dead code when parsing extcommunity (color)
This commit is contained in:
commit
e8cb6df466
@ -557,7 +557,6 @@ static const char *ecommunity_gettoken(const char *str, void *eval_ptr,
|
|||||||
int dot = 0;
|
int dot = 0;
|
||||||
int digit = 0;
|
int digit = 0;
|
||||||
int separator = 0;
|
int separator = 0;
|
||||||
int i;
|
|
||||||
const char *p = str;
|
const char *p = str;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
struct in_addr ip;
|
struct in_addr ip;
|
||||||
@ -585,8 +584,7 @@ static const char *ecommunity_gettoken(const char *str, void *eval_ptr,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* "rt", "nt", "soo", and "color" keyword parse. */
|
/* "rt", "nt", "soo", and "color" keyword parse. */
|
||||||
if (!isdigit((unsigned char)*p)) {
|
/* "rt" */
|
||||||
/* "rt" match check. */
|
|
||||||
if (tolower((unsigned char)*p) == 'r') {
|
if (tolower((unsigned char)*p) == 'r') {
|
||||||
p++;
|
p++;
|
||||||
if (tolower((unsigned char)*p) == 't') {
|
if (tolower((unsigned char)*p) == 't') {
|
||||||
@ -603,7 +601,8 @@ static const char *ecommunity_gettoken(const char *str, void *eval_ptr,
|
|||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/* "nt" match check. */
|
|
||||||
|
/* "nt" */
|
||||||
if (tolower((unsigned char)*p) == 'n') {
|
if (tolower((unsigned char)*p) == 'n') {
|
||||||
p++;
|
p++;
|
||||||
if (tolower((unsigned char)*p) == 't') {
|
if (tolower((unsigned char)*p) == 't') {
|
||||||
@ -617,8 +616,9 @@ static const char *ecommunity_gettoken(const char *str, void *eval_ptr,
|
|||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/* "soo" match check. */
|
|
||||||
else if (tolower((unsigned char)*p) == 's') {
|
/* "soo" */
|
||||||
|
if (tolower((unsigned char)*p) == 's') {
|
||||||
p++;
|
p++;
|
||||||
if (tolower((unsigned char)*p) == 'o') {
|
if (tolower((unsigned char)*p) == 'o') {
|
||||||
p++;
|
p++;
|
||||||
@ -638,22 +638,17 @@ static const char *ecommunity_gettoken(const char *str, void *eval_ptr,
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
} else if (tolower((unsigned char)*p) == 'c') {
|
}
|
||||||
/* "color" match check.
|
|
||||||
* 'c', 'co', 'col', 'colo' are also accepted
|
/* "color" */
|
||||||
*/
|
if (tolower((unsigned char)*p) == 'c') {
|
||||||
for (i = 0; i < 5; i++) {
|
|
||||||
ptr_color = &str_color[0];
|
ptr_color = &str_color[0];
|
||||||
if (tolower((unsigned char)*p) == *ptr_color) {
|
for (unsigned int i = 0; i < 5; i++) {
|
||||||
|
if (tolower((unsigned char)*p) != *ptr_color)
|
||||||
|
break;
|
||||||
|
|
||||||
p++;
|
p++;
|
||||||
ptr_color++;
|
ptr_color++;
|
||||||
} else if (i > 0) {
|
|
||||||
if (isspace((unsigned char)*p) ||
|
|
||||||
*p == '\0') {
|
|
||||||
*token = ecommunity_token_color;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
if (isspace((unsigned char)*p) || *p == '\0') {
|
if (isspace((unsigned char)*p) || *p == '\0') {
|
||||||
*token = ecommunity_token_color;
|
*token = ecommunity_token_color;
|
||||||
@ -661,10 +656,6 @@ static const char *ecommunity_gettoken(const char *str, void *eval_ptr,
|
|||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
/* What a mess, there are several possibilities:
|
/* What a mess, there are several possibilities:
|
||||||
*
|
*
|
||||||
* a) A.B.C.D:MN
|
* a) A.B.C.D:MN
|
||||||
|
Loading…
Reference in New Issue
Block a user