summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÁlvaro Neira Ayuso <alvaroneay@gmail.com>2014-06-09 10:52:24 +0200
committerFlorian Westphal <fw@strlen.de>2014-06-09 12:05:47 +0200
commit7f62d110fd0869a073d3dcb9d6d81dd21be9e26c (patch)
tree2cd59eac1e6981ac391dd0094a40e51f42dcdf46
parent813fb2f482451444a1c06968f329291653cfe852 (diff)
utils: add the parameter queue number in nfqnl_test
This patch allows to stablish the number of the queue that we want to read the packets. Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de>
-rw-r--r--utils/nfqnl_test.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/utils/nfqnl_test.c b/utils/nfqnl_test.c
index 4decd50..2176a61 100644
--- a/utils/nfqnl_test.c
+++ b/utils/nfqnl_test.c
@@ -85,8 +85,17 @@ int main(int argc, char **argv)
struct nfq_q_handle *qh;
int fd;
int rv;
+ uint32_t queue = 0;
char buf[4096] __attribute__ ((aligned));
+ if (argc == 2) {
+ queue = atoi(argv[1]);
+ if (queue > 65535) {
+ fprintf(stderr, "Usage: %s [<0-65535>]\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+ }
+
printf("opening library handle\n");
h = nfq_open();
if (!h) {
@@ -106,8 +115,8 @@ int main(int argc, char **argv)
exit(1);
}
- printf("binding this socket to queue '0'\n");
- qh = nfq_create_queue(h, 0, &cb, NULL);
+ printf("binding this socket to queue '%d'\n", queue);
+ qh = nfq_create_queue(h, queue, &cb, NULL);
if (!qh) {
fprintf(stderr, "error during nfq_create_queue()\n");
exit(1);