From 2eeba313a949d1a343912b547587e6d935fb8ffd Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org" Date: Thu, 28 Jul 2005 21:16:02 +0000 Subject: initial version --- utils/nfulnl_test.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 utils/nfulnl_test.c (limited to 'utils/nfulnl_test.c') 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 +#include +#include +#include + +#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); +} -- cgit v1.2.3