projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1455 from rubenk/configure-ac-remove-dead-code
[collectd.git]
/
src
/
ipvs.c
diff --git
a/src/ipvs.c
b/src/ipvs.c
index
f3a583b
..
4345a46
100644
(file)
--- a/
src/ipvs.c
+++ b/
src/ipvs.c
@@
-37,15
+37,14
@@
#if HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */
#if HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif /* HAVE_SYS_SOCKET_H */
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */
/* this can probably only be found in the kernel sources */
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#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 <linux/ip_vs.h>
+#elif HAVE_NET_IP_VS_H
# include <net/ip_vs.h>
#elif HAVE_IP_VS_H
# include <ip_vs.h>
# include <net/ip_vs.h>
#elif HAVE_IP_VS_H
# include <ip_vs.h>
@@
-195,7
+194,7
@@
static int get_pi (struct ip_vs_service_entry *se, char *pi, size_t size)
(se->protocol == IPPROTO_TCP) ? "TCP" : "UDP",
ntohs (se->port));
(se->protocol == IPPROTO_TCP) ? "TCP" : "UDP",
ntohs (se->port));
- if ((0 > len) || (size <=
len
)) {
+ if ((0 > len) || (size <=
((size_t) len)
)) {
log_err ("plugin instance truncated: %s", pi);
return -1;
}
log_err ("plugin instance truncated: %s", pi);
return -1;
}
@@
-218,19
+217,19
@@
static int get_ti (struct ip_vs_dest_entry *de, char *ti, size_t size)
len = ssnprintf (ti, size, "%s_%u", inet_ntoa (addr),
ntohs (de->port));
len = ssnprintf (ti, size, "%s_%u", inet_ntoa (addr),
ntohs (de->port));
- if ((0 > len) || (size <=
len
)) {
+ if ((0 > len) || (size <=
((size_t) len)
)) {
log_err ("type instance truncated: %s", ti);
return -1;
}
return 0;
} /* get_ti */
log_err ("type instance truncated: %s", ti);
return -1;
}
return 0;
} /* get_ti */
-static void cipvs_submit_connections (char *pi, char *ti,
counter
_t value)
+static void cipvs_submit_connections (char *pi, char *ti,
derive
_t value)
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- values[0].
counter
= value;
+ values[0].
derive
= value;
vl.values = values;
vl.values_len = 1;
vl.values = values;
vl.values_len = 1;
@@
-247,13
+246,13
@@
static void cipvs_submit_connections (char *pi, char *ti, counter_t value)
} /* cipvs_submit_connections */
static void cipvs_submit_if (char *pi, char *t, char *ti,
} /* cipvs_submit_connections */
static void cipvs_submit_if (char *pi, char *t, char *ti,
-
counter_t rx, counter
_t tx)
+
derive_t rx, derive
_t tx)
{
value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
{
value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
- values[0].
counter
= rx;
- values[1].
counter
= tx;
+ values[0].
derive
= rx;
+ values[1].
derive
= tx;
vl.values = values;
vl.values_len = 2;
vl.values = values;
vl.values_len = 2;
@@
-290,10
+289,13
@@
static void cipvs_submit_service (struct ip_vs_service_entry *se)
char pi[DATA_MAX_NAME_LEN];
char pi[DATA_MAX_NAME_LEN];
-
int i = 0
;
+
size_t i
;
if (0 != get_pi (se, pi, sizeof (pi)))
if (0 != get_pi (se, pi, sizeof (pi)))
+ {
+ free (dests);
return;
return;
+ }
cipvs_submit_connections (pi, NULL, stats.conns);
cipvs_submit_if (pi, "if_packets", NULL, stats.inpkts, stats.outpkts);
cipvs_submit_connections (pi, NULL, stats.conns);
cipvs_submit_if (pi, "if_packets", NULL, stats.inpkts, stats.outpkts);
@@
-309,7
+311,7
@@
static void cipvs_submit_service (struct ip_vs_service_entry *se)
static int cipvs_read (void)
{
struct ip_vs_get_services *services = NULL;
static int cipvs_read (void)
{
struct ip_vs_get_services *services = NULL;
-
int i = 0
;
+
size_t i
;
if (sockfd < 0)
return (-1);
if (sockfd < 0)
return (-1);