mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 15:18:06 +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,83 +584,75 @@ 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++;
|
||||||
|
if (tolower((unsigned char)*p) == 't') {
|
||||||
p++;
|
p++;
|
||||||
if (tolower((unsigned char)*p) == 't') {
|
if (*p != '\0' && tolower((int)*p) == '6')
|
||||||
p++;
|
*token = ecommunity_token_rt6;
|
||||||
if (*p != '\0' && tolower((int)*p) == '6')
|
else
|
||||||
*token = ecommunity_token_rt6;
|
|
||||||
else
|
|
||||||
*token = ecommunity_token_rt;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
if (isspace((unsigned char)*p) || *p == '\0') {
|
|
||||||
*token = ecommunity_token_rt;
|
*token = ecommunity_token_rt;
|
||||||
return p;
|
return p;
|
||||||
}
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
/* "nt" match check. */
|
if (isspace((unsigned char)*p) || *p == '\0') {
|
||||||
if (tolower((unsigned char)*p) == 'n') {
|
*token = ecommunity_token_rt;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "nt" */
|
||||||
|
if (tolower((unsigned char)*p) == 'n') {
|
||||||
|
p++;
|
||||||
|
if (tolower((unsigned char)*p) == 't') {
|
||||||
p++;
|
p++;
|
||||||
if (tolower((unsigned char)*p) == 't') {
|
*token = ecommunity_token_nt;
|
||||||
p++;
|
return p;
|
||||||
*token = ecommunity_token_nt;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
if (isspace((unsigned char)*p) || *p == '\0') {
|
|
||||||
*token = ecommunity_token_nt;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
/* "soo" match check. */
|
if (isspace((unsigned char)*p) || *p == '\0') {
|
||||||
else if (tolower((unsigned char)*p) == 's') {
|
*token = ecommunity_token_nt;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "soo" */
|
||||||
|
if (tolower((unsigned char)*p) == 's') {
|
||||||
|
p++;
|
||||||
|
if (tolower((unsigned char)*p) == 'o') {
|
||||||
p++;
|
p++;
|
||||||
if (tolower((unsigned char)*p) == 'o') {
|
if (tolower((unsigned char)*p) == 'o') {
|
||||||
p++;
|
p++;
|
||||||
if (tolower((unsigned char)*p) == 'o') {
|
*token = ecommunity_token_soo;
|
||||||
p++;
|
return p;
|
||||||
*token = ecommunity_token_soo;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
if (isspace((unsigned char)*p) || *p == '\0') {
|
|
||||||
*token = ecommunity_token_soo;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
if (isspace((unsigned char)*p) || *p == '\0') {
|
if (isspace((unsigned char)*p) || *p == '\0') {
|
||||||
*token = ecommunity_token_soo;
|
*token = ecommunity_token_soo;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
} else if (tolower((unsigned char)*p) == 'c') {
|
}
|
||||||
/* "color" match check.
|
if (isspace((unsigned char)*p) || *p == '\0') {
|
||||||
* 'c', 'co', 'col', 'colo' are also accepted
|
*token = ecommunity_token_soo;
|
||||||
*/
|
return p;
|
||||||
for (i = 0; i < 5; i++) {
|
}
|
||||||
ptr_color = &str_color[0];
|
goto error;
|
||||||
if (tolower((unsigned char)*p) == *ptr_color) {
|
}
|
||||||
p++;
|
|
||||||
ptr_color++;
|
/* "color" */
|
||||||
} else if (i > 0) {
|
if (tolower((unsigned char)*p) == 'c') {
|
||||||
if (isspace((unsigned char)*p) ||
|
ptr_color = &str_color[0];
|
||||||
*p == '\0') {
|
for (unsigned int i = 0; i < 5; i++) {
|
||||||
*token = ecommunity_token_color;
|
if (tolower((unsigned char)*p) != *ptr_color)
|
||||||
return p;
|
break;
|
||||||
}
|
|
||||||
goto error;
|
p++;
|
||||||
}
|
ptr_color++;
|
||||||
if (isspace((unsigned char)*p) || *p == '\0') {
|
}
|
||||||
*token = ecommunity_token_color;
|
if (isspace((unsigned char)*p) || *p == '\0') {
|
||||||
return p;
|
*token = ecommunity_token_color;
|
||||||
}
|
return p;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user