summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure.ac2
-rw-r--r--ldpd/ldpd.c11
2 files changed, 11 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 5d17071fb..631d847b9 100755
--- a/configure.ac
+++ b/configure.ac
@@ -2202,7 +2202,7 @@ fi
AC_MSG_RESULT([${frr_statedir}])
AC_SUBST([frr_statedir])
-AC_DEFINE_UNQUOTED([LDPD_SOCKET], ["$frr_statedir/ldpd.sock"], [ldpd control socket])
+AC_DEFINE_UNQUOTED([LDPD_SOCKET], ["$frr_statedir%s%s/ldpd.sock"], [ldpd control socket])
AC_DEFINE_UNQUOTED([ZEBRA_SERV_PATH], ["$frr_statedir%s%s/zserv.api"], [zebra api socket])
AC_DEFINE_UNQUOTED([BFDD_CONTROL_SOCKET], ["$frr_statedir%s%s/bfdd.sock"], [bfdd control socket])
AC_DEFINE_UNQUOTED([DAEMON_VTY_DIR], ["$frr_statedir"], [daemon vty directory])
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 771d3b745..5aaa2ec32 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -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
@@ -219,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];
@@ -244,6 +248,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 '/' */
@@ -277,6 +282,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));