const char *dev;
const char *kind = NULL;
- struct gnet_stats_basic *bs = NULL;
- struct tc_stats *ts = NULL;
/* char *type_instance; */
char *tc_type;
char tc_inst[DATA_MAX_NAME_LEN];
+ int __attribute__((unused)) stats_found = 0;
+
if (tm->tcm_ifindex != wanted_ifindex)
{
DEBUG ("netlink plugin: qos_filter_cb: Got %s for interface #%i, "
#if HAVE_TCA_STATS2
mnl_attr_for_each (attr, nlh, sizeof (*tm))
{
+ struct gnet_stats_basic *bs = NULL;
+
if (mnl_attr_get_type(attr) != TCA_STATS2)
continue;
mnl_attr_parse_nested(attr, qos_attr_cb, &bs);
+ if (bs != NULL)
+ stats_found = 1;
+
break;
}
- if (bs != NULL)
+ if (stats_found)
{
char type_instance[DATA_MAX_NAME_LEN];
#if HAVE_TCA_STATS
mnl_attr_for_each (attr, nlh, sizeof (*tm))
{
+ struct tc_stats *ts = NULL;
+
if (mnl_attr_get_type(attr) != TCA_STATS)
continue;
return MNL_CB_ERROR;
}
ts = mnl_attr_get_payload(attr);
- break;
- }
- if (bs == NULL && ts != NULL)
- {
- char type_instance[DATA_MAX_NAME_LEN];
+ if (!stats_found && ts != NULL)
+ {
+ char type_instance[DATA_MAX_NAME_LEN];
- ssnprintf (type_instance, sizeof (type_instance), "%s-%s",
- tc_type, tc_inst);
+ ssnprintf (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);
+ }
+
+ break;
}
+
#endif /* TCA_STATS */
#if !(HAVE_TCA_STATS && HAVE_TCA_STATS2)