diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-05-31 01:38:00 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-06-04 16:37:19 +0200 |
commit | 3c649c719f327725ebd85643ff07f18e95ecb2b5 (patch) | |
tree | e44e61b7851644887f51c7c8e1a37fa1acfa7bce | |
parent | ldpd: Allow for -N <namespace> to influence location of LDPD_SOCKET (diff) | |
download | frr-3c649c719f327725ebd85643ff07f18e95ecb2b5.tar.xz frr-3c649c719f327725ebd85643ff07f18e95ecb2b5.zip |
*: Convert to using frr_vtydir instead of DAEMON_VTY_DIR
In a variety of places we are using DAEMON_VTY_DIR, convert
to use frr_vtydir. This will allow us in a future commit
to have the -N namespace option be automatically used.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r-- | babeld/babel_main.c | 5 | ||||
-rw-r--r-- | watchfrr/watchfrr.c | 5 | ||||
-rw-r--r-- | zebra/kernel_netlink.c | 3 | ||||
-rw-r--r-- | zebra/zapi_msg.c | 2 |
4 files changed, 10 insertions, 5 deletions
diff --git a/babeld/babel_main.c b/babeld/babel_main.c index eaff97a49..6e2d4ecea 100644 --- a/babeld/babel_main.c +++ b/babeld/babel_main.c @@ -68,7 +68,7 @@ const unsigned char ones[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; -static const char *state_file = DAEMON_VTY_DIR "/babel-state"; +static char state_file[512]; unsigned char protocol_group[16]; /* babel's link-local multicast address */ int protocol_port; /* babel's port */ @@ -187,6 +187,9 @@ main(int argc, char **argv) } } + snprintf(state_file, sizeof(state_file), "%s/%s", + frr_vtydir, "babel-state"); + /* create the threads handler */ master = frr_init (); diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 34f8dabdf..f0ce88a5b 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -648,6 +648,7 @@ static void daemon_send_ready(int exitcode) { FILE *fp; static int sent = 0; + char started[512]; if (sent) return; @@ -669,7 +670,9 @@ static void daemon_send_ready(int exitcode) frr_detach(); - fp = fopen(DAEMON_VTY_DIR "/watchfrr.started", "w"); + snprintf(started, sizeof(started), "%s%s", frr_vtydir, + "watchfrr.started"); + fp = fopen(started, "w"); if (fp) fclose(fp); #if defined HAVE_SYSTEMD diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index fe37a3335..387a3531b 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -340,8 +340,7 @@ static void netlink_write_incoming(const char *buf, const unsigned int size, char fname[MAXPATHLEN]; FILE *f; - snprintf(fname, MAXPATHLEN, "%s/%s_%u", DAEMON_VTY_DIR, "netlink", - counter); + snprintf(fname, MAXPATHLEN, "%s/%s_%u", frr_vtydir, "netlink", counter); frr_elevate_privs(&zserv_privs) { f = fopen(fname, "w"); } diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 49e43f494..61200806b 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -2526,7 +2526,7 @@ static void zserv_write_incoming(struct stream *orig, uint16_t command) copy = stream_dup(orig); stream_set_getp(copy, 0); - snprintf(fname, MAXPATHLEN, "%s/%u", DAEMON_VTY_DIR, command); + snprintf(fname, MAXPATHLEN, "%s/%u", frr_vtydir, command); frr_elevate_privs(&zserv_privs) { fd = open(fname, O_CREAT | O_WRONLY | O_EXCL, 0644); |