From: Alessandro Vesely <vesely@tana.it>
To: David F <netfilter@meta-dynamic.com>
Cc: netfilter <netfilter@vger.kernel.org>
Subject: Re: libnetfilter_queue: mark-value byte ordering?
Date: Sun, 09 May 2010 14:35:16 +0200 [thread overview]
Message-ID: <4BE6AC04.5000504@tana.it> (raw)
In-Reply-To: <4BE5B9CA.5090606@meta-dynamic.com>
David F wrote:
> I changed my
> code to use htonl() on the mark-value prior to calling
> nfq_set_verdict_mark(), and it all suddenly started working.
Since it is not documented, everyone rediscovers it anew. See e.g.
http://www.gossamer-threads.com/lists/iptables/devel/62591
> I had a quick look through the source code of libnetfilter_queue and
> libnfnetlink_queue and didn't see any obvious byte-order conversion
> prior to sending to the kernel, so I wonder if anyone could help me
> understand,
> * Is the mark value _supposed_ to be supplied in network byte order or
> is something else going on here;
> and if so,
> * Since the mark never hits the wire, why would it ever be kept in
> network byte order?
The latter is an issue in kernel programming, where all code in a
given set assumes an established byte order. In facts, it is not
uncommon to have the same word byteswapped multiple times on the
same machine for the sake of obeying conventions.
HTH
next prev parent reply other threads:[~2010-05-09 12:35 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 [this message]
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 ` libnetfilter_queue: mark-value byte ordering? --oops, pls discard previous copy Alessandro Vesely
2010-05-10 14:54 ` 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=4BE6AC04.5000504@tana.it \
--to=vesely@tana.it \
--cc=netfilter@meta-dynamic.com \
--cc=netfilter@vger.kernel.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).