diff mbox

[libnetfilter_queue,2/2,v3] utils: add the parameter queue number in nfqnl_test

Message ID 1402303944-8402-1-git-send-email-alvaroneay@gmail.com
State Accepted
Headers show

Commit Message

Alvaro Neira June 9, 2014, 8:52 a.m. UTC
From: Álvaro Neira Ayuso <alvaroneay@gmail.com>

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>
---
[changes in v3]
* I have changed the argument 1 to 0 in the error message.

 utils/nfqnl_test.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Florian Westphal June 9, 2014, 10:12 a.m. UTC | #1
Alvaro Neira Ayuso <alvaroneay@gmail.com> wrote:
> From: Álvaro Neira Ayuso <alvaroneay@gmail.com>
> 
> This patch allows to stablish the number of the queue that
> we want to read the packets.

Applied, thanks Álvaro.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/nfqnl_test.c b/utils/nfqnl_test.c
index 4decd50..8c503f3 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);