mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 18:56:40 +00:00
bgpd: clean up clist management logic
* Remove unused parameter * Restore behavior described by function comment * Eliminate NPD caught by static analysis Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
0e9f8d2d86
commit
7298a8e105
@ -852,7 +852,7 @@ int community_list_set(struct community_list_handler *ch, const char *name,
|
|||||||
|
|
||||||
/* Unset community-list */
|
/* Unset community-list */
|
||||||
int community_list_unset(struct community_list_handler *ch, const char *name,
|
int community_list_unset(struct community_list_handler *ch, const char *name,
|
||||||
const char *str, int direct, int style, int delete_all)
|
const char *str, int direct, int style)
|
||||||
{
|
{
|
||||||
struct community_entry *entry = NULL;
|
struct community_entry *entry = NULL;
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
@ -864,16 +864,14 @@ int community_list_unset(struct community_list_handler *ch, const char *name,
|
|||||||
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
||||||
|
|
||||||
/* Delete all of entry belongs to this community-list. */
|
/* Delete all of entry belongs to this community-list. */
|
||||||
if (delete_all) {
|
if (!str) {
|
||||||
community_list_delete(list);
|
community_list_delete(list);
|
||||||
route_map_notify_dependencies(name, RMAP_EVENT_CLIST_DELETED);
|
route_map_notify_dependencies(name, RMAP_EVENT_CLIST_DELETED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style == COMMUNITY_LIST_STANDARD) {
|
if (style == COMMUNITY_LIST_STANDARD)
|
||||||
if (str)
|
com = community_str2com(str);
|
||||||
com = community_str2com(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (com) {
|
if (com) {
|
||||||
entry = community_list_entry_lookup(list, com, direct);
|
entry = community_list_entry_lookup(list, com, direct);
|
||||||
@ -1117,11 +1115,13 @@ int extcommunity_list_set(struct community_list_handler *ch, const char *name,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unset extcommunity-list. When str is NULL, delete all of
|
/* Unset extcommunity-list.
|
||||||
extcommunity-list entry belongs to the specified name. */
|
*
|
||||||
|
* When str is NULL, delete all extcommunity-list entries belonging to the
|
||||||
|
* specified name.
|
||||||
|
*/
|
||||||
int extcommunity_list_unset(struct community_list_handler *ch, const char *name,
|
int extcommunity_list_unset(struct community_list_handler *ch, const char *name,
|
||||||
const char *str, int direct, int style,
|
const char *str, int direct, int style)
|
||||||
int delete_all)
|
|
||||||
{
|
{
|
||||||
struct community_entry *entry = NULL;
|
struct community_entry *entry = NULL;
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
@ -1133,16 +1133,14 @@ int extcommunity_list_unset(struct community_list_handler *ch, const char *name,
|
|||||||
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
return COMMUNITY_LIST_ERR_CANT_FIND_LIST;
|
||||||
|
|
||||||
/* Delete all of entry belongs to this extcommunity-list. */
|
/* Delete all of entry belongs to this extcommunity-list. */
|
||||||
if (delete_all) {
|
if (!str) {
|
||||||
community_list_delete(list);
|
community_list_delete(list);
|
||||||
route_map_notify_dependencies(name, RMAP_EVENT_ECLIST_DELETED);
|
route_map_notify_dependencies(name, RMAP_EVENT_ECLIST_DELETED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style == EXTCOMMUNITY_LIST_STANDARD) {
|
if (style == EXTCOMMUNITY_LIST_STANDARD)
|
||||||
if (str)
|
ecom = ecommunity_str2com(str, 0, 1);
|
||||||
ecom = ecommunity_str2com(str, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ecom) {
|
if (ecom) {
|
||||||
entry = community_list_entry_lookup(list, ecom, direct);
|
entry = community_list_entry_lookup(list, ecom, direct);
|
||||||
|
@ -133,13 +133,13 @@ extern int community_list_set(struct community_list_handler *ch,
|
|||||||
int style);
|
int style);
|
||||||
extern int community_list_unset(struct community_list_handler *ch,
|
extern int community_list_unset(struct community_list_handler *ch,
|
||||||
const char *name, const char *str, int direct,
|
const char *name, const char *str, int direct,
|
||||||
int style, int delete_all);
|
int style);
|
||||||
extern int extcommunity_list_set(struct community_list_handler *ch,
|
extern int extcommunity_list_set(struct community_list_handler *ch,
|
||||||
const char *name, const char *str, int direct,
|
const char *name, const char *str, int direct,
|
||||||
int style);
|
int style);
|
||||||
extern int extcommunity_list_unset(struct community_list_handler *ch,
|
extern int extcommunity_list_unset(struct community_list_handler *ch,
|
||||||
const char *name, const char *str,
|
const char *name, const char *str,
|
||||||
int direct, int style, int delete_all);
|
int direct, int style);
|
||||||
extern int lcommunity_list_set(struct community_list_handler *ch,
|
extern int lcommunity_list_set(struct community_list_handler *ch,
|
||||||
const char *name, const char *str, int direct,
|
const char *name, const char *str, int direct,
|
||||||
int style);
|
int style);
|
||||||
|
@ -13206,8 +13206,6 @@ DEFUN (no_ip_community_list_standard_all,
|
|||||||
"Specify community to accept\n"
|
"Specify community to accept\n"
|
||||||
COMMUNITY_VAL_STR)
|
COMMUNITY_VAL_STR)
|
||||||
{
|
{
|
||||||
int delete_all = 0;
|
|
||||||
|
|
||||||
char *cl_name_or_number = NULL;
|
char *cl_name_or_number = NULL;
|
||||||
int direct = 0;
|
int direct = 0;
|
||||||
int style = COMMUNITY_LIST_STANDARD;
|
int style = COMMUNITY_LIST_STANDARD;
|
||||||
@ -13222,7 +13220,7 @@ DEFUN (no_ip_community_list_standard_all,
|
|||||||
char *str = argv_concat(argv, argc, idx);
|
char *str = argv_concat(argv, argc, idx);
|
||||||
|
|
||||||
int ret = community_list_unset(bgp_clist, cl_name_or_number, str,
|
int ret = community_list_unset(bgp_clist, cl_name_or_number, str,
|
||||||
direct, style, delete_all);
|
direct, style);
|
||||||
|
|
||||||
XFREE(MTYPE_TMP, str);
|
XFREE(MTYPE_TMP, str);
|
||||||
|
|
||||||
@ -13287,8 +13285,6 @@ DEFUN (no_ip_community_list_expanded_all,
|
|||||||
"Specify community to accept\n"
|
"Specify community to accept\n"
|
||||||
COMMUNITY_VAL_STR)
|
COMMUNITY_VAL_STR)
|
||||||
{
|
{
|
||||||
int delete_all = 0;
|
|
||||||
|
|
||||||
char *cl_name_or_number = NULL;
|
char *cl_name_or_number = NULL;
|
||||||
int direct = 0;
|
int direct = 0;
|
||||||
int style = COMMUNITY_LIST_EXPANDED;
|
int style = COMMUNITY_LIST_EXPANDED;
|
||||||
@ -13303,7 +13299,7 @@ DEFUN (no_ip_community_list_expanded_all,
|
|||||||
char *str = argv_concat(argv, argc, idx);
|
char *str = argv_concat(argv, argc, idx);
|
||||||
|
|
||||||
int ret = community_list_unset(bgp_clist, cl_name_or_number, str,
|
int ret = community_list_unset(bgp_clist, cl_name_or_number, str,
|
||||||
direct, style, delete_all);
|
direct, style);
|
||||||
|
|
||||||
XFREE(MTYPE_TMP, str);
|
XFREE(MTYPE_TMP, str);
|
||||||
|
|
||||||
@ -13840,8 +13836,6 @@ DEFUN (no_ip_extcommunity_list_standard_all,
|
|||||||
"Specify community to accept\n"
|
"Specify community to accept\n"
|
||||||
EXTCOMMUNITY_VAL_STR)
|
EXTCOMMUNITY_VAL_STR)
|
||||||
{
|
{
|
||||||
int deleteall = 0;
|
|
||||||
|
|
||||||
int style = EXTCOMMUNITY_LIST_STANDARD;
|
int style = EXTCOMMUNITY_LIST_STANDARD;
|
||||||
int direct = 0;
|
int direct = 0;
|
||||||
char *cl_number_or_name = NULL;
|
char *cl_number_or_name = NULL;
|
||||||
@ -13856,7 +13850,7 @@ DEFUN (no_ip_extcommunity_list_standard_all,
|
|||||||
char *str = argv_concat(argv, argc, idx);
|
char *str = argv_concat(argv, argc, idx);
|
||||||
|
|
||||||
int ret = extcommunity_list_unset(bgp_clist, cl_number_or_name, str,
|
int ret = extcommunity_list_unset(bgp_clist, cl_number_or_name, str,
|
||||||
direct, style, deleteall);
|
direct, style);
|
||||||
|
|
||||||
XFREE(MTYPE_TMP, str);
|
XFREE(MTYPE_TMP, str);
|
||||||
|
|
||||||
@ -13881,8 +13875,6 @@ DEFUN (no_ip_extcommunity_list_expanded_all,
|
|||||||
"Specify community to accept\n"
|
"Specify community to accept\n"
|
||||||
"An ordered list as a regular-expression\n")
|
"An ordered list as a regular-expression\n")
|
||||||
{
|
{
|
||||||
int deleteall = 0;
|
|
||||||
|
|
||||||
int style = EXTCOMMUNITY_LIST_EXPANDED;
|
int style = EXTCOMMUNITY_LIST_EXPANDED;
|
||||||
int direct = 0;
|
int direct = 0;
|
||||||
char *cl_number_or_name = NULL;
|
char *cl_number_or_name = NULL;
|
||||||
@ -13897,7 +13889,7 @@ DEFUN (no_ip_extcommunity_list_expanded_all,
|
|||||||
char *str = argv_concat(argv, argc, idx);
|
char *str = argv_concat(argv, argc, idx);
|
||||||
|
|
||||||
int ret = extcommunity_list_unset(bgp_clist, cl_number_or_name, str,
|
int ret = extcommunity_list_unset(bgp_clist, cl_number_or_name, str,
|
||||||
direct, style, deleteall);
|
direct, style);
|
||||||
|
|
||||||
XFREE(MTYPE_TMP, str);
|
XFREE(MTYPE_TMP, str);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user