From 3b7db17342b8c91a7dbc8fedb21c7b01532ada5a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 6 Jun 2018 12:46:14 -0400 Subject: [PATCH] bgpd: Move bgp_aggregate_delete to a better location The function bgp_aggregate_delete function was forward declared and not static. Move it so we can clean that up. Signed-off-by: Donald Sharp --- bgpd/bgp_route.c | 91 +++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 3d5513e0c..ed71f4197 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5610,8 +5610,50 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p, } } -void bgp_aggregate_delete(struct bgp *, struct prefix *, afi_t, safi_t, - struct bgp_aggregate *); +static void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi, + safi_t safi, struct bgp_aggregate *aggregate) +{ + struct bgp_table *table; + struct bgp_node *top; + struct bgp_node *rn; + struct bgp_info *ri; + unsigned long match; + + table = bgp->rib[afi][safi]; + + /* If routes exists below this node, generate aggregate routes. */ + top = bgp_node_get(table, p); + for (rn = bgp_node_get(table, p); rn; + rn = bgp_route_next_until(rn, top)) { + if (rn->p.prefixlen <= p->prefixlen) + continue; + match = 0; + + for (ri = rn->info; ri; ri = ri->next) { + if (BGP_INFO_HOLDDOWN(ri)) + continue; + + if (ri->sub_type == BGP_ROUTE_AGGREGATE) + continue; + + if (aggregate->summary_only && ri->extra) { + ri->extra->suppress--; + + if (ri->extra->suppress == 0) { + bgp_info_set_flag( + rn, ri, BGP_INFO_ATTR_CHANGED); + match++; + } + } + aggregate->count--; + } + + /* If this node was suppressed, process the change. */ + if (match) + bgp_process(bgp, rn, afi, safi); + } + bgp_unlock_node(top); +} void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p, struct bgp_info *ri, afi_t afi, safi_t safi) @@ -5783,51 +5825,6 @@ static void bgp_aggregate_add(struct bgp *bgp, struct prefix *p, afi_t afi, } } -void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi, - safi_t safi, struct bgp_aggregate *aggregate) -{ - struct bgp_table *table; - struct bgp_node *top; - struct bgp_node *rn; - struct bgp_info *ri; - unsigned long match; - - table = bgp->rib[afi][safi]; - - /* If routes exists below this node, generate aggregate routes. */ - top = bgp_node_get(table, p); - for (rn = bgp_node_get(table, p); rn; - rn = bgp_route_next_until(rn, top)) { - if (rn->p.prefixlen <= p->prefixlen) - continue; - match = 0; - - for (ri = rn->info; ri; ri = ri->next) { - if (BGP_INFO_HOLDDOWN(ri)) - continue; - - if (ri->sub_type == BGP_ROUTE_AGGREGATE) - continue; - - if (aggregate->summary_only && ri->extra) { - ri->extra->suppress--; - - if (ri->extra->suppress == 0) { - bgp_info_set_flag( - rn, ri, BGP_INFO_ATTR_CHANGED); - match++; - } - } - aggregate->count--; - } - - /* If this node was suppressed, process the change. */ - if (match) - bgp_process(bgp, rn, afi, safi); - } - bgp_unlock_node(top); -} - /* Aggregate route attribute. */ #define AGGREGATE_SUMMARY_ONLY 1 #define AGGREGATE_AS_SET 1 -- 2.39.5