From: Christian Franke Date: Wed, 10 Jul 2013 11:56:18 +0000 (+0000) Subject: ospfd: run DR election prior to LSA regeneration X-Git-Tag: frr-2.0-rc1~1607 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7a9d983e4f961c2103f2cf82a51d5d8321ad0e43;p=mirror%2Ffrr.git ospfd: run DR election prior to LSA regeneration The results from DR election are used when constructing router-LSAs. E.g. they are used to determine whether a broadcast interface should be added with a link type of stub interface or transit interface. Therefore, we should run DR election prior before regenerating LSAs. Before commit c363d3861b5384a31465a72ddc3b0f6ff007a95a the DR election was called synchronously prior to router-LSA regeneration which was run asynchronously. This fixes bug #761 on the Quagga bugzilla. Signed-off-by: Christian Franke Acked-by: Feng Lu Signed-off-by: David Lamparter --- diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index fe4ddf5b2a..bcabd5f701 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -661,6 +661,25 @@ nsm_change_state (struct ospf_neighbor *nbr, int state) if (oi->type == OSPF_IFTYPE_VIRTUALLINK) vl_area = ospf_area_lookup_by_area_id (oi->ospf, oi->vl_data->vl_area_id); + /* Generate NeighborChange ISM event. + * + * In response to NeighborChange, DR election is rerun. The information + * from the election process is required by the router-lsa construction. + * + * Therefore, trigger the event prior to refreshing the LSAs. */ + switch (oi->state) { + case ISM_DROther: + case ISM_Backup: + case ISM_DR: + if ((old_state < NSM_TwoWay && state >= NSM_TwoWay) || + (old_state >= NSM_TwoWay && state < NSM_TwoWay)) + OSPF_ISM_EVENT_EXECUTE (oi, ISM_NeighborChange); + break; + default: + /* ISM_PointToPoint -> ISM_Down, ISM_Loopback -> ISM_Down, etc. */ + break; + } + /* One of the neighboring routers changes to/from the FULL state. */ if ((old_state != NSM_Full && state == NSM_Full) || (old_state == NSM_Full && state != NSM_Full)) @@ -760,20 +779,6 @@ nsm_change_state (struct ospf_neighbor *nbr, int state) if (state == NSM_Down) nbr->crypt_seqnum = 0; - /* Generete NeighborChange ISM event. */ - switch (oi->state) { - case ISM_DROther: - case ISM_Backup: - case ISM_DR: - if ((old_state < NSM_TwoWay && state >= NSM_TwoWay) || - (old_state >= NSM_TwoWay && state < NSM_TwoWay)) - OSPF_ISM_EVENT_EXECUTE (oi, ISM_NeighborChange); - break; - default: - /* ISM_PointToPoint -> ISM_Down, ISM_Loopback -> ISM_Down, etc. */ - break; - } - /* Preserve old status? */ }