Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Mike Herms" <mherms@gmail.com>
To: netfilter@vger.kernel.org
Subject: NFQUEUE handler source example
Date: Tue, 22 Apr 2008 10:04:18 -0400	[thread overview]
Message-ID: <c1ae779f0804220704s3a419fbu2e507ced85a6aa06@mail.gmail.com> (raw)

Short question:
Does anyone have example source code for user land handling of packets
off of NFQUEUE in a bridged environment?  I believe that I've
successfully created a bridged environment as follows:
============================
ifconfig eth0 promisc up
ifconfig eth0 promisc up
brctl addbr br0
brctl stp br0 off
brctl setbridgeprio br0 2
brctl addif br0 eth0
brctl addif br0 eth1
ifconfig br0 0.0.0.0

echo 1 > /proc/sys/net/ipv4/ip_forward
============================
Using the above configuration and connecting my box between two
networks or a network and a client computer works great.  Both sides
work and the bridge appears transparent to them.

I try to handle packets in my userland application by sending them to
an NFQUEUE using:
============================
sudo iptables -t mangle -A FORWARD -m physdev --physdev-in eth0 -j
NFQUEUE --queue-num 0
sudo iptables -t mangle -A FORWARD -m physdev --physdev-in eth1 -j
NFQUEUE --queue-num 0
============================

After I create the above two rules traffic no longer gets through the
bridge, as I'd suspect since it must now be handled by someone reading
from the NFQUEUE.

============================
sudo iptables -t mangle --list -v
============================
Shows packets reaching both physical devices.  My problem is I cannot
get my application to get a notification that something is in the
queue so it can be handled.  I'm can post my source but a working
skeleton example would get me there just as quickly without people
debugging my code.

Version information:
bridge-utils v1.2
iptables v1.4.0
ebtables v2.0.8-1 (May 2007
arptables v0.0.3-3

Thanks,
Mike Herms

             reply	other threads:[~2008-04-22 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22 14:04 Mike Herms [this message]
2008-04-22 20:17 ` NFQUEUE handler source example Eric Leblond
2008-04-22 20:43   ` Mike Herms
2008-04-22 21:30     ` Eric Leblond

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=c1ae779f0804220704s3a419fbu2e507ced85a6aa06@mail.gmail.com \
    --to=mherms@gmail.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