summaryrefslogtreecommitdiffstats
path: root/utils/nfulnl_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/nfulnl_test.c')
-rw-r--r--utils/nfulnl_test.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/utils/nfulnl_test.c b/utils/nfulnl_test.c
new file mode 100644
index 0000000..bfcfaf9
--- /dev/null
+++ b/utils/nfulnl_test.c
@@ -0,0 +1,38 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+
+#include "libnfnetlink_log.h"
+
+int main(int argc, char **argv)
+{
+ struct nfulnl_handle h;
+ struct nfulnl_g_handle qh;
+ struct nfulnl_g_handle qh100;
+ int rv;
+ char buf[4096];
+
+ rv = nfulnl_open(&h);
+ if (rv < 0)
+ exit(rv);
+
+ nfulnl_unbind_pf(&h, AF_INET);
+ nfulnl_bind_pf(&h, AF_INET);
+ nfulnl_bind_group(&h, &qh, 0);
+ nfulnl_bind_group(&h, &qh100, 100);
+ nfulnl_set_mode(&qh, NFULNL_COPY_PACKET, 0xffff);
+
+ while (recv(h.nfnlh.fd, buf, sizeof(buf), 0) > 0) {
+ printf("pkt received\n");
+ }
+
+ nfulnl_unbind_group(&qh100);
+ nfulnl_unbind_group(&qh);
+ nfulnl_unbind_pf(&h, AF_INET);
+
+ nfulnl_close(&h);
+
+ exit(0);
+}