@@ -7730,7 +7730,7 @@ static void bgp_purge_af_static_redist_routes(struct bgp *bgp, afi_t afi,
77307730{
77317731 struct bgp_table * table ;
77327732 struct bgp_dest * dest ;
7733- struct bgp_path_info * pi ;
7733+ struct bgp_path_info * pi , * next ;
77347734
77357735 /* Do not install the aggregate route if BGP is in the
77367736 * process of termination.
@@ -7741,7 +7741,8 @@ static void bgp_purge_af_static_redist_routes(struct bgp *bgp, afi_t afi,
77417741
77427742 table = bgp -> rib [afi ][safi ];
77437743 for (dest = bgp_table_top (table ); dest ; dest = bgp_route_next (dest )) {
7744- for (pi = bgp_dest_get_bgp_path_info (dest ); pi ; pi = pi -> next ) {
7744+ for (pi = bgp_dest_get_bgp_path_info (dest ); (pi != NULL ) && (next = pi -> next , 1 );
7745+ pi = next ) {
77457746 if (pi -> peer == bgp -> peer_self
77467747 && ((pi -> type == ZEBRA_ROUTE_BGP
77477748 && pi -> sub_type == BGP_ROUTE_STATIC )
@@ -8246,7 +8247,7 @@ void bgp_aggregate_toggle_suppressed(struct bgp_aggregate *aggregate,
82468247 struct bgp_table * table = bgp -> rib [afi ][safi ];
82478248 const struct prefix * dest_p ;
82488249 struct bgp_dest * dest , * top ;
8249- struct bgp_path_info * pi ;
8250+ struct bgp_path_info * pi , * next ;
82508251
82518252 /* We've found a different MED we must revert any suppressed routes. */
82528253 top = bgp_node_get (table , p );
@@ -8256,7 +8257,8 @@ void bgp_aggregate_toggle_suppressed(struct bgp_aggregate *aggregate,
82568257 if (dest_p -> prefixlen <= p -> prefixlen )
82578258 continue ;
82588259
8259- for (pi = bgp_dest_get_bgp_path_info (dest ); pi ; pi = pi -> next ) {
8260+ for (pi = bgp_dest_get_bgp_path_info (dest ); (pi != NULL ) && (next = pi -> next , 1 );
8261+ pi = next ) {
82608262 if (BGP_PATH_HOLDDOWN (pi ))
82618263 continue ;
82628264 if (pi -> sub_type == BGP_ROUTE_AGGREGATE )
@@ -8331,7 +8333,7 @@ bool bgp_aggregate_route(struct bgp *bgp, const struct prefix *p, afi_t afi,
83318333 struct community * community = NULL ;
83328334 struct ecommunity * ecommunity = NULL ;
83338335 struct lcommunity * lcommunity = NULL ;
8334- struct bgp_path_info * pi ;
8336+ struct bgp_path_info * pi , * next ;
83358337 uint8_t atomic_aggregate = 0 ;
83368338
83378339 /* If the bgp instance is being deleted or self peer is deleted
@@ -8381,7 +8383,8 @@ bool bgp_aggregate_route(struct bgp *bgp, const struct prefix *p, afi_t afi,
83818383 if (!bgp_check_advertise (bgp , dest , safi ))
83828384 continue ;
83838385
8384- for (pi = bgp_dest_get_bgp_path_info (dest ); pi ; pi = pi -> next ) {
8386+ for (pi = bgp_dest_get_bgp_path_info (dest ); (pi != NULL ) && (next = pi -> next , 1 );
8387+ pi = next ) {
83858388 if (BGP_PATH_HOLDDOWN (pi ))
83868389 continue ;
83878390
@@ -8539,7 +8542,7 @@ void bgp_aggregate_delete(struct bgp *bgp, const struct prefix *p, afi_t afi,
85398542 struct bgp_table * table ;
85408543 struct bgp_dest * top ;
85418544 struct bgp_dest * dest ;
8542- struct bgp_path_info * pi ;
8545+ struct bgp_path_info * pi , * next ;
85438546
85448547 table = bgp -> rib [afi ][safi ];
85458548
@@ -8552,7 +8555,8 @@ void bgp_aggregate_delete(struct bgp *bgp, const struct prefix *p, afi_t afi,
85528555 if (dest_p -> prefixlen <= p -> prefixlen )
85538556 continue ;
85548557
8555- for (pi = bgp_dest_get_bgp_path_info (dest ); pi ; pi = pi -> next ) {
8558+ for (pi = bgp_dest_get_bgp_path_info (dest ); (pi != NULL ) && (next = pi -> next , 1 );
8559+ pi = next ) {
85568560 if (BGP_PATH_HOLDDOWN (pi ))
85578561 continue ;
85588562
0 commit comments