]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: router-id change notify to restart ospf6d 1754/head
authorChirag Shah <chirag@cumulusnetworks.com>
Mon, 12 Feb 2018 21:22:04 +0000 (13:22 -0800)
committerChirag Shah <chirag@cumulusnetworks.com>
Thu, 15 Feb 2018 17:57:05 +0000 (09:57 -0800)
Notify user to store config and restart ospf6d
as part of router-id change cli if any of
the area active.
Store zebra router-id under ospf6, when static
router-id removed restore zebra router-id, ask
to restart ospf6d.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
ospf6d/ospf6_area.h
ospf6d/ospf6_neighbor.c
ospf6d/ospf6_top.c
ospf6d/ospf6_top.h
ospf6d/ospf6_zebra.c

index b7cd9b4b09af703a939abb1284110c5841636286..e162d21cd25f27fbb2b9145f80ed2cce1c4e686e 100644 (file)
@@ -99,6 +99,8 @@ struct ospf6_area {
 
        /* Time stamps. */
        struct timeval ts_spf; /* SPF calculation time stamp. */
+
+       uint32_t full_nbrs; /* Fully adjacent neighbors. */
 };
 
 #define OSPF6_AREA_ENABLE     0x01
index 35d0b0a6462918af0861e457f05280b1947abb20..05bc254951baee01d9ab9034beb762587033a2b9 100644 (file)
@@ -193,7 +193,11 @@ static void ospf6_neighbor_state_change(u_char next_state,
                if (prev_state == OSPF6_NEIGHBOR_LOADING &&
                    next_state == OSPF6_NEIGHBOR_FULL) {
                        OSPF6_AS_EXTERN_LSA_SCHEDULE(on->ospf6_if);
+                       on->ospf6_if->area->full_nbrs++;
                }
+
+               if (prev_state == OSPF6_NEIGHBOR_FULL)
+                       on->ospf6_if->area->full_nbrs--;
        }
 
        if ((prev_state == OSPF6_NEIGHBOR_EXCHANGE
index db39420548c1785792bdca46b2ced064e0224978..c17b8918ec9166e997e2bc798936ad7a779ed2f2 100644 (file)
@@ -335,6 +335,8 @@ DEFUN(ospf6_router_id,
        int ret;
        const char *router_id_str;
        u_int32_t router_id;
+       struct ospf6_area *oa;
+       struct listnode *node;
 
        argv_find(argv, argc, "A.B.C.D", &idx);
        router_id_str = argv[idx]->arg;
@@ -346,8 +348,17 @@ DEFUN(ospf6_router_id,
        }
 
        o->router_id_static = router_id;
-       if (o->router_id == 0)
-               o->router_id = router_id;
+
+       for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) {
+               if (oa->full_nbrs) {
+                       vty_out(vty,
+                               "For this router-id change to take effect,"
+                               " save config and restart ospf6d\n");
+                       return CMD_SUCCESS;
+               }
+       }
+
+       o->router_id = router_id;
 
        return CMD_SUCCESS;
 }
@@ -360,8 +371,22 @@ DEFUN(no_ospf6_router_id,
       V4NOTATION_STR)
 {
        VTY_DECLVAR_CONTEXT(ospf6, o);
+       struct ospf6_area *oa;
+       struct listnode *node;
+
        o->router_id_static = 0;
+
+       for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) {
+               if (oa->full_nbrs) {
+                       vty_out(vty,
+                               "For this router-id change to take effect,"
+                               " save config and restart ospf6d\n");
+                       return CMD_SUCCESS;
+               }
+       }
        o->router_id = 0;
+       if (o->router_id_zebra.s_addr)
+               o->router_id = (uint32_t)o->router_id_zebra.s_addr;
 
        return CMD_SUCCESS;
 }
index 8f99cc33f42a9a5aae5dc09719b4aedf6285f973..d7a3766b80498676b255c183f66c2d9473a0d16c 100644 (file)
@@ -32,6 +32,8 @@ struct ospf6 {
        /* static router id */
        u_int32_t router_id_static;
 
+       struct in_addr router_id_zebra;
+
        /* start time */
        struct timeval starttime;
 
index cc87c499ee50af6e502bf382aa7907365adae65e..4fb959b952e63dbf64c0741878e9a7c1058e8587 100644 (file)
@@ -46,8 +46,6 @@ unsigned char conf_debug_ospf6_zebra = 0;
 /* information about zebra. */
 struct zclient *zclient = NULL;
 
-struct in_addr router_id_zebra;
-
 /* Router-id update message from zebra. */
 static int ospf6_router_id_update_zebra(int command, struct zclient *zclient,
                                        zebra_size_t length, vrf_id_t vrf_id)
@@ -56,13 +54,14 @@ static int ospf6_router_id_update_zebra(int command, struct zclient *zclient,
        struct ospf6 *o = ospf6;
 
        zebra_router_id_update_read(zclient->ibuf, &router_id);
-       router_id_zebra = router_id.u.prefix4;
 
        if (o == NULL)
                return 0;
 
+       o->router_id_zebra = router_id.u.prefix4;
+
        if (o->router_id == 0)
-               o->router_id = (u_int32_t)router_id_zebra.s_addr;
+               o->router_id = (uint32_t)o->router_id_zebra.s_addr;
 
        return 0;
 }