From patchwork Fri Jun 6 09:58:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alvaro Neira X-Patchwork-Id: 356773 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 C37FB140093 for ; Fri, 6 Jun 2014 19:58:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752647AbaFFJ6q (ORCPT ); Fri, 6 Jun 2014 05:58:46 -0400 Received: from mail-we0-f180.google.com ([74.125.82.180]:60648 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646AbaFFJ6p (ORCPT ); Fri, 6 Jun 2014 05:58:45 -0400 Received: by mail-we0-f180.google.com with SMTP id q58so2495489wes.25 for ; Fri, 06 Jun 2014 02:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=zaxtbPEI9lKePP97rWqTEKIje6AjNu+UcNV8keu3L24=; b=RIOJiUZrsKO3hMw+wNZOaSY1s5i+axN4MRCaqdOxDyoAjzU2QnJNzbkUcFbCirWMW6 GaYeeXtLRMILfnn25LACNxGfFO59VUrh8w+gwzZHjj40MvVlpbKgR1pqjAXUvLhoPAHo +LIefzumfmcSZDFOVbaQ5KmVgbHKD6JMrbOVJCFXVP28ZIL27Z+n+xG0rrvjOeM1SHcn xh4YCbLH2HLC7iYoYkEXe2EsRM3JVc45TvubssdDmRa67Iv//AEZ0auO2fM9TXBd4yjj zn0trylN3UGqsenxEmK51p5acGDvnlDWXS+RETK/50tMAAvf9JtMBQMyoExAb+2cDbfR tdJQ== X-Received: by 10.180.84.7 with SMTP id u7mr23962536wiy.31.1402048724117; Fri, 06 Jun 2014 02:58:44 -0700 (PDT) Received: from localhost.localdomain (186.169.216.87.static.jazztel.es. [87.216.169.186]) by mx.google.com with ESMTPSA id bl3sm7578758wib.9.2014.06.06.02.58.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jun 2014 02:58:43 -0700 (PDT) From: Alvaro Neira Ayuso To: netfilter-devel@vger.kernel.org Subject: [libnetfilter_queue PATCH 2/2] utils: add the parameter queue number in nfqnl_test Date: Fri, 6 Jun 2014 11:58:03 +0200 Message-Id: <1402048683-12587-1-git-send-email-alvaroneay@gmail.com> X-Mailer: git-send-email 1.7.10.4 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 --- utils/nfqnl_test.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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); diff --git a/utils/nfqnl_test.c b/utils/nfqnl_test.c index 4decd50..8272fa1 100644 --- a/utils/nfqnl_test.c +++ b/utils/nfqnl_test.c @@ -85,8 +85,18 @@ int main(int argc, char **argv) struct nfq_q_handle *qh; int fd; int rv; + int queue = 0; char buf[4096] __attribute__ ((aligned)); + if (argc == 2) { + queue = atoi(argv[1]); + if (queue > 65535) { + fprintf(stderr, "queue number is bigger than 65535\n"); + exit(1); + } + } + printf("opening library handle\n"); h = nfq_open(); if (!h) { @@ -106,8 +116,8 @@ int main(int argc, char **argv)