summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8de9103)
raw | patch | inline | side by side (parent: 8de9103)
author | Florian Forster <octo@crystal.wlan.home.verplant.org> | |
Sat, 3 Mar 2007 12:39:41 +0000 (13:39 +0100) | ||
committer | Florian Forster <octo@crystal.wlan.home.verplant.org> | |
Sat, 3 Mar 2007 12:39:41 +0000 (13:39 +0100) |
src/iptables.c | patch | blob | history |
diff --git a/src/iptables.c b/src/iptables.c
index d534d37863784d394827b41f79fe780a31404b10..6938848f238df9f4d48612961ff3698a4a9090de 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
# include <libiptc/libiptc.h>
#endif
+#if HAVE_LIBIPTC_LIBIPTC_H
+# define IPTABLES_HAVE_READ 1
+#else
+# define IPTABLES_HAVE_READ 0
+#endif
+
#define MODULE_NAME "iptables"
#define BUFSIZE 512
*/
static char *file_template = "iptables-%s.rrd";
+/*
+ * Removed packet count for now, should have config option if you want to save
+ * them Although other collectd models don't seem to care much for options
+ * eitherway for what to log
+ */
+static char *ds_def[] =
+{
+/* "DS:packets:COUNTER:"COLLECTD_HEARTBEAT":0:U", */
+ "DS:bytes:DERIVE:"COLLECTD_HEARTBEAT":0:U",
+ NULL
+};
+static int ds_num = 1;
+
+#if IPTABLES_HAVE_READ
/*
* Config format should be `Chain table chainname',
* e. g. `Chain mangle incoming'
NULL
};
static int config_keys_num = 1;
-/*
- Removed packet count for now, should have config option if you want to save them
- Although other collectd models don't seem to care much for options eitherway for what to log
-*/
-static char *ds_def[] =
-{
-// "DS:packets:COUNTER:"COLLECTD_HEARTBEAT":0:U",
- "DS:bytes:DERIVE:"COLLECTD_HEARTBEAT":0:U",
- NULL
-};
-static int ds_num = 1;
-
/*
Each table/chain combo that will be queried goes into this list
*/
return (0);
}
+#endif /* IPTABLES_HAVE_READ */
static void iptables_init (void)
{
rrd_update_file (host, file, val, ds_def, ds_num);
}
-
+#if IPTABLES_HAVE_READ
static int submit_match (const struct ipt_entry_match *match,
const struct ipt_entry *entry, const ip_chain_t *chain)
{
iptc_free( &handle );
}
}
+#else /* !IPTABLES_HAVE_READ */
+# define iptables_read NULL
+#endif
void module_register (void)
{
plugin_register (MODULE_NAME, iptables_init, iptables_read, iptables_write);
+#if IPTABLES_HAVE_READ
cf_register (MODULE_NAME, iptables_config, config_keys, config_keys_num);
+#endif
}
#undef BUFSIZE