* [libnetfilter_queue PATCH 2/2] utils: add the parameter queue number in nfqnl_test
@ 2014-06-06 9:58 Alvaro Neira Ayuso
2014-06-06 10:03 ` Pablo Neira Ayuso
2014-06-06 10:20 ` [libnetfilter_queue PATCH v2] " Alvaro Neira Ayuso
0 siblings, 2 replies; 7+ messages in thread
From: Alvaro Neira Ayuso @ 2014-06-06 9:58 UTC (permalink / raw)
To: netfilter-devel
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>
---
utils/nfqnl_test.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
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)
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);
--
1.7.10.4
--
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [libnetfilter_queue PATCH 2/2] utils: add the parameter queue number in nfqnl_test
2014-06-06 9:58 [libnetfilter_queue PATCH 2/2] utils: add the parameter queue number in nfqnl_test Alvaro Neira Ayuso
@ 2014-06-06 10:03 ` Pablo Neira Ayuso
2014-06-06 10:20 ` [libnetfilter_queue PATCH v2] " Alvaro Neira Ayuso
1 sibling, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2014-06-06 10:03 UTC (permalink / raw)
To: Alvaro Neira Ayuso; +Cc: netfilter-devel
On Fri, Jun 06, 2014 at 11:58:03AM +0200, Alvaro Neira Ayuso 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.
>
> Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
> ---
> utils/nfqnl_test.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> 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;
This signed, change it to unsigned.
> char buf[4096] __attribute__ ((aligned));
>
> + if (argc == 2) {
> + queue = atoi(argv[1]);
> + if (queue > 65535) {
> + fprintf(stderr, "queue number is bigger than 65535\n");
I'd suggest something like.
Usage: %s [<0-65535>]
> + exit(1);
Please, use exit(EXIT_FAILURE);
> + }
> + }
> +
> printf("opening library handle\n");
> h = nfq_open();
> if (!h) {
> @@ -106,8 +116,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);
> --
> 1.7.10.4
>
> --
> 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
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [libnetfilter_queue PATCH v2] utils: add the parameter queue number in nfqnl_test
2014-06-06 9:58 [libnetfilter_queue PATCH 2/2] utils: add the parameter queue number in nfqnl_test Alvaro Neira Ayuso
2014-06-06 10:03 ` Pablo Neira Ayuso
@ 2014-06-06 10:20 ` Alvaro Neira Ayuso
2014-06-06 10:44 ` Pablo Neira Ayuso
2014-06-09 8:52 ` [libnetfilter_queue PATCH 2/2 v3] " Alvaro Neira Ayuso
1 sibling, 2 replies; 7+ messages in thread
From: Alvaro Neira Ayuso @ 2014-06-06 10:20 UTC (permalink / raw)
To: netfilter-devel
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 v2]
* I have changed the variable queue to unsigned
* I have changed the message in case that queue > 65535 and also I have used
exit(EXIT_FAILURE) in error case.
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..557db1d 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[1]);
+ 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);
--
1.7.10.4
--
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [libnetfilter_queue PATCH v2] utils: add the parameter queue number in nfqnl_test
2014-06-06 10:20 ` [libnetfilter_queue PATCH v2] " Alvaro Neira Ayuso
@ 2014-06-06 10:44 ` Pablo Neira Ayuso
2014-06-06 10:54 ` Álvaro Neira Ayuso
2014-06-09 8:52 ` [libnetfilter_queue PATCH 2/2 v3] " Alvaro Neira Ayuso
1 sibling, 1 reply; 7+ messages in thread
From: Pablo Neira Ayuso @ 2014-06-06 10:44 UTC (permalink / raw)
To: Alvaro Neira Ayuso; +Cc: netfilter-devel
On Fri, Jun 06, 2014 at 12:20:05PM +0200, Alvaro Neira Ayuso 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.
>
> Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
> ---
> [changes in v2]
> * I have changed the variable queue to unsigned
> * I have changed the message in case that queue > 65535 and also I have used
> exit(EXIT_FAILURE) in error case.
>
> 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..557db1d 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[1]);
^^^^^^^
You did *not* test the error path, this is argv[0].
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [libnetfilter_queue PATCH v2] utils: add the parameter queue number in nfqnl_test
2014-06-06 10:44 ` Pablo Neira Ayuso
@ 2014-06-06 10:54 ` Álvaro Neira Ayuso
0 siblings, 0 replies; 7+ messages in thread
From: Álvaro Neira Ayuso @ 2014-06-06 10:54 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
El 06/06/14 12:44, Pablo Neira Ayuso escribió:
> On Fri, Jun 06, 2014 at 12:20:05PM +0200, Alvaro Neira Ayuso 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.
>>
>> Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
>> ---
>> [changes in v2]
>> * I have changed the variable queue to unsigned
>> * I have changed the message in case that queue > 65535 and also I have used
>> exit(EXIT_FAILURE) in error case.
>>
>> 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..557db1d 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[1]);
> ^^^^^^^
>
> You did *not* test the error path, this is argv[0].
>
Sure, sorry. I have understood wrong.
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [libnetfilter_queue PATCH 2/2 v3] utils: add the parameter queue number in nfqnl_test
2014-06-06 10:20 ` [libnetfilter_queue PATCH v2] " Alvaro Neira Ayuso
2014-06-06 10:44 ` Pablo Neira Ayuso
@ 2014-06-09 8:52 ` Alvaro Neira Ayuso
2014-06-09 10:12 ` Florian Westphal
1 sibling, 1 reply; 7+ messages in thread
From: Alvaro Neira Ayuso @ 2014-06-09 8:52 UTC (permalink / raw)
To: netfilter-devel
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(-)
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);
--
1.7.10.4
--
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-09 10:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-06 9:58 [libnetfilter_queue PATCH 2/2] utils: add the parameter queue number in nfqnl_test Alvaro Neira Ayuso
2014-06-06 10:03 ` Pablo Neira Ayuso
2014-06-06 10:20 ` [libnetfilter_queue PATCH v2] " Alvaro Neira Ayuso
2014-06-06 10:44 ` Pablo Neira Ayuso
2014-06-06 10:54 ` Álvaro Neira Ayuso
2014-06-09 8:52 ` [libnetfilter_queue PATCH 2/2 v3] " Alvaro Neira Ayuso
2014-06-09 10:12 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).