From 5c4d06957c850d884dabe015ba11844af6a755a8 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: Sat, 30 Jul 2005 20:59:07 +0000 Subject: more restructuring work --- utils/Makefile.am | 11 +++++++++++ utils/nfqnl_test.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 utils/Makefile.am create mode 100644 utils/nfqnl_test.c (limited to 'utils') diff --git a/utils/Makefile.am b/utils/Makefile.am new file mode 100644 index 0000000..d66d819 --- /dev/null +++ b/utils/Makefile.am @@ -0,0 +1,11 @@ +bin_PROGRAMS = nfqnl_test +nfqnl_test_SOURCES = nfqnl_test.c + + +INCLUDES = $(all_includes) -I$(top_srcdir)/include -I${KERNELDIR} + +nfqnl_test_LDFLAGS = $(all_libraries) -lnfnetlink_queue -lnfnetlink + +$(OBJECTS): libtool +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck diff --git a/utils/nfqnl_test.c b/utils/nfqnl_test.c new file mode 100644 index 0000000..834f5cb --- /dev/null +++ b/utils/nfqnl_test.c @@ -0,0 +1,34 @@ + +#include +#include +#include +#include + +#include "libnfnetlink_queue.h" + +int main(int argc, char **argv) +{ + struct nfqnl_handle h; + struct nfqnl_q_handle qh; + int rv; + char buf[4096]; + + rv = nfqnl_open(&h); + if (rv < 0) + exit(rv); + + nfqnl_bind_pf(&h, AF_INET); + nfqnl_create_queue(&h, &qh, 0); + nfqnl_set_mode(&qh, NFQNL_COPY_PACKET, 0xffff); + + while (recv(h.nfnlh.fd, buf, sizeof(buf), 0) > 0) { + printf("pkt received\n"); + } + + nfqnl_destroy_queue(&qh); + nfqnl_unbind_pf(&h, AF_INET); + + nfqnl_close(&h); + + exit(0); +} -- cgit v1.2.3