]> git.proxmox.com Git - mirror_frr.git/blobdiff - babeld/babel_main.c
Merge branch 'master' into bfd-final
[mirror_frr.git] / babeld / babel_main.c
index 6a8f9bb75f59f110e1362dde592d18614fa2ad9a..2b87bed0fb886b4b738473d4e84365f47749983b 100644 (file)
@@ -73,7 +73,6 @@ int protocol_port;                /* babel's port */
 int protocol_socket = -1;         /* socket: communicate with others babeld */
 
 static char babel_config_default[] = SYSCONFDIR BABEL_DEFAULT_CONFIG;
-static char *babel_config_file = NULL;
 static char *babel_vty_addr = NULL;
 static int babel_vty_port = BABEL_VTY_PORT;
 
@@ -84,7 +83,7 @@ static zebra_capabilities_t _caps_p [] =
     ZCAP_BIND
 };
 
-static struct zebra_privs_t babeld_privs =
+struct zebra_privs_t babeld_privs =
 {
 #if defined(FRR_USER)
     .user = FRR_USER,
@@ -197,9 +196,6 @@ main(int argc, char **argv)
     /* this replace kernel_setup && kernel_setup_socket */
     babelz_zebra_init ();
 
-    /* Get zebra configuration file. */
-    vty_read_config (babel_config_file, babel_config_default);
-
     /* init buffer */
     rc = resize_receive_buffer(1500);
     if(rc < 0)
@@ -279,8 +275,7 @@ babel_load_state_file(void)
     if(fd >= 0 && rc < 0) {
         zlog_err("unlink(babel-state): %s", safe_strerror(errno));
         /* If we couldn't unlink it, it's probably stale. */
-        close(fd);
-        fd = -1;
+        goto fini;
     }
     if(fd >= 0) {
         char buf[100];
@@ -315,9 +310,12 @@ babel_load_state_file(void)
                 zlog_err("Couldn't parse babel-state.");
             }
         }
-        close(fd);
-        fd = -1;
+        goto fini;
     }
+fini:
+    if (fd >= 0)
+        close(fd);
+    return ;
 }
 
 static void
@@ -387,7 +385,7 @@ show_babel_main_configuration (struct vty *vty)
             "id                      = %s\n"
             "kernel_metric           = %d\n",
             state_file,
-            babel_config_file ? babel_config_file : babel_config_default,
+            babeld_di.config_file ? babeld_di.config_file : babel_config_default,
             format_address(protocol_group),
             protocol_port,
             babel_vty_addr ? babel_vty_addr : "None",