summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dhcp/dhcp6_ia_na_client_cp.c25
-rw-r--r--src/plugins/dhcp/dhcp6_pd_client_cp.c25
-rw-r--r--src/plugins/hs_apps/vcl/sock_test_client.c4
-rw-r--r--src/plugins/hs_apps/vcl/sock_test_server.c3
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_client.c8
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_server.c2
6 files changed, 39 insertions, 28 deletions
diff --git a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
index b48559929e4..4d59f607fe1 100644
--- a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
+++ b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
@@ -557,8 +557,8 @@ dhcp6_clients_show_command_function (vlib_main_t * vm,
clib_error_t *error = 0;
client_state_t *cs;
f64 current_time = vlib_time_now (vm);
- char buf1[256];
- char buf2[256];
+ u8 *buf1 = 0;
+ u8 *buf2 = 0;
const char *rebinding;
u32 i;
@@ -567,26 +567,28 @@ dhcp6_clients_show_command_function (vlib_main_t * vm,
cs = &rm->client_state_by_sw_if_index[i];
if (cs->enabled)
{
+ vec_reset_length (buf1);
+ vec_reset_length (buf2);
if (cs->T1_due_time != DBL_MAX && cs->T1_due_time > current_time)
{
- sprintf (buf1, "%u remaining",
- (u32) round (cs->T1_due_time - current_time));
+ buf1 = format (buf1, "%u remaining",
+ (u32) round (cs->T1_due_time - current_time));
}
else
- sprintf (buf1, "timeout");
+ buf1 = format (buf1, "timeout");
if (cs->T2_due_time != DBL_MAX && cs->T2_due_time > current_time)
- sprintf (buf2, "%u remaining",
- (u32) round (cs->T2_due_time - current_time));
+ buf2 = format (buf2, "%u remaining",
+ (u32) round (cs->T2_due_time - current_time));
else
- sprintf (buf2, "timeout");
+ buf2 = format (buf2, "timeout");
if (cs->rebinding)
rebinding = ", REBINDING";
else
rebinding = "";
if (cs->T1)
vlib_cli_output (vm,
- "sw_if_index: %u, T1: %u (%s), "
- "T2: %u (%s), server index: %d%s", i,
+ "sw_if_index: %u, T1: %u (%v), "
+ "T2: %u (%v), server index: %d%s", i,
cs->T1, buf1, cs->T2, buf2,
cs->server_index, rebinding);
else
@@ -594,6 +596,9 @@ dhcp6_clients_show_command_function (vlib_main_t * vm,
}
}
+ vec_free (buf1);
+ vec_free (buf2);
+
return error;
}
diff --git a/src/plugins/dhcp/dhcp6_pd_client_cp.c b/src/plugins/dhcp/dhcp6_pd_client_cp.c
index 1c0b286bd30..077b4a38639 100644
--- a/src/plugins/dhcp/dhcp6_pd_client_cp.c
+++ b/src/plugins/dhcp/dhcp6_pd_client_cp.c
@@ -1176,8 +1176,8 @@ ip6_pd_clients_show_command_function (vlib_main_t * vm,
client_state_t *cs;
f64 current_time = vlib_time_now (vm);
const u8 *prefix_group;
- char buf1[256];
- char buf2[256];
+ u8 *buf1 = 0;
+ u8 *buf2 = 0;
const char *rebinding;
u32 i;
@@ -1186,18 +1186,20 @@ ip6_pd_clients_show_command_function (vlib_main_t * vm,
cs = &rm->client_state_by_sw_if_index[i];
if (cs->enabled)
{
+ vec_reset_length (buf1);
+ vec_reset_length (buf2);
if (cs->T1_due_time != DBL_MAX && cs->T1_due_time > current_time)
{
- sprintf (buf1, "%u remaining",
- (u32) round (cs->T1_due_time - current_time));
+ buf1 = format (buf1, "%u remaining",
+ (u32) round (cs->T1_due_time - current_time));
}
else
- sprintf (buf1, "timeout");
+ buf1 = format (buf1, "timeout");
if (cs->T2_due_time != DBL_MAX && cs->T2_due_time > current_time)
- sprintf (buf2, "%u remaining",
- (u32) round (cs->T2_due_time - current_time));
+ buf2 = format (buf2, "%u remaining",
+ (u32) round (cs->T2_due_time - current_time));
else
- sprintf (buf2, "timeout");
+ buf2 = format (buf2, "timeout");
if (cs->rebinding)
rebinding = ", REBINDING";
else
@@ -1206,8 +1208,8 @@ ip6_pd_clients_show_command_function (vlib_main_t * vm,
pm->prefix_group_name_by_index[cs->prefix_group_index];
if (cs->T1)
vlib_cli_output (vm,
- "sw_if_index: %u, prefix group: %s, T1: %u (%s), "
- "T2: %u (%s), server index: %d%s", i,
+ "sw_if_index: %u, prefix group: %s, T1: %u (%v), "
+ "T2: %u (%v), server index: %d%s", i,
prefix_group, cs->T1, buf1, cs->T2, buf2,
cs->server_index, rebinding);
else
@@ -1216,6 +1218,9 @@ ip6_pd_clients_show_command_function (vlib_main_t * vm,
}
}
+ vec_free (buf1);
+ vec_free (buf2);
+
return error;
}
diff --git a/src/plugins/hs_apps/vcl/sock_test_client.c b/src/plugins/hs_apps/vcl/sock_test_client.c
index ed43e7faaf1..6f5fb074503 100644
--- a/src/plugins/hs_apps/vcl/sock_test_client.c
+++ b/src/plugins/hs_apps/vcl/sock_test_client.c
@@ -327,7 +327,7 @@ echo_test_client ()
{
static char buf[64];
- sprintf (buf, "CLIENT (fd %d) RESULTS", tsock->fd);
+ snprintf (buf, sizeof (buf), "CLIENT (fd %d) RESULTS", tsock->fd);
vcl_test_stats_dump (buf, &tsock->stats,
1 /* show_rx */ , 1 /* show tx */ ,
ctrl->cfg.verbose);
@@ -498,7 +498,7 @@ stream_test_client (vcl_test_t test)
{
static char buf[64];
- sprintf (buf, "CLIENT (fd %d) RESULTS", tsock->fd);
+ snprintf (buf, sizeof (buf), "CLIENT (fd %d) RESULTS", tsock->fd);
vcl_test_stats_dump (buf, &tsock->stats,
test == VCL_TEST_TYPE_BI /* show_rx */ ,
1 /* show tx */ , ctrl->cfg.verbose);
diff --git a/src/plugins/hs_apps/vcl/sock_test_server.c b/src/plugins/hs_apps/vcl/sock_test_server.c
index 110ff3e183b..bd777ccb917 100644
--- a/src/plugins/hs_apps/vcl/sock_test_server.c
+++ b/src/plugins/hs_apps/vcl/sock_test_server.c
@@ -238,7 +238,8 @@ stream_test_server_start_stop (sock_server_conn_t * conn,
{
static char buf[64];
- sprintf (buf, "SERVER (fd %d) RESULTS", tc->fd);
+ snprintf (buf, sizeof (buf), "SERVER (fd %d) RESULTS",
+ tc->fd);
vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
test == VCL_TEST_TYPE_BI
/* show tx */ ,
diff --git a/src/plugins/hs_apps/vcl/vcl_test_client.c b/src/plugins/hs_apps/vcl/vcl_test_client.c
index 55bc7889098..30b48d8d145 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_client.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_client.c
@@ -394,7 +394,7 @@ vtc_accumulate_stats (vcl_test_client_worker_t * wrk,
if (ctrl->cfg.verbose > 1)
{
- sprintf (buf, "CLIENT (fd %d) RESULTS", ts->fd);
+ snprintf (buf, sizeof (buf), "CLIENT (fd %d) RESULTS", ts->fd);
vcl_test_stats_dump (buf, &ts->stats, show_rx, 1 /* show tx */ ,
ctrl->cfg.verbose);
}
@@ -553,10 +553,10 @@ vtc_print_stats (vcl_test_session_t * ctrl)
}
if (is_echo)
- sprintf (buf, "Echo");
+ snprintf (buf, sizeof (buf), "Echo");
else
- sprintf (buf, "%s-directional Stream",
- ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
+ snprintf (buf, sizeof (buf), "%s-directional Stream",
+ ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
}
static void
diff --git a/src/plugins/hs_apps/vcl/vcl_test_server.c b/src/plugins/hs_apps/vcl/vcl_test_server.c
index be225fa8c9e..364c32fc9f8 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_server.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_server.c
@@ -180,7 +180,7 @@ vts_server_start_stop (vcl_test_server_worker_t * wrk,
conn->stats.stop.tv_sec -= VCL_TEST_DELAY_DISCONNECT;
if (conn->cfg.verbose)
{
- sprintf (buf, "SERVER (fd %d) RESULTS", tc->fd);
+ snprintf (buf, sizeof (buf), "SERVER (fd %d) RESULTS", tc->fd);
vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
is_bi /* show tx */ , conn->cfg.verbose);
}