]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Revert "bgpd: Drop double-pointer for bgp_damp_info_free()"
authorIgor Ryzhov <iryzhov@nfware.com>
Mon, 2 Aug 2021 10:01:32 +0000 (13:01 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 3 Aug 2021 18:54:47 +0000 (21:54 +0300)
This reverts commit 19971c9a9218b31e6e1c3f7ebb23654f833bb4ef.

bgpd/bgp_damp.c
bgpd/bgp_damp.h
bgpd/bgp_route.c

index 20dfef7598ecfb299393ed7534e8ae19e40b2d2d..21e42ae8202e87f67950a1e01eb808c003127465 100644 (file)
@@ -278,7 +278,7 @@ static int bgp_reuse_timer(struct thread *t)
                        }
 
                        if (bdi->penalty <= bdc->reuse_limit / 2.0) {
-                               bgp_damp_info_free(bdi, bdc, 1, bdi->afi,
+                               bgp_damp_info_free(&bdi, bdc, 1, bdi->afi,
                                                   bdi->safi);
                                bgp_reuselist_del(&plist, &node);
                        } else {
@@ -424,27 +424,27 @@ int bgp_damp_update(struct bgp_path_info *path, struct bgp_dest *dest,
                bdi->t_updated = t_now;
        else {
                bgp_damp_info_unclaim(bdi);
-               bgp_damp_info_free(bdi, bdc, 0, afi, safi);
+               bgp_damp_info_free(&bdi, bdc, 0, afi, safi);
        }
 
        return status;
 }
 
-void bgp_damp_info_free(struct bgp_damp_info *bdi, struct bgp_damp_config *bdc,
+void bgp_damp_info_free(struct bgp_damp_info **bdi, struct bgp_damp_config *bdc,
                        int withdraw, afi_t afi, safi_t safi)
 {
-       assert(bdc && bdi);
+       assert(bdc && bdi && *bdi);
 
-       if (bdi->path == NULL) {
-               XFREE(MTYPE_BGP_DAMP_INFO, bdi);
+       if ((*bdi)->path == NULL) {
+               XFREE(MTYPE_BGP_DAMP_INFO, (*bdi));
                return;
        }
 
-       bdi->path->extra->damp_info = NULL;
-       bgp_path_info_unset_flag(bdi->dest, bdi->path,
+       (*bdi)->path->extra->damp_info = NULL;
+       bgp_path_info_unset_flag((*bdi)->dest, (*bdi)->path,
                                 BGP_PATH_HISTORY | BGP_PATH_DAMPED);
-       if (bdi->lastrecord == BGP_RECORD_WITHDRAW && withdraw)
-               bgp_path_info_delete(bdi->dest, bdi->path);
+       if ((*bdi)->lastrecord == BGP_RECORD_WITHDRAW && withdraw)
+               bgp_path_info_delete((*bdi)->dest, (*bdi)->path);
 }
 
 static void bgp_damp_parameter_set(int hlife, int reuse, int sup, int maxsup,
@@ -558,14 +558,14 @@ void bgp_damp_info_clean(struct bgp *bgp, struct bgp_damp_config *bdc,
                                            bdi->safi);
                        }
                        bgp_reuselist_del(list, &rn);
-                       bgp_damp_info_free(bdi, bdc, 1, afi, safi);
+                       bgp_damp_info_free(&bdi, bdc, 1, afi, safi);
                }
        }
 
        while ((rn = SLIST_FIRST(&bdc->no_reuse_list)) != NULL) {
                bdi = rn->info;
                bgp_reuselist_del(&bdc->no_reuse_list, &rn);
-               bgp_damp_info_free(bdi, bdc, 1, afi, safi);
+               bgp_damp_info_free(&bdi, bdc, 1, afi, safi);
        }
 
        /* Free decay array */
index 8367f291c7f6aa9ca197011fb9f341da42740fc1..c03a0cc5c972a58eee1e3a34802caba416acc5b8 100644 (file)
@@ -148,7 +148,7 @@ extern int bgp_damp_withdraw(struct bgp_path_info *path, struct bgp_dest *dest,
                             afi_t afi, safi_t safi, int attr_change);
 extern int bgp_damp_update(struct bgp_path_info *path, struct bgp_dest *dest,
                           afi_t afi, safi_t saff);
-extern void bgp_damp_info_free(struct bgp_damp_info *bdi,
+extern void bgp_damp_info_free(struct bgp_damp_info **path,
                               struct bgp_damp_config *bdc, int withdraw,
                               afi_t afi, safi_t safi);
 extern void bgp_damp_info_clean(struct bgp *bgp, struct bgp_damp_config *bdc,
index f39386f7dd44966f18a96a528f8a76f18ce200c5..66ff16d53aab2294d8274585c376789f7fbe1fba 100644 (file)
@@ -14758,7 +14758,7 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
                                        if (pi->extra && pi->extra->damp_info) {
                                                pi_temp = pi->next;
                                                bgp_damp_info_free(
-                                                       pi->extra->damp_info,
+                                                       &pi->extra->damp_info,
                                                        &bgp->damp[afi][safi],
                                                        1, afi, safi);
                                                pi = pi_temp;
@@ -14796,7 +14796,7 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
                                                                    bdi->safi);
                                                }
                                                bgp_damp_info_free(
-                                                       pi->extra->damp_info,
+                                                       &pi->extra->damp_info,
                                                        &bgp->damp[afi][safi],
                                                        1, afi, safi);
                                                pi = pi_temp;