summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_top.c
diff options
context:
space:
mode:
authorChirag Shah <chirag@cumulusnetworks.com>2018-02-27 11:24:16 -0800
committerChirag Shah <chirag@cumulusnetworks.com>2018-03-01 14:19:15 -0800
commit78c6ba61db8a84d1d262a9896e81bea97976753c (patch)
tree607d9fa931ef2de7d3653cc4c27399f4d157f485 /ospf6d/ospf6_top.c
parentc98f4d81aa5d4113ceea58ce6db4bebab5c99735 (diff)
ospf6d: assign zebra router-id to ospf6 instance
Store zebra router-id in global structure. Before router ospf6 instance created, zebra router-id callback called. During ospf6 main execution zebra init happens, but default instance does not execute until cli replay 'router ospf6'. Call ospf6_router_id_change during 'router ospf6' to assign zebra router id to ospf6 instance. Ticket:CM-19937 Testing Done: Assign Loopback /32 (6.6.6.6/32) address, restart frr with (router ospf6 in frr.conf). ospf6 default instance assigned 6.6.6.6 router-id. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'ospf6d/ospf6_top.c')
-rw-r--r--ospf6d/ospf6_top.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 25d968fb68..28379458d2 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -53,6 +53,8 @@ DEFINE_QOBJ_TYPE(ospf6)
/* global ospf6d variable */
struct ospf6 *ospf6;
+static struct ospf6_master ospf6_master;
+struct ospf6_master *om6;
static void ospf6_disable(struct ospf6 *o);
@@ -230,6 +232,13 @@ static void ospf6_disable(struct ospf6 *o)
}
}
+void ospf6_master_init(void)
+{
+ memset(&ospf6_master, 0, sizeof(struct ospf6_master));
+
+ om6 = &ospf6_master;
+}
+
static int ospf6_maxage_remover(struct thread *thread)
{
struct ospf6 *o = (struct ospf6 *)THREAD_ARG(thread);
@@ -285,6 +294,17 @@ void ospf6_maxage_remove(struct ospf6 *o)
&o->maxage_remover);
}
+void ospf6_router_id_update(void)
+{
+ if (!ospf6)
+ return;
+
+ if (ospf6->router_id_static != 0)
+ ospf6->router_id = ospf6->router_id_static;
+ else
+ ospf6->router_id = om6->zebra_router_id;
+}
+
/* start ospf6 */
DEFUN_NOSH (router_ospf6,
router_ospf6_cmd,
@@ -292,9 +312,11 @@ DEFUN_NOSH (router_ospf6,
ROUTER_STR
OSPF6_STR)
{
- if (ospf6 == NULL)
+ if (ospf6 == NULL) {
ospf6 = ospf6_create();
-
+ if (ospf6->router_id == 0)
+ ospf6_router_id_update();
+ }
/* set current ospf point. */
VTY_PUSH_CONTEXT(OSPF6_NODE, ospf6);