summaryrefslogtreecommitdiff
path: root/zebra/zebra_fpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_fpm.c')
-rw-r--r--zebra/zebra_fpm.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 10cdf49d12..8f97c8cf47 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -760,8 +760,9 @@ static int zfpm_read_cb(struct thread *thread)
if (nbyte == -1) {
char buffer[1024];
- sprintf(buffer, "closed socket in read(%d): %s",
- errno, safe_strerror(errno));
+ snprintf(buffer, sizeof(buffer),
+ "closed socket in read(%d): %s", errno,
+ safe_strerror(errno));
zfpm_connection_down(buffer);
} else
zfpm_connection_down("closed socket in read");
@@ -797,8 +798,9 @@ static int zfpm_read_cb(struct thread *thread)
if (nbyte == -1) {
char buffer[1024];
- sprintf(buffer, "failed to read message(%d) %s",
- errno, safe_strerror(errno));
+ snprintf(buffer, sizeof(buffer),
+ "failed to read message(%d) %s", errno,
+ safe_strerror(errno));
zfpm_connection_down(buffer);
} else
zfpm_connection_down("failed to read message");
@@ -1938,8 +1940,15 @@ static int fpm_remote_srv_write(struct vty *vty)
}
+static int fpm_remote_srv_write(struct vty *vty);
/* Zebra node */
-static struct cmd_node zebra_node = {ZEBRA_NODE, "", 1};
+static struct cmd_node zebra_node = {
+ .name = "zebra",
+ .node = ZEBRA_NODE,
+ .parent_node = CONFIG_NODE,
+ .prompt = "",
+ .config_write = fpm_remote_srv_write,
+};
/**
@@ -1976,7 +1985,7 @@ static int zfpm_init(struct thread_master *master)
zfpm_stats_init(&zfpm_g->last_ivl_stats);
zfpm_stats_init(&zfpm_g->cumulative_stats);
- install_node(&zebra_node, fpm_remote_srv_write);
+ install_node(&zebra_node);
install_element(ENABLE_NODE, &show_zebra_fpm_stats_cmd);
install_element(ENABLE_NODE, &clear_zebra_fpm_stats_cmd);
install_element(CONFIG_NODE, &fpm_remote_ip_cmd);