Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Eric Leblond <eric@regit.org>
To: "Andreas Birkjær (ABI)" <abi@thrane.com>,
	"netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: NFQNL_COPY_META not working?
Date: Wed, 26 Oct 2011 15:00:21 +0200	[thread overview]
Message-ID: <dec0d22e-3d9b-4ab4-8d80-56bb09382971@email.android.com> (raw)
In-Reply-To: <76B3922156AB24469E781F6224C2239F0151D1@ly-ex-02.thrane.tt.ad>

Hello


"Andreas Birkjær (ABI)" <abi@thrane.com> a écrit :

>Hello.
>
>I have been trying to get the the netfilter queue working, everything
>is seemingly allright as long as I pass the entire packet to userspace.
>(nfq_set_mode(qh, NFQNL_COPY_PACKET, 0xfffff)).
>It should be noted that I am testing this on the nfqnl_test.c which is
>found here:
>http://svn.netfilter.org/netfilter/trunk/libnetfilter_queue/utils/nfqnl_test.c

Copy Meta will not send the payload to userspace. If you want a partial transfer of payload use copy packet and put the size as second parameter of nfq-set-mode.

BR

>
>As long as I copy the entire packet to userspace, everything seems to
>be running smoothly, I can retrieve whatever I want from the packet.
>
>However, I do not want to pass the entire packet to userspace - I just
>need to check/modify the IP and/or TCP header and then pass the packet
>along. When I try to use the NFQNL_COPY_META mode, then the program
>fails. (I am testing this on the beforementioned nfqnl_test.c file with
>no modifications beside the META mode.
>
>Apparently the nfq_get_payload() function always returns -1.
>
>I have tried searching for an answer, but almost everywhere I look,
>people are happy passing the entire packet, does the nfqnl_test.c need
>additional modifications in order to run in NFQNL_COPY_META mode or
>what?
>When using NFQNL_COPY_META mode, I still get some output from the queue
>(hw_protocol, hook, packet id etc) but as stated, the nfq_get_payload
>returns -1.
>
>I have not found anything on the official site stating that additional
>modifications are needed when running in META mode, but I might be
>overlooking something?
>
>Another small question, I am a little unclear as to exactly what
>information is passed in META mode. As far as I can understand, the
>content of the headers are passed to userspace right? Meaning
>IP/TCP/HTTP... headers are passed but payload is not?
>
>I hope someone is able to help me get to the bottom of this.
>
>Kind regards
>Andreas
>
>
>--
>To unsubscribe from this list: send the line "unsubscribe netfilter" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté.

  reply	other threads:[~2011-10-26 13:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 11:24 NFQNL_COPY_META not working? Andreas Birkjær (ABI)
2011-10-26 13:00 ` Eric Leblond [this message]
2011-10-26 16:48 ` Sam Roberts

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=dec0d22e-3d9b-4ab4-8d80-56bb09382971@email.android.com \
    --to=eric@regit.org \
    --cc=abi@thrane.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