summaryrefslogtreecommitdiff
path: root/ospfd/ospf_main.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-02-06 07:27:27 -0500
committerGitHub <noreply@github.com>2020-02-06 07:27:27 -0500
commit49fbe066404cb46705d4e7f6fe80796cb41b172a (patch)
tree49ce058e12ade324b0217898e97b5fcf197ed851 /ospfd/ospf_main.c
parent85c58de7732d72d063efc930708fca7302ccf8a1 (diff)
parent128f16f90e017edfefc49d2e09ed06a654f1940c (diff)
Merge pull request #5765 from Spantik/bugs
OSPF: Multi instance broken
Diffstat (limited to 'ospfd/ospf_main.c')
-rw-r--r--ospfd/ospf_main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c
index 7caa79d207..9cde64bc38 100644
--- a/ospfd/ospf_main.c
+++ b/ospfd/ospf_main.c
@@ -143,6 +143,7 @@ FRR_DAEMON_INFO(ospfd, OSPF, .vty_port = OSPF_VTY_PORT,
int main(int argc, char **argv)
{
unsigned short instance = 0;
+ bool created = false;
#ifdef SUPPORT_OSPF_API
/* OSPF apiserver is disabled by default. */
@@ -219,6 +220,17 @@ int main(int argc, char **argv)
/* OSPF errors init */
ospf_error_init();
+ /*
+ * Need to initialize the default ospf structure, so the interface mode
+ * commands can be duly processed if they are received before 'router
+ * ospf', when ospfd is restarted
+ */
+ if (instance && !ospf_get_instance(instance, &created)) {
+ flog_err(EC_OSPF_INIT_FAIL, "OSPF instance init failed: %s",
+ strerror(errno));
+ exit(1);
+ }
+
frr_config_fork();
frr_run(master);