@@ -8322,59 +8322,7 @@ static int bgp_aggregate_unset(struct vty *vty, const char *prefix_str,
8322
8322
/* Unlock aggregate address configuration. */
8323
8323
bgp_dest_set_bgp_aggregate_info (dest , NULL );
8324
8324
8325
- if (aggregate -> community )
8326
- community_free (& aggregate -> community );
8327
-
8328
- if (aggregate -> community_hash ) {
8329
- /* Delete all communities in the hash.
8330
- */
8331
- hash_clean (aggregate -> community_hash ,
8332
- bgp_aggr_community_remove );
8333
- /* Free up the community_hash.
8334
- */
8335
- hash_free (aggregate -> community_hash );
8336
- }
8337
-
8338
- if (aggregate -> ecommunity )
8339
- ecommunity_free (& aggregate -> ecommunity );
8340
-
8341
- if (aggregate -> ecommunity_hash ) {
8342
- /* Delete all ecommunities in the hash.
8343
- */
8344
- hash_clean (aggregate -> ecommunity_hash ,
8345
- bgp_aggr_ecommunity_remove );
8346
- /* Free up the ecommunity_hash.
8347
- */
8348
- hash_free (aggregate -> ecommunity_hash );
8349
- }
8350
-
8351
- if (aggregate -> lcommunity )
8352
- lcommunity_free (& aggregate -> lcommunity );
8353
-
8354
- if (aggregate -> lcommunity_hash ) {
8355
- /* Delete all lcommunities in the hash.
8356
- */
8357
- hash_clean (aggregate -> lcommunity_hash ,
8358
- bgp_aggr_lcommunity_remove );
8359
- /* Free up the lcommunity_hash.
8360
- */
8361
- hash_free (aggregate -> lcommunity_hash );
8362
- }
8363
-
8364
- if (aggregate -> aspath )
8365
- aspath_free (aggregate -> aspath );
8366
-
8367
- if (aggregate -> aspath_hash ) {
8368
- /* Delete all as-paths in the hash.
8369
- */
8370
- hash_clean (aggregate -> aspath_hash ,
8371
- bgp_aggr_aspath_remove );
8372
- /* Free up the aspath_hash.
8373
- */
8374
- hash_free (aggregate -> aspath_hash );
8375
- }
8376
-
8377
- bgp_aggregate_free (aggregate );
8325
+ bgp_free_aggregate_info (aggregate );
8378
8326
bgp_dest_unlock_node (dest );
8379
8327
bgp_dest_unlock_node (dest );
8380
8328
@@ -8555,6 +8503,63 @@ DEFPY(aggregate_addressv4, aggregate_addressv4_cmd,
8555
8503
match_med != NULL , suppress_map );
8556
8504
}
8557
8505
8506
+ void bgp_free_aggregate_info (struct bgp_aggregate * aggregate )
8507
+ {
8508
+ if (aggregate -> community )
8509
+ community_free (& aggregate -> community );
8510
+
8511
+ if (aggregate -> community_hash ) {
8512
+ /* Delete all communities in the hash.
8513
+ */
8514
+ hash_clean (aggregate -> community_hash ,
8515
+ bgp_aggr_community_remove );
8516
+ /* Free up the community_hash.
8517
+ */
8518
+ hash_free (aggregate -> community_hash );
8519
+ }
8520
+
8521
+ if (aggregate -> ecommunity )
8522
+ ecommunity_free (& aggregate -> ecommunity );
8523
+
8524
+ if (aggregate -> ecommunity_hash ) {
8525
+ /* Delete all ecommunities in the hash.
8526
+ */
8527
+ hash_clean (aggregate -> ecommunity_hash ,
8528
+ bgp_aggr_ecommunity_remove );
8529
+ /* Free up the ecommunity_hash.
8530
+ */
8531
+ hash_free (aggregate -> ecommunity_hash );
8532
+ }
8533
+
8534
+ if (aggregate -> lcommunity )
8535
+ lcommunity_free (& aggregate -> lcommunity );
8536
+
8537
+ if (aggregate -> lcommunity_hash ) {
8538
+ /* Delete all lcommunities in the hash.
8539
+ */
8540
+ hash_clean (aggregate -> lcommunity_hash ,
8541
+ bgp_aggr_lcommunity_remove );
8542
+ /* Free up the lcommunity_hash.
8543
+ */
8544
+ hash_free (aggregate -> lcommunity_hash );
8545
+ }
8546
+
8547
+ if (aggregate -> aspath )
8548
+ aspath_free (aggregate -> aspath );
8549
+
8550
+ if (aggregate -> aspath_hash ) {
8551
+ /* Delete all as-paths in the hash.
8552
+ */
8553
+ hash_clean (aggregate -> aspath_hash ,
8554
+ bgp_aggr_aspath_remove );
8555
+ /* Free up the aspath_hash.
8556
+ */
8557
+ hash_free (aggregate -> aspath_hash );
8558
+ }
8559
+
8560
+ bgp_aggregate_free (aggregate );
8561
+ }
8562
+
8558
8563
DEFPY (aggregate_addressv6 , aggregate_addressv6_cmd ,
8559
8564
"[no] aggregate-address X:X::X:X/M$prefix [{"
8560
8565
"as-set$as_set_s"
0 commit comments