X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fipvs.c;h=7bd8c6985b1019e7085ca4bcd900e1e36fa9ac46;hb=c6da31fb30c2fb1d131f92efcde0b3ec9a010b2c;hp=a64e7b7a99d56a4896c444235a10cf14090fbdf3;hpb=cacaa2126020832df99fa6423147bd3de6d4faae;p=collectd.git diff --git a/src/ipvs.c b/src/ipvs.c index a64e7b7a..7bd8c698 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -45,7 +45,9 @@ #endif /* HAVE_NETINET_IN_H */ /* this can probably only be found in the kernel sources */ -#if HAVE_NET_IP_VS_H +#if HAVE_LINUX_IP_VS_H +# include +#elif HAVE_NET_IP_VS_H # include #elif HAVE_IP_VS_H # include @@ -235,13 +237,12 @@ static void cipvs_submit_connections (char *pi, char *ti, counter_t value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); vl.interval = interval_g; - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "ipvs"); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance)); - strcpy (vl.type, "connections"); + sstrncpy (vl.type, "connections", sizeof (vl.type)); sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", sizeof (vl.type_instance)); @@ -261,11 +262,10 @@ static void cipvs_submit_if (char *pi, char *t, char *ti, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); vl.interval = interval_g; - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "ipvs"); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance)); sstrncpy (vl.type, t, sizeof (vl.type)); sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", @@ -280,7 +280,7 @@ static void cipvs_submit_dest (char *pi, struct ip_vs_dest_entry *de) { char ti[DATA_MAX_NAME_LEN]; - if (0 != get_ti (de, ti, DATA_MAX_NAME_LEN)) + if (0 != get_ti (de, ti, sizeof (ti))) return; cipvs_submit_connections (pi, ti, stats.conns); @@ -298,7 +298,7 @@ static void cipvs_submit_service (struct ip_vs_service_entry *se) int i = 0; - if (0 != get_pi (se, pi, DATA_MAX_NAME_LEN)) + if (0 != get_pi (se, pi, sizeof (pi))) return; cipvs_submit_connections (pi, NULL, stats.conns);