diff options
Diffstat (limited to 'bgpd/bgp_route.c')
| -rw-r--r-- | bgpd/bgp_route.c | 111 |
1 files changed, 58 insertions, 53 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 94f9e5b1e7..ebb6a5b909 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8322,59 +8322,7 @@ static int bgp_aggregate_unset(struct vty *vty, const char *prefix_str, /* Unlock aggregate address configuration. */ bgp_dest_set_bgp_aggregate_info(dest, NULL); - if (aggregate->community) - community_free(&aggregate->community); - - if (aggregate->community_hash) { - /* Delete all communities in the hash. - */ - hash_clean(aggregate->community_hash, - bgp_aggr_community_remove); - /* Free up the community_hash. - */ - hash_free(aggregate->community_hash); - } - - if (aggregate->ecommunity) - ecommunity_free(&aggregate->ecommunity); - - if (aggregate->ecommunity_hash) { - /* Delete all ecommunities in the hash. - */ - hash_clean(aggregate->ecommunity_hash, - bgp_aggr_ecommunity_remove); - /* Free up the ecommunity_hash. - */ - hash_free(aggregate->ecommunity_hash); - } - - if (aggregate->lcommunity) - lcommunity_free(&aggregate->lcommunity); - - if (aggregate->lcommunity_hash) { - /* Delete all lcommunities in the hash. - */ - hash_clean(aggregate->lcommunity_hash, - bgp_aggr_lcommunity_remove); - /* Free up the lcommunity_hash. - */ - hash_free(aggregate->lcommunity_hash); - } - - if (aggregate->aspath) - aspath_free(aggregate->aspath); - - if (aggregate->aspath_hash) { - /* Delete all as-paths in the hash. - */ - hash_clean(aggregate->aspath_hash, - bgp_aggr_aspath_remove); - /* Free up the aspath_hash. - */ - hash_free(aggregate->aspath_hash); - } - - bgp_aggregate_free(aggregate); + bgp_free_aggregate_info(aggregate); bgp_dest_unlock_node(dest); bgp_dest_unlock_node(dest); @@ -8555,6 +8503,63 @@ DEFPY(aggregate_addressv4, aggregate_addressv4_cmd, match_med != NULL, suppress_map); } +void bgp_free_aggregate_info(struct bgp_aggregate *aggregate) +{ + if (aggregate->community) + community_free(&aggregate->community); + + if (aggregate->community_hash) { + /* Delete all communities in the hash. + */ + hash_clean(aggregate->community_hash, + bgp_aggr_community_remove); + /* Free up the community_hash. + */ + hash_free(aggregate->community_hash); + } + + if (aggregate->ecommunity) + ecommunity_free(&aggregate->ecommunity); + + if (aggregate->ecommunity_hash) { + /* Delete all ecommunities in the hash. + */ + hash_clean(aggregate->ecommunity_hash, + bgp_aggr_ecommunity_remove); + /* Free up the ecommunity_hash. + */ + hash_free(aggregate->ecommunity_hash); + } + + if (aggregate->lcommunity) + lcommunity_free(&aggregate->lcommunity); + + if (aggregate->lcommunity_hash) { + /* Delete all lcommunities in the hash. + */ + hash_clean(aggregate->lcommunity_hash, + bgp_aggr_lcommunity_remove); + /* Free up the lcommunity_hash. + */ + hash_free(aggregate->lcommunity_hash); + } + + if (aggregate->aspath) + aspath_free(aggregate->aspath); + + if (aggregate->aspath_hash) { + /* Delete all as-paths in the hash. + */ + hash_clean(aggregate->aspath_hash, + bgp_aggr_aspath_remove); + /* Free up the aspath_hash. + */ + hash_free(aggregate->aspath_hash); + } + + bgp_aggregate_free(aggregate); +} + DEFPY(aggregate_addressv6, aggregate_addressv6_cmd, "[no] aggregate-address X:X::X:X/M$prefix [{" "as-set$as_set_s" |
