netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alessandro Vesely <vesely@tana.it>
To: David F <netfilter@meta-dynamic.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	netfilter <netfilter@vger.kernel.org>,
	Eric Leblond <eleblond@edenwall.com>
Subject: Re: libnetfilter_queue: mark-value byte ordering? --oops, pls discard previous copy
Date: Mon, 10 May 2010 12:51:05 +0200	[thread overview]
Message-ID: <4BE7E519.7080600@tana.it> (raw)
In-Reply-To: <4BE76C66.6070701@meta-dynamic.com>

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

David F writes:
> Pablo Neira Ayuso wrote:
>>
>> I have applied the following patch. I think that, at least, new users
>> will not hit this problem again. I'm very sorry that this was not fixed
>> before. Let me know if you are OK with it, we're still in time to revert
>> the patch attached.

Waiting one version before deprecating might allow smoother changing.

> For what it's worth, I had previously prepared this patch which just
> clarifies the documentation on this parameter.  I think it still has
> value since I also added some missing return-value docs and changed the
> descriptions of a few parameters that I had found to be confusing.

Good work. Is the (current) generated doc available? I've found an 
older version in http://www.nufw.org/doc/libnetfilter_queue/

I attach a patch aimed at fixing the example, which is confusing, 
since rv can simultaneously be != 0 and >= 0 only if it is > 0. I 
haven't resisted an attempt at enumerating verdicts, though.


[-- Attachment #2: libnetfilter_queue17.patch --]
[-- Type: text/plain, Size: 1196 bytes --]

--- libnetfilter_queue-0.0.17/src/libnetfilter_queue.original.c	2009-02-17 20:55:23.000000000 +0100
+++ libnetfilter_queue-0.0.17/src/libnetfilter_queue.c	2010-05-10 12:25:33.000000000 +0200
@@ -207,13 +207,22 @@
  * \verbatim
 	fd = nfq_fd(h);
 
-	while ((rv = recv(fd, buf, sizeof(buf), 0)) && rv >= 0) {
+	while ((rv = recv(fd, buf, sizeof(buf), 0)) >= 0) {
 		printf("pkt received\n");
 		nfq_handle_packet(h, buf, rv);
 	}
 \endverbatim
  * When the decision on a packet has been choosed, the verdict has to be given
- * by calling nfq_set_verdict() or nfq_set_verdict_mark().
+ * by calling nfq_set_verdict() or nfq_set_verdict_mark(). The verdict
+ * determines the destiny of the packet as follows:
+ *
+ *   - NF_DROP discarded the packet
+ *   - NF_ACCEPT the packet passes, continue iterations
+ *   - NF_STOLEN gone away
+ *   - NF_QUEUE inject the packet into a different queue
+ *     (the target queue number is in the high 16 bits of the verdict)
+ *   - NF_REPEAT iterate the same cycle once more
+ *   - NF_STOP accept, but don't continue iterations
  *
  * Data and information about the packet can be fetch by using message parsing
  * functions (See \link Parsing \endlink).

  parent reply	other threads:[~2010-05-10 10:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-08 19:21 libnetfilter_queue: mark-value byte ordering? David F
2010-05-09 12:35 ` Alessandro Vesely
2010-05-09 21:49   ` Pablo Neira Ayuso
2010-05-10  2:16     ` David F
2010-05-10 10:48       ` Alessandro Vesely
2010-05-10 11:01         ` Pablo Neira Ayuso
2010-05-10 10:51       ` Alessandro Vesely [this message]
2010-05-10 14:54         ` libnetfilter_queue: mark-value byte ordering? --oops, pls discard previous copy Pablo Neira Ayuso
2010-05-10 14:48       ` libnetfilter_queue: mark-value byte ordering? Pablo Neira Ayuso
2010-05-10 14:49         ` Pablo Neira Ayuso
2010-05-10 17:25           ` David Favro
2010-05-10 18:11             ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BE7E519.7080600@tana.it \
    --to=vesely@tana.it \
    --cc=eleblond@edenwall.com \
    --cc=netfilter@meta-dynamic.com \
    --cc=netfilter@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).