]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/ldpd.c
lib, zebra: add new MPLS zapi message with route replace semantics
[mirror_frr.git] / ldpd / ldpd.c
index 137d9622d545d4a612940b494f06d68779237f1a..a6f0519bd72940330c1524ba0ff13ce3c6fab1ba 100644 (file)
@@ -116,7 +116,7 @@ struct zebra_privs_t ldpd_privs =
 };
 
 /* CTL Socket path */
-char ctl_sock_path[MAXPATHLEN] = LDPD_SOCKET;
+char ctl_sock_path[MAXPATHLEN];
 
 /* LDPd options. */
 #define OPTION_CTLSOCK 1001
@@ -138,7 +138,7 @@ sighup(void)
         * and build a new configuartion from scratch.
         */
        ldp_config_reset(vty_conf);
-       vty_read_config(ldpd_di.config_file, config_default);
+       vty_read_config(NULL, ldpd_di.config_file, config_default);
        ldp_config_apply(NULL, vty_conf);
 }
 
@@ -177,6 +177,9 @@ static struct quagga_signal_t ldp_signals[] =
        }
 };
 
+static const struct frr_yang_module_info *ldpd_yang_modules[] = {
+};
+
 FRR_DAEMON_INFO(ldpd, LDP,
        .vty_port = LDP_VTY_PORT,
 
@@ -186,6 +189,9 @@ FRR_DAEMON_INFO(ldpd, LDP,
        .n_signals = array_size(ldp_signals),
 
        .privs = &ldpd_privs,
+
+       .yang_modules = ldpd_yang_modules,
+       .n_yang_modules = array_size(ldpd_yang_modules),
 )
 
 static int ldp_config_fork_apply(struct thread *t)
@@ -213,6 +219,10 @@ main(int argc, char *argv[])
        int                      pipe_parent2lde[2], pipe_parent2lde_sync[2];
        char                    *ctl_sock_name;
        struct thread           *thread = NULL;
+       bool                    ctl_sock_used = false;
+
+       snprintf(ctl_sock_path, sizeof(ctl_sock_path), LDPD_SOCKET,
+                "", "");
 
        ldpd_process = PROC_MAIN;
        log_procname = log_procnames[ldpd_process];
@@ -226,6 +236,9 @@ main(int argc, char *argv[])
                "      --ctl_socket   Override ctl socket path\n"
                "  -n, --instance     Instance id\n");
 
+       /* set default instance (to differentiate ldpd socket from lde one */
+       init.instance = 1;
+
        while (1) {
                int opt;
 
@@ -238,6 +251,7 @@ main(int argc, char *argv[])
                case 0:
                        break;
                case OPTION_CTLSOCK:
+                       ctl_sock_used = true;
                        ctl_sock_name = strrchr(LDPD_SOCKET, '/');
                        if (ctl_sock_name)
                                /* skip '/' */
@@ -271,6 +285,10 @@ main(int argc, char *argv[])
                }
        }
 
+       if (ldpd_di.pathspace && !ctl_sock_used)
+               snprintf(ctl_sock_path, sizeof(ctl_sock_path), LDPD_SOCKET,
+                        "/", ldpd_di.pathspace);
+
        strlcpy(init.user, ldpd_privs.user, sizeof(init.user));
        strlcpy(init.group, ldpd_privs.group, sizeof(init.group));
        strlcpy(init.ctl_sock_path, ctl_sock_path, sizeof(init.ctl_sock_path));
@@ -329,7 +347,6 @@ main(int argc, char *argv[])
 
        master = frr_init();
 
-       vty_config_lockless();
        vrf_init(NULL, NULL, NULL, NULL, NULL);
        access_list_init();
        ldp_vty_init();
@@ -433,7 +450,7 @@ ldpd_shutdown(void)
                        if (errno == EINTR)
                                continue;
                        /* No more processes were found. */
-                       if (errno != ECHILD)
+                       if (errno == ECHILD)
                                break;
 
                        /* Unhandled errno condition. */