diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-05-31 01:23:15 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-06-04 16:37:19 +0200 |
commit | 0d675e49461483c6609c88221d036e751cd7e6d8 (patch) | |
tree | 210c5af23e13e590f687cbb17800e4f1b06ba9ac /ldpd | |
parent | bfdd: Allow -N to influence BFDD_CONTROL_SOCKET (diff) | |
download | frr-0d675e49461483c6609c88221d036e751cd7e6d8.tar.xz frr-0d675e49461483c6609c88221d036e751cd7e6d8.zip |
ldpd: Allow for -N <namespace> to influence location of LDPD_SOCKET
If --ctl_socket is used this will override any other option and will
be used
If -N <namespace> is used, then we will setup the LDPD_SOCKET
in $frr_statedir/<namespace>/ldpd.sock
If neither option is used, then we will use $frr_statedir/ldpd.sock
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/ldpd.c | 11 |
1 files changed, 10 insertions, 1 deletions
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)); |