X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fiptables.c;h=657b6ba0a5c340ca9ace0e8ff6de9c9b93bc0eff;hb=6d8031d73b7c1d874d7afa4cad2f248c4073764d;hp=f6911221df8739f31d77710eb59802a4d9fff1d4;hpb=3d74a63ae43c1786eb9b966e2209c24c5643dae8;p=collectd.git diff --git a/src/iptables.c b/src/iptables.c index f6911221..657b6ba0 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -242,7 +242,6 @@ static int submit6_match (const struct ip6t_entry_match *match, int rule_num) { int status; - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; /* Select the rules to collect */ @@ -260,9 +259,6 @@ static int submit6_match (const struct ip6t_entry_match *match, return (0); } - vl.values = values; - vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "ip6tables", sizeof (vl.plugin)); status = ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance), @@ -285,16 +281,16 @@ static int submit6_match (const struct ip6t_entry_match *match, } sstrncpy (vl.type, "ipt_bytes", sizeof (vl.type)); - values[0].derive = (derive_t) entry->counters.bcnt; + vl.values = &(value_t) { .derive = (derive_t) entry->counters.bcnt }; + vl.values_len = 1; plugin_dispatch_values (&vl); sstrncpy (vl.type, "ipt_packets", sizeof (vl.type)); - values[0].derive = (derive_t) entry->counters.pcnt; + vl.values = &(value_t) { .derive = (derive_t) entry->counters.pcnt }; plugin_dispatch_values (&vl); return (0); -} /* int submit_match */ - +} /* int submit6_match */ /* This needs to return `int' for IPT_MATCH_ITERATE to work. */ static int submit_match (const struct ipt_entry_match *match, @@ -303,7 +299,6 @@ static int submit_match (const struct ipt_entry_match *match, int rule_num) { int status; - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; /* Select the rules to collect */ @@ -321,9 +316,6 @@ static int submit_match (const struct ipt_entry_match *match, return (0); } - vl.values = values; - vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "iptables", sizeof (vl.plugin)); status = ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance), @@ -346,11 +338,12 @@ static int submit_match (const struct ipt_entry_match *match, } sstrncpy (vl.type, "ipt_bytes", sizeof (vl.type)); - values[0].derive = (derive_t) entry->counters.bcnt; + vl.values = &(value_t) { .derive = (derive_t) entry->counters.bcnt }; + vl.values_len = 1; plugin_dispatch_values (&vl); sstrncpy (vl.type, "ipt_packets", sizeof (vl.type)); - values[0].derive = (derive_t) entry->counters.pcnt; + vl.values = &(value_t) { .derive = (derive_t) entry->counters.pcnt }; plugin_dispatch_values (&vl); return (0);