]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/ldpd.c
Merge pull request #2932 from donaldsharp/ferr_fix
[mirror_frr.git] / ldpd / ldpd.c
index b265c98dae3d43d990d246807035a576f8016d03..935e959596587dbed50e960ac28f62b02ec9d66f 100644 (file)
@@ -42,6 +42,7 @@
 #include "filter.h"
 #include "qobj.h"
 #include "libfrr.h"
+#include "lib_errors.h"
 
 static void             ldpd_shutdown(void);
 static pid_t            start_child(enum ldpd_process, char *, int, int);
@@ -187,6 +188,22 @@ FRR_DAEMON_INFO(ldpd, LDP,
        .privs = &ldpd_privs,
 )
 
+static int ldp_config_fork_apply(struct thread *t)
+{
+       /*
+        * So the frr_config_fork() function schedules
+        * the read of the vty config( if there is a
+        * non-integrated config ) to be after the
+        * end of startup and we are starting the
+        * main process loop.  We need to schedule
+        * the application of this if necessary
+        * after the read in of the config.
+        */
+       ldp_config_apply(NULL, vty_conf);
+
+       return 0;
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -195,6 +212,7 @@ main(int argc, char *argv[])
        int                      pipe_parent2ldpe[2], pipe_parent2ldpe_sync[2];
        int                      pipe_parent2lde[2], pipe_parent2lde_sync[2];
        char                    *ctl_sock_name;
+       struct thread           *thread = NULL;
 
        ldpd_process = PROC_MAIN;
        log_procname = log_procnames[ldpd_process];
@@ -312,7 +330,7 @@ main(int argc, char *argv[])
        master = frr_init();
 
        vty_config_lockless();
-       vrf_init(NULL, NULL, NULL, NULL);
+       vrf_init(NULL, NULL, NULL, NULL, NULL);
        access_list_init();
        ldp_vty_init();
        ldp_zebra_init(master);
@@ -331,7 +349,7 @@ main(int argc, char *argv[])
        frr_config_fork();
 
        /* apply configuration */
-       ldp_config_apply(NULL, vty_conf);
+       thread_add_event(master, ldp_config_fork_apply, NULL, 0, &thread);
 
        /* setup pipes to children */
        if ((iev_ldpe = calloc(1, sizeof(struct imsgev))) == NULL ||
@@ -466,8 +484,9 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync)
 
        nullfd = open("/dev/null", O_RDONLY | O_NOCTTY);
        if (nullfd == -1) {
-               zlog_err("%s: failed to open /dev/null: %s", __func__,
-                        safe_strerror(errno));
+               flog_err_sys(LIB_ERR_SYSTEM_CALL,
+                            "%s: failed to open /dev/null: %s", __func__,
+                            safe_strerror(errno));
        } else {
                dup2(nullfd, 0);
                dup2(nullfd, 1);