From patchwork Mon Jun 9 08:52:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alvaro Neira X-Patchwork-Id: 357353 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44E2D140080 for ; Mon, 9 Jun 2014 18:53:15 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754060AbaFIIxM (ORCPT ); Mon, 9 Jun 2014 04:53:12 -0400 Received: from mail-we0-f170.google.com ([74.125.82.170]:43662 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754048AbaFIIxK (ORCPT ); Mon, 9 Jun 2014 04:53:10 -0400 Received: by mail-we0-f170.google.com with SMTP id u57so5544295wes.15 for ; Mon, 09 Jun 2014 01:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=6pOYAxC57fNfxlBKjUmDUyj+k656uDKCbLnlbJ0Evzo=; b=ssHqPUUOQFWF9NPPjJ3HLFIArtX0Rs3O4PYQyzc7lsDurmJK1KlhpBY1IRgiPRvmMf +RQz8GNHGlAUppI5PDD8ifci8kJcSDLGxpLLh26b2IeMhE2/B9yfgNeAaztzG39NauY3 q4s7iOXTZJtASk0rlytagsRigKMe33cU83A2uN+YSr94eZEwJqUAE/mFbUQzDFvTaHqK 3N/t2Bmm9dX3aQ0M0IEQCJhB7ZrDSuFxO3S22khyIjU+gVC3D/Limrx0LwehxMjei6tt 8w76zBqVOQfqKaMWf7onpAbbB3D+ONvse8AJXo5THHjKB+E8CNB5pLPvv1a0LkkPP5Nd HgJQ== X-Received: by 10.194.82.9 with SMTP id e9mr28844368wjy.45.1402303988709; Mon, 09 Jun 2014 01:53:08 -0700 (PDT) Received: from localhost.localdomain (186.169.216.87.static.jazztel.es. [87.216.169.186]) by mx.google.com with ESMTPSA id pq9sm24042367wjc.35.2014.06.09.01.53.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jun 2014 01:53:08 -0700 (PDT) From: Alvaro Neira Ayuso To: netfilter-devel@vger.kernel.org Subject: [libnetfilter_queue PATCH 2/2 v3] utils: add the parameter queue number in nfqnl_test Date: Mon, 9 Jun 2014 10:52:24 +0200 Message-Id: <1402303944-8402-1-git-send-email-alvaroneay@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402050005-14844-1-git-send-email-alvaroneay@gmail.com> References: <1402050005-14844-1-git-send-email-alvaroneay@gmail.com> MIME-Version: 1.0 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org From: Álvaro Neira Ayuso This patch allows to stablish the number of the queue that we want to read the packets. Signed-off-by: Alvaro Neira Ayuso --- [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(-) 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);