The self-neighbor on virtual-liks must be rebuilt
because the neighbor index, which is the router-id,
is changed.

Signed-off-by: Feng Lu <[email protected]>
---
 ospfd/ospfd.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index c55bdae..5993bc0 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -112,8 +112,21 @@ ospf_router_id_update (struct ospf *ospf)
   if (!IPV4_ADDR_SAME (&router_id_old, &router_id))
     {
       for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
-        /* Update self-neighbor's router_id. */
-        oi->nbr_self->router_id = router_id;
+        {
+          /* Update self-neighbor's router_id. */
+          if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+            {
+              /* The pseudo neighbor must be reset for virtual-links,
+               * because the neighbor index, which is the router-id,
+               * is changed.
+               */
+              ospf_nbr_delete (oi->nbr_self);
+              oi->nbr_self = ospf_nbr_new (oi);
+              ospf_nbr_add_self (oi);
+            }
+          else
+            oi->nbr_self->router_id = router_id;
+        }
 
       /* If AS-external-LSA is queued, then flush those LSAs. */
       if (router_id_old.s_addr == 0 && ospf->external_origin)
-- 
1.7.4.4


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to