mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-28 17:12:33 +00:00
bgpd: entry->any is never true
The only places entry->any could ever be set to true was
when str was NULL. Unfortunately with the way our CLI works
str is impossible to be NonNULL. The entry->any value *used*
to work prior to commit e961923c72
but it was changed back in 2016 and no-one has noticed the changed
ability.
Let's just admit that there are no users of this and remove this
dead code.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
0889f6d894
commit
75aaf03ff3
@ -659,9 +659,6 @@ bool community_list_match(struct community *com, struct community_list *list)
|
|||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
|
|
||||||
for (entry = list->head; entry; entry = entry->next) {
|
for (entry = list->head; entry; entry = entry->next) {
|
||||||
if (entry->any)
|
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
|
||||||
|
|
||||||
if (entry->style == COMMUNITY_LIST_STANDARD) {
|
if (entry->style == COMMUNITY_LIST_STANDARD) {
|
||||||
if (community_include(entry->u.com, COMMUNITY_INTERNET))
|
if (community_include(entry->u.com, COMMUNITY_INTERNET))
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
return entry->direct == COMMUNITY_PERMIT;
|
||||||
@ -681,9 +678,6 @@ bool lcommunity_list_match(struct lcommunity *lcom, struct community_list *list)
|
|||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
|
|
||||||
for (entry = list->head; entry; entry = entry->next) {
|
for (entry = list->head; entry; entry = entry->next) {
|
||||||
if (entry->any)
|
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
|
||||||
|
|
||||||
if (entry->style == LARGE_COMMUNITY_LIST_STANDARD) {
|
if (entry->style == LARGE_COMMUNITY_LIST_STANDARD) {
|
||||||
if (lcommunity_match(lcom, entry->u.lcom))
|
if (lcommunity_match(lcom, entry->u.lcom))
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
return entry->direct == COMMUNITY_PERMIT;
|
||||||
@ -705,9 +699,6 @@ bool lcommunity_list_exact_match(struct lcommunity *lcom,
|
|||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
|
|
||||||
for (entry = list->head; entry; entry = entry->next) {
|
for (entry = list->head; entry; entry = entry->next) {
|
||||||
if (entry->any)
|
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
|
||||||
|
|
||||||
if (entry->style == LARGE_COMMUNITY_LIST_STANDARD) {
|
if (entry->style == LARGE_COMMUNITY_LIST_STANDARD) {
|
||||||
if (lcommunity_cmp(lcom, entry->u.lcom))
|
if (lcommunity_cmp(lcom, entry->u.lcom))
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
return entry->direct == COMMUNITY_PERMIT;
|
||||||
@ -724,9 +715,6 @@ bool ecommunity_list_match(struct ecommunity *ecom, struct community_list *list)
|
|||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
|
|
||||||
for (entry = list->head; entry; entry = entry->next) {
|
for (entry = list->head; entry; entry = entry->next) {
|
||||||
if (entry->any)
|
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
|
||||||
|
|
||||||
if (entry->style == EXTCOMMUNITY_LIST_STANDARD) {
|
if (entry->style == EXTCOMMUNITY_LIST_STANDARD) {
|
||||||
if (ecommunity_match(ecom, entry->u.ecom))
|
if (ecommunity_match(ecom, entry->u.ecom))
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
return entry->direct == COMMUNITY_PERMIT;
|
||||||
@ -746,9 +734,6 @@ bool community_list_exact_match(struct community *com,
|
|||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
|
|
||||||
for (entry = list->head; entry; entry = entry->next) {
|
for (entry = list->head; entry; entry = entry->next) {
|
||||||
if (entry->any)
|
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
|
||||||
|
|
||||||
if (entry->style == COMMUNITY_LIST_STANDARD) {
|
if (entry->style == COMMUNITY_LIST_STANDARD) {
|
||||||
if (community_include(entry->u.com, COMMUNITY_INTERNET))
|
if (community_include(entry->u.com, COMMUNITY_INTERNET))
|
||||||
return entry->direct == COMMUNITY_PERMIT;
|
return entry->direct == COMMUNITY_PERMIT;
|
||||||
@ -781,27 +766,17 @@ struct community *community_list_match_delete(struct community *com,
|
|||||||
val = community_val_get(com, i);
|
val = community_val_get(com, i);
|
||||||
|
|
||||||
for (entry = list->head; entry; entry = entry->next) {
|
for (entry = list->head; entry; entry = entry->next) {
|
||||||
if (entry->any) {
|
if ((entry->style == COMMUNITY_LIST_STANDARD) &&
|
||||||
|
(community_include(entry->u.com,
|
||||||
|
COMMUNITY_INTERNET) ||
|
||||||
|
community_include(entry->u.com, val))) {
|
||||||
if (entry->direct == COMMUNITY_PERMIT) {
|
if (entry->direct == COMMUNITY_PERMIT) {
|
||||||
com_index_to_delete[delete_index] = i;
|
com_index_to_delete[delete_index] = i;
|
||||||
delete_index++;
|
delete_index++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
} else if ((entry->style == COMMUNITY_LIST_EXPANDED) &&
|
||||||
|
community_regexp_include(entry->reg, com,
|
||||||
else if ((entry->style == COMMUNITY_LIST_STANDARD)
|
|
||||||
&& (community_include(entry->u.com,
|
|
||||||
COMMUNITY_INTERNET)
|
|
||||||
|| community_include(entry->u.com, val))) {
|
|
||||||
if (entry->direct == COMMUNITY_PERMIT) {
|
|
||||||
com_index_to_delete[delete_index] = i;
|
|
||||||
delete_index++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ((entry->style == COMMUNITY_LIST_EXPANDED)
|
|
||||||
&& community_regexp_include(entry->reg, com,
|
|
||||||
i)) {
|
i)) {
|
||||||
if (entry->direct == COMMUNITY_PERMIT) {
|
if (entry->direct == COMMUNITY_PERMIT) {
|
||||||
com_index_to_delete[delete_index] = i;
|
com_index_to_delete[delete_index] = i;
|
||||||
@ -836,12 +811,6 @@ static bool community_list_dup_check(struct community_list *list,
|
|||||||
if (entry->direct != new->direct)
|
if (entry->direct != new->direct)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (entry->any != new->any)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (entry->any)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
switch (entry->style) {
|
switch (entry->style) {
|
||||||
case COMMUNITY_LIST_STANDARD:
|
case COMMUNITY_LIST_STANDARD:
|
||||||
if (community_cmp(entry->u.com, new->u.com))
|
if (community_cmp(entry->u.com, new->u.com))
|
||||||
@ -910,7 +879,6 @@ int community_list_set(struct community_list_handler *ch, const char *name,
|
|||||||
entry = community_entry_new();
|
entry = community_entry_new();
|
||||||
entry->direct = direct;
|
entry->direct = direct;
|
||||||
entry->style = style;
|
entry->style = style;
|
||||||
entry->any = (str ? false : true);
|
|
||||||
entry->u.com = com;
|
entry->u.com = com;
|
||||||
entry->reg = regex;
|
entry->reg = regex;
|
||||||
entry->seq = seqnum;
|
entry->seq = seqnum;
|
||||||
@ -987,7 +955,8 @@ struct lcommunity *lcommunity_list_match_delete(struct lcommunity *lcom,
|
|||||||
for (i = 0; i < lcom->size; i++) {
|
for (i = 0; i < lcom->size; i++) {
|
||||||
ptr = lcom->val + (i * LCOMMUNITY_SIZE);
|
ptr = lcom->val + (i * LCOMMUNITY_SIZE);
|
||||||
for (entry = list->head; entry; entry = entry->next) {
|
for (entry = list->head; entry; entry = entry->next) {
|
||||||
if (entry->any) {
|
if ((entry->style == LARGE_COMMUNITY_LIST_STANDARD) &&
|
||||||
|
lcommunity_include(entry->u.lcom, ptr)) {
|
||||||
if (entry->direct == COMMUNITY_PERMIT) {
|
if (entry->direct == COMMUNITY_PERMIT) {
|
||||||
com_index_to_delete[delete_index] = i;
|
com_index_to_delete[delete_index] = i;
|
||||||
delete_index++;
|
delete_index++;
|
||||||
@ -995,17 +964,9 @@ struct lcommunity *lcommunity_list_match_delete(struct lcommunity *lcom,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ((entry->style == LARGE_COMMUNITY_LIST_STANDARD)
|
else if ((entry->style ==
|
||||||
&& lcommunity_include(entry->u.lcom, ptr)) {
|
LARGE_COMMUNITY_LIST_EXPANDED) &&
|
||||||
if (entry->direct == COMMUNITY_PERMIT) {
|
lcommunity_regexp_include(entry->reg, lcom,
|
||||||
com_index_to_delete[delete_index] = i;
|
|
||||||
delete_index++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ((entry->style == LARGE_COMMUNITY_LIST_EXPANDED)
|
|
||||||
&& lcommunity_regexp_include(entry->reg, lcom,
|
|
||||||
i)) {
|
i)) {
|
||||||
if (entry->direct == COMMUNITY_PERMIT) {
|
if (entry->direct == COMMUNITY_PERMIT) {
|
||||||
com_index_to_delete[delete_index] = i;
|
com_index_to_delete[delete_index] = i;
|
||||||
@ -1125,7 +1086,6 @@ int lcommunity_list_set(struct community_list_handler *ch, const char *name,
|
|||||||
entry = community_entry_new();
|
entry = community_entry_new();
|
||||||
entry->direct = direct;
|
entry->direct = direct;
|
||||||
entry->style = style;
|
entry->style = style;
|
||||||
entry->any = (str ? false : true);
|
|
||||||
entry->u.lcom = lcom;
|
entry->u.lcom = lcom;
|
||||||
entry->reg = regex;
|
entry->reg = regex;
|
||||||
entry->seq = seqnum;
|
entry->seq = seqnum;
|
||||||
@ -1246,7 +1206,6 @@ int extcommunity_list_set(struct community_list_handler *ch, const char *name,
|
|||||||
entry = community_entry_new();
|
entry = community_entry_new();
|
||||||
entry->direct = direct;
|
entry->direct = direct;
|
||||||
entry->style = style;
|
entry->style = style;
|
||||||
entry->any = false;
|
|
||||||
if (ecom)
|
if (ecom)
|
||||||
entry->config = ecommunity_ecom2str(
|
entry->config = ecommunity_ecom2str(
|
||||||
ecom, ECOMMUNITY_FORMAT_COMMUNITY_LIST, 0);
|
ecom, ECOMMUNITY_FORMAT_COMMUNITY_LIST, 0);
|
||||||
|
@ -65,9 +65,6 @@ struct community_entry {
|
|||||||
/* Standard or expanded. */
|
/* Standard or expanded. */
|
||||||
uint8_t style;
|
uint8_t style;
|
||||||
|
|
||||||
/* Any match. */
|
|
||||||
bool any;
|
|
||||||
|
|
||||||
/* Sequence number. */
|
/* Sequence number. */
|
||||||
int64_t seq;
|
int64_t seq;
|
||||||
|
|
||||||
|
@ -20863,16 +20863,13 @@ static const char *community_list_config_str(struct community_entry *entry)
|
|||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
if (entry->any)
|
|
||||||
str = "";
|
|
||||||
else {
|
|
||||||
if (entry->style == COMMUNITY_LIST_STANDARD)
|
if (entry->style == COMMUNITY_LIST_STANDARD)
|
||||||
str = community_str(entry->u.com, false, false);
|
str = community_str(entry->u.com, false, false);
|
||||||
else if (entry->style == LARGE_COMMUNITY_LIST_STANDARD)
|
else if (entry->style == LARGE_COMMUNITY_LIST_STANDARD)
|
||||||
str = lcommunity_str(entry->u.lcom, false, false);
|
str = lcommunity_str(entry->u.lcom, false, false);
|
||||||
else
|
else
|
||||||
str = entry->config;
|
str = entry->config;
|
||||||
}
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20895,12 +20892,7 @@ static void community_list_show(struct vty *vty, struct community_list *list)
|
|||||||
: "expanded",
|
: "expanded",
|
||||||
list->name);
|
list->name);
|
||||||
}
|
}
|
||||||
if (entry->any)
|
vty_out(vty, " %s %s\n", community_direct_str(entry->direct),
|
||||||
vty_out(vty, " %s\n",
|
|
||||||
community_direct_str(entry->direct));
|
|
||||||
else
|
|
||||||
vty_out(vty, " %s %s\n",
|
|
||||||
community_direct_str(entry->direct),
|
|
||||||
community_list_config_str(entry));
|
community_list_config_str(entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21260,12 +21252,7 @@ static void lcommunity_list_show(struct vty *vty, struct community_list *list)
|
|||||||
: "expanded",
|
: "expanded",
|
||||||
list->name);
|
list->name);
|
||||||
}
|
}
|
||||||
if (entry->any)
|
vty_out(vty, " %s %s\n", community_direct_str(entry->direct),
|
||||||
vty_out(vty, " %s\n",
|
|
||||||
community_direct_str(entry->direct));
|
|
||||||
else
|
|
||||||
vty_out(vty, " %s %s\n",
|
|
||||||
community_direct_str(entry->direct),
|
|
||||||
community_list_config_str(entry));
|
community_list_config_str(entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21562,12 +21549,7 @@ static void extcommunity_list_show(struct vty *vty, struct community_list *list)
|
|||||||
: "expanded",
|
: "expanded",
|
||||||
list->name);
|
list->name);
|
||||||
}
|
}
|
||||||
if (entry->any)
|
vty_out(vty, " %s %s\n", community_direct_str(entry->direct),
|
||||||
vty_out(vty, " %s\n",
|
|
||||||
community_direct_str(entry->direct));
|
|
||||||
else
|
|
||||||
vty_out(vty, " %s %s\n",
|
|
||||||
community_direct_str(entry->direct),
|
|
||||||
community_list_config_str(entry));
|
community_list_config_str(entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user