summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter/Makefile.am7
-rw-r--r--filter/ulogd_filter_IFINDEX.c75
2 files changed, 82 insertions, 0 deletions
diff --git a/filter/Makefile.am b/filter/Makefile.am
index 25f2516..6d0cd43 100644
--- a/filter/Makefile.am
+++ b/filter/Makefile.am
@@ -1 +1,8 @@
SUBDIRS = raw2packet packet2flow
+
+INCLUDES = $(all_includes) -I$(top_srcdir)/include
+
+pkglib_LTLIBRARIES = ulogd_filter_IFINDEX.la
+
+ulogd_filter_IFINDEX_la_SOURCES = ulogd_filter_IFINDEX.c
+ulogd_filter_IFINDEX_la_LDFLAGS = -module
diff --git a/filter/ulogd_filter_IFINDEX.c b/filter/ulogd_filter_IFINDEX.c
new file mode 100644
index 0000000..783fe54
--- /dev/null
+++ b/filter/ulogd_filter_IFINDEX.c
@@ -0,0 +1,75 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <ulogd/ulogd.h>
+
+static struct ulogd_key ifindex_keys[] = {
+ {
+ .type = ULOGD_RET_STRING,
+ .flags = ULOGD_RETF_NONE,
+ .name = "oob.in",
+ },
+ {
+ .type = ULOGD_RET_STRING,
+ .flags = ULOGD_RETF_NONE,
+ .name = "oob.out",
+ },
+};
+
+static struct ulogd_key ifindex_inp[] = {
+ {
+ .type = ULOGD_RET_UINT32,
+ .name = "oob.ifindex_in",
+ },
+ {
+ .type = ULOGD_RET_UINT32,
+ .name = "oob.ifindex_out",
+ },
+};
+
+static int interp_ifindex(struct ulogd_pluginstance *pi)
+{
+ struct ulogd_key *ret = pi->output;
+
+ ret[0].u.value.ptr = "eth_in_FIXME";
+ ret[0].flags |= ULOGD_RETF_VALID;
+ ret[1].u.value.ptr = "eth_out_FIXME";
+ ret[1].flags |= ULOGD_RETF_VALID;
+
+ return 0;
+}
+
+
+static int ifindex_start(struct ulogd_pluginstance *upi)
+{
+ return 0;
+}
+
+static int ifindex_fini(struct ulogd_pluginstance *upi)
+{
+ return 0;
+}
+
+static struct ulogd_plugin ifindex_plugin = {
+ .name = "IFINDEX",
+ .input = {
+ .keys = ifindex_inp,
+ .num_keys = ARRAY_SIZE(ifindex_inp),
+ .type = ULOGD_DTYPE_RAW,
+ },
+ .output = {
+ .keys = ifindex_keys,
+ .num_keys = ARRAY_SIZE(ifindex_keys),
+ .type = ULOGD_DTYPE_PACKET,
+ },
+ .interp = &interp_ifindex,
+
+ .start = &ifindex_start,
+ .stop = &ifindex_fini,
+};
+
+void __attribute__ ((constructor)) init(void);
+
+void init(void)
+{
+ ulogd_register_plugin(&ifindex_plugin);
+}