diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-16 17:22:41 -0400 | 
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-17 13:58:24 -0400 | 
| commit | 7298a8e105b57925358cf90cd80a7037e5f83b93 (patch) | |
| tree | 91e1997b7b10d7fa9daa22cd0b54ce2991ffba25 | |
| parent | 0e9f8d2d8637b86889fc82ecca60d1b23bdfccfd (diff) | |
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>
| -rw-r--r-- | bgpd/bgp_clist.c | 28 | ||||
| -rw-r--r-- | bgpd/bgp_clist.h | 4 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 16 | 
3 files changed, 19 insertions, 29 deletions
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index 8f38f5765f..d1bc7f6e53 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -852,7 +852,7 @@ int community_list_set(struct community_list_handler *ch, const char *name,  /* Unset community-list */  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_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;  	/* Delete all of entry belongs to this community-list.  */ -	if (delete_all) { +	if (!str) {  		community_list_delete(list);  		route_map_notify_dependencies(name, RMAP_EVENT_CLIST_DELETED);  		return 0;  	} -	if (style == COMMUNITY_LIST_STANDARD) { -		if (str) -			com = community_str2com(str); -	} +	if (style == COMMUNITY_LIST_STANDARD) +		com = community_str2com(str);  	if (com) {  		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;  } -/* Unset extcommunity-list.  When str is NULL, delete all of -   extcommunity-list entry belongs to the specified name.  */ +/* Unset extcommunity-list. + * + * 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, -			    const char *str, int direct, int style, -			    int delete_all) +			    const char *str, int direct, int style)  {  	struct community_entry *entry = NULL;  	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;  	/* Delete all of entry belongs to this extcommunity-list.  */ -	if (delete_all) { +	if (!str) {  		community_list_delete(list);  		route_map_notify_dependencies(name, RMAP_EVENT_ECLIST_DELETED);  		return 0;  	} -	if (style == EXTCOMMUNITY_LIST_STANDARD) { -		if (str) -			ecom = ecommunity_str2com(str, 0, 1); -	} +	if (style == EXTCOMMUNITY_LIST_STANDARD) +		ecom = ecommunity_str2com(str, 0, 1);  	if (ecom) {  		entry = community_list_entry_lookup(list, ecom, direct); diff --git a/bgpd/bgp_clist.h b/bgpd/bgp_clist.h index 0dbde2a453..9efb34d7b9 100644 --- a/bgpd/bgp_clist.h +++ b/bgpd/bgp_clist.h @@ -133,13 +133,13 @@ extern int community_list_set(struct community_list_handler *ch,  			      int style);  extern int community_list_unset(struct community_list_handler *ch,  				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,  				 const char *name, const char *str, int direct,  				 int style);  extern int extcommunity_list_unset(struct community_list_handler *ch,  				   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,  			       const char *name, const char *str, int direct,  			       int style); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 17bb3fed96..6bc50fb77e 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -13206,8 +13206,6 @@ DEFUN (no_ip_community_list_standard_all,         "Specify community to accept\n"         COMMUNITY_VAL_STR)  { -	int delete_all = 0; -  	char *cl_name_or_number = NULL;  	int direct = 0;  	int style = COMMUNITY_LIST_STANDARD; @@ -13222,7 +13220,7 @@ DEFUN (no_ip_community_list_standard_all,  	char *str = argv_concat(argv, argc, idx);  	int ret = community_list_unset(bgp_clist, cl_name_or_number, str, -				       direct, style, delete_all); +				       direct, style);  	XFREE(MTYPE_TMP, str); @@ -13287,8 +13285,6 @@ DEFUN (no_ip_community_list_expanded_all,         "Specify community to accept\n"         COMMUNITY_VAL_STR)  { -	int delete_all = 0; -  	char *cl_name_or_number = NULL;  	int direct = 0;  	int style = COMMUNITY_LIST_EXPANDED; @@ -13303,7 +13299,7 @@ DEFUN (no_ip_community_list_expanded_all,  	char *str = argv_concat(argv, argc, idx);  	int ret = community_list_unset(bgp_clist, cl_name_or_number, str, -				       direct, style, delete_all); +				       direct, style);  	XFREE(MTYPE_TMP, str); @@ -13840,8 +13836,6 @@ DEFUN (no_ip_extcommunity_list_standard_all,         "Specify community to accept\n"         EXTCOMMUNITY_VAL_STR)  { -	int deleteall = 0; -  	int style = EXTCOMMUNITY_LIST_STANDARD;  	int direct = 0;  	char *cl_number_or_name = NULL; @@ -13856,7 +13850,7 @@ DEFUN (no_ip_extcommunity_list_standard_all,  	char *str = argv_concat(argv, argc, idx);  	int ret = extcommunity_list_unset(bgp_clist, cl_number_or_name, str, -					  direct, style, deleteall); +					  direct, style);  	XFREE(MTYPE_TMP, str); @@ -13881,8 +13875,6 @@ DEFUN (no_ip_extcommunity_list_expanded_all,         "Specify community to accept\n"         "An ordered list as a regular-expression\n")  { -	int deleteall = 0; -  	int style = EXTCOMMUNITY_LIST_EXPANDED;  	int direct = 0;  	char *cl_number_or_name = NULL; @@ -13897,7 +13889,7 @@ DEFUN (no_ip_extcommunity_list_expanded_all,  	char *str = argv_concat(argv, argc, idx);  	int ret = extcommunity_list_unset(bgp_clist, cl_number_or_name, str, -					  direct, style, deleteall); +					  direct, style);  	XFREE(MTYPE_TMP, str);  | 
