summaryrefslogtreecommitdiffstats
path: root/ldpd/control.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-01-24 18:31:40 +0100
committerMartin Winter <mwinter@opensourcerouting.org>2017-01-25 18:44:42 +0100
commit372b8bd381661d6df8ff6d2b96da31d653a6f16b (patch)
tree52ea53a421206f250f6fa962d3e369d3e5f0c457 /ldpd/control.c
parentvtysh: Use HOME environment variable to get homedir and only fallback to pass... (diff)
downloadfrr-372b8bd381661d6df8ff6d2b96da31d653a6f16b.tar.xz
frr-372b8bd381661d6df8ff6d2b96da31d653a6f16b.zip
ldpd: add ctl_socket cli option to override the compiled-in location for the control socket
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd/control.c')
-rw-r--r--ldpd/control.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ldpd/control.c b/ldpd/control.c
index ba303cc12..8a2280be0 100644
--- a/ldpd/control.c
+++ b/ldpd/control.c
@@ -51,28 +51,28 @@ control_init(void)
memset(&s_un, 0, sizeof(s_un));
s_un.sun_family = AF_UNIX;
- strlcpy(s_un.sun_path, LDPD_SOCKET, sizeof(s_un.sun_path));
+ strlcpy(s_un.sun_path, ctl_sock_path, sizeof(s_un.sun_path));
- if (unlink(LDPD_SOCKET) == -1)
+ if (unlink(ctl_sock_path) == -1)
if (errno != ENOENT) {
- log_warn("%s: unlink %s", __func__, LDPD_SOCKET);
+ log_warn("%s: unlink %s", __func__, ctl_sock_path);
close(fd);
return (-1);
}
old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
if (bind(fd, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
- log_warn("%s: bind: %s", __func__, LDPD_SOCKET);
+ log_warn("%s: bind: %s", __func__, ctl_sock_path);
close(fd);
umask(old_umask);
return (-1);
}
umask(old_umask);
- if (chmod(LDPD_SOCKET, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) {
+ if (chmod(ctl_sock_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) {
log_warn("%s: chmod", __func__);
close(fd);
- (void)unlink(LDPD_SOCKET);
+ (void)unlink(ctl_sock_path);
return (-1);
}
@@ -97,7 +97,7 @@ control_cleanup(void)
{
accept_del(control_fd);
close(control_fd);
- unlink(LDPD_SOCKET);
+ unlink(ctl_sock_path);
}
/* ARGSUSED */