netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* libnetfilter_queue: mark-value byte ordering?
@ 2010-05-08 19:21 David F
  2010-05-09 12:35 ` Alessandro Vesely
  0 siblings, 1 reply; 12+ messages in thread
From: David F @ 2010-05-08 19:21 UTC (permalink / raw)
  To: netfilter

Hi,

I am using libnetfilter_queue to set the mark on some queued packets 
[nfq_set_verdict_mark(), with verdict==NF_ACCEPT]; then in a later 
iptables chain, I matched on -m mark, looking for my previously marked 
packets, but apparently they didn't match.  So I logged packets and saw 
my packets with my mark values in the log entries, but they seemed to be 
in reverse byte-order (I'm on a little-endian machine).  I changed my 
code to use htonl() on the mark-value prior to calling 
nfq_set_verdict_mark(), and it all suddenly started working.

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?

Thanks in advance,
-- David F.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-05-10 18:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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       ` 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

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).