projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Makefile.am: Fix out-of-tree builds.
[collectd.git]
/
src
/
netlink.c
diff --git
a/src/netlink.c
b/src/netlink.c
index
3cc1084
..
b5ae3bd
100644
(file)
--- a/
src/netlink.c
+++ b/
src/netlink.c
@@
-358,8
+358,10
@@
static int link_filter_cb(const struct nlmsghdr *nlh,
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*stats.stats64)) < 0) {
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*stats.stats64)) < 0) {
+ char errbuf[1024];
ERROR("netlink plugin: link_filter_cb: IFLA_STATS64 mnl_attr_validate2 "
ERROR("netlink plugin: link_filter_cb: IFLA_STATS64 mnl_attr_validate2 "
- "failed.");
+ "failed: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
return MNL_CB_ERROR;
}
stats.stats64 = mnl_attr_get_payload(attr);
return MNL_CB_ERROR;
}
stats.stats64 = mnl_attr_get_payload(attr);
@@
-374,8
+376,10
@@
static int link_filter_cb(const struct nlmsghdr *nlh,
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*stats.stats32)) < 0) {
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*stats.stats32)) < 0) {
+ char errbuf[1024];
ERROR("netlink plugin: link_filter_cb: IFLA_STATS mnl_attr_validate2 "
ERROR("netlink plugin: link_filter_cb: IFLA_STATS mnl_attr_validate2 "
- "failed.");
+ "failed: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
return MNL_CB_ERROR;
}
stats.stats32 = mnl_attr_get_payload(attr);
return MNL_CB_ERROR;
}
stats.stats32 = mnl_attr_get_payload(attr);
@@
-400,8
+404,10
@@
static int qos_attr_cb(const struct nlattr *attr, void *data) {
if (mnl_attr_get_type(attr) == TCA_STATS_BASIC) {
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*q_stats->bs)) < 0) {
if (mnl_attr_get_type(attr) == TCA_STATS_BASIC) {
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*q_stats->bs)) < 0) {
+ char errbuf[1024];
ERROR("netlink plugin: qos_attr_cb: TCA_STATS_BASIC mnl_attr_validate2 "
ERROR("netlink plugin: qos_attr_cb: TCA_STATS_BASIC mnl_attr_validate2 "
- "failed.");
+ "failed: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
return MNL_CB_ERROR;
}
q_stats->bs = mnl_attr_get_payload(attr);
return MNL_CB_ERROR;
}
q_stats->bs = mnl_attr_get_payload(attr);
@@
-495,8
+501,8
@@
static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) {
if (strcmp(tc_type, "filter") == 0)
numberic_id = tm->tcm_parent;
if (strcmp(tc_type, "filter") == 0)
numberic_id = tm->tcm_parent;
- s
s
nprintf(tc_inst, sizeof(tc_inst), "%s-%x:%x", kind, numberic_id >> 16,
-
numberic_id & 0x0000FFFF);
+ snprintf(tc_inst, sizeof(tc_inst), "%s-%x:%x", kind, numberic_id >> 16,
+ numberic_id & 0x0000FFFF);
}
DEBUG("netlink plugin: qos_filter_cb: got %s for %s (%i).", tc_type, dev,
}
DEBUG("netlink plugin: qos_filter_cb: got %s for %s (%i).", tc_type, dev,
@@
-527,8
+533,7
@@
static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) {
stats_submitted = 1;
stats_submitted = 1;
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
- tc_inst);
+ snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
if (q_stats.bs != NULL) {
submit_one(dev, "ipt_bytes", type_instance, q_stats.bs->bytes);
if (q_stats.bs != NULL) {
submit_one(dev, "ipt_bytes", type_instance, q_stats.bs->bytes);
@@
-551,8
+556,10
@@
static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) {
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*ts)) < 0) {
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*ts)) < 0) {
+ char errbuf[1024];
ERROR("netlink plugin: qos_filter_cb: TCA_STATS mnl_attr_validate2 "
ERROR("netlink plugin: qos_filter_cb: TCA_STATS mnl_attr_validate2 "
- "failed.");
+ "failed: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
return MNL_CB_ERROR;
}
ts = mnl_attr_get_payload(attr);
return MNL_CB_ERROR;
}
ts = mnl_attr_get_payload(attr);
@@
-560,8
+567,7
@@
static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) {
if (!stats_submitted && ts != NULL) {
char type_instance[DATA_MAX_NAME_LEN];
if (!stats_submitted && ts != NULL) {
char type_instance[DATA_MAX_NAME_LEN];
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
- tc_inst);
+ snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
submit_one(dev, "ipt_bytes", type_instance, ts->bytes);
submit_one(dev, "ipt_packets", type_instance, ts->packets);
submit_one(dev, "ipt_bytes", type_instance, ts->bytes);
submit_one(dev, "ipt_packets", type_instance, ts->packets);
@@
-688,8
+694,10
@@
static int ir_read(void) {
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
}
if (ret < 0) {
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
}
if (ret < 0) {
- ERROR("netlink plugin: ir_read: mnl_socket_recvfrom failed.");
- return -1;
+ char errbuf[1024];
+ ERROR("netlink plugin: ir_read: mnl_socket_recvfrom failed: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
+ return (-1);
}
/* `link_filter_cb' will update `iflist' which is used here to iterate
}
/* `link_filter_cb' will update `iflist' which is used here to iterate
@@
-733,10
+741,11
@@
static int ir_read(void) {
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
}
if (ret < 0) {
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
}
if (ret < 0) {
- ERROR("netlink plugin: ir_read:mnl_socket_recvfrom failed.");
+ char errbuf[1024];
+ ERROR("netlink plugin: ir_read: mnl_socket_recvfrom failed: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
continue;
}
continue;
}
-
} /* for (type_index) */
} /* for (if_index) */
} /* for (type_index) */
} /* for (if_index) */