]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix crash in the MH cleanup handling
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Thu, 10 Sep 2020 20:51:56 +0000 (13:51 -0700)
committerAnuradha Karuppiah <anuradhak@nvidia.com>
Fri, 26 Mar 2021 02:24:39 +0000 (19:24 -0700)
The MH datastructures were being released before the paths that were
referencing them. Fix is to do the MH cleanup last.

The MH finish function has also been stripped down to only do a
datastructure cleanup i.e. avoid sending route updates etc.

Ticket: 31376

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
bgpd/bgp_evpn_mh.c

index dcdb1626c440572bd91df836cbc0fcacf07b5ce4..41644d360629745117a3f7a053a453328a3a2053 100644 (file)
@@ -1681,7 +1681,7 @@ static void bgp_evpn_es_local_info_set(struct bgp *bgp, struct bgp_evpn_es *es)
 }
 
 /* clear any local info associated with the ES */
-static void bgp_evpn_es_local_info_clear(struct bgp_evpn_es *es)
+static void bgp_evpn_es_local_info_clear(struct bgp_evpn_es *es, bool finish)
 {
        bool old_is_local;
        bool is_local;
@@ -1693,7 +1693,7 @@ static void bgp_evpn_es_local_info_clear(struct bgp_evpn_es *es)
        UNSET_FLAG(es->flags, BGP_EVPNES_LOCAL);
 
        is_local = bgp_evpn_is_es_local_and_non_bypass(es);
-       if (old_is_local != is_local)
+       if (!finish && (old_is_local != is_local))
                bgp_evpn_mac_update_on_es_local_chg(es, is_local);
 
        /* remove from the ES local list */
@@ -2012,7 +2012,7 @@ static void bgp_evpn_local_es_do_del(struct bgp *bgp, struct bgp_evpn_es *es)
        /* Clear local info associated with the ES and free it up if there is
         * no remote reference
         */
-       bgp_evpn_es_local_info_clear(es);
+       bgp_evpn_es_local_info_clear(es, false);
 }
 
 bool bgp_evpn_is_esi_local_and_non_bypass(esi_t *esi)
@@ -4662,7 +4662,7 @@ void bgp_evpn_mh_finish(void)
 
        RB_FOREACH_SAFE (es, bgp_es_rb_head, &bgp_mh_info->es_rb_tree,
                         es_next) {
-               bgp_evpn_es_local_info_clear(es);
+               bgp_evpn_es_local_info_clear(es, true);
        }
        if (bgp_mh_info->t_cons_check)
                thread_cancel(&bgp_mh_info->t_cons_check);