summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorKOVACS Krisztian <hidden@sch.bme.hu>2008-10-15 11:50:34 +0200
committerPatrick McHardy <kaber@trash.net>2008-10-15 11:50:34 +0200
commit430bbc782ea034c6314a00a841f737560a56717c (patch)
tree29dce0ee535389920aa61575227a33f328315d2c /extensions
parent92b54aa2b436387f85783d3f420ccaa12fdaf891 (diff)
Add iptables support for the socket match
Add user-space code for the socket match. Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/libxt_socket.c39
-rw-r--r--extensions/libxt_socket.man2
2 files changed, 41 insertions, 0 deletions
diff --git a/extensions/libxt_socket.c b/extensions/libxt_socket.c
new file mode 100644
index 00000000..26ac9e33
--- /dev/null
+++ b/extensions/libxt_socket.c
@@ -0,0 +1,39 @@
+/*
+ * Shared library add-on to iptables to add early socket matching support.
+ *
+ * Copyright (C) 2007 BalaBit IT Ltd.
+ */
+#include <stdio.h>
+#include <getopt.h>
+#include <xtables.h>
+
+static void socket_mt_help(void)
+{
+ printf("socket v%s has no options\n\n", XTABLES_VERSION);
+}
+
+static int socket_mt_parse(int c, char **argv, int invert, unsigned int *flags,
+ const void *entry, struct xt_entry_match **match)
+{
+ return 0;
+}
+
+static void socket_mt_check(unsigned int flags)
+{
+}
+
+static struct xtables_match socket_mt_reg = {
+ .name = "socket",
+ .version = XTABLES_VERSION,
+ .family = AF_INET,
+ .size = XT_ALIGN(0),
+ .userspacesize = XT_ALIGN(0),
+ .parse = socket_mt_parse,
+ .final_check = socket_mt_check,
+ .help = socket_mt_help,
+};
+
+void _init(void)
+{
+ xtables_register_match(&socket_mt_reg);
+}
diff --git a/extensions/libxt_socket.man b/extensions/libxt_socket.man
new file mode 100644
index 00000000..50c88542
--- /dev/null
+++ b/extensions/libxt_socket.man
@@ -0,0 +1,2 @@
+This matches if an open socket can be found by doing a socket lookup on the
+packet.