netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mark Ryden" <markryde@gmail.com>
To: netfilter-devel@lists.netfilter.org
Subject: Changing packets with netfilter nf_hooks: can I avoid the forward hook?
Date: Fri, 19 Jan 2007 09:30:06 -0500	[thread overview]
Message-ID: <dac45060701190630w24758b39j6bb9be99e086c5fc@mail.gmail.com> (raw)

Hello,
  I had read the netfilter hacking HOWTO in:

  (http://www.netfilter.org/documentation/HOWTO/netfilter-hacking-HOWTO-3.html).
I want to use the nf_hooks API for a simple purpose:

My goal is to catch all packets which are sent to machine A to some
specified, known UDP port.
I want to send all these packets to a different machine, which we will
call B; the IP of that machine is
also known beforehand. I also want to change that UDP port to a known port.
I use successfully the PR_ROUTING hook to capture all packets which
are destined to that UDP
specified port on machine A. Now, I can change the destination IP
address of these captured packets to
machine B address (in the PRE_ROUTING hook function) and then catch
them in a forward hook
,set the source IP address in the fw hook , and return NF_ACCPET so
the packet will be sent.
My question is : is the forward hook a must? because as I understand ,
if I will set the
src address in the PRE_ROUTING hook to that of machine A (instead of
the real source IP address)
and the destination address to the IP address of machine B, then it
will enter the TCP/IP kernel stack, and this I want to avoid if
possible (because we are talking about a very high load server and
entering
the stack for a lot of packets has a high performance cost). So is there
a way to send the packet out on the wire in the PRE_ROUTING hook so
that it will not enter
the linux kernel networking stack?
Any help will be appreciated.

Mark

                 reply	other threads:[~2007-01-19 14:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=dac45060701190630w24758b39j6bb9be99e086c5fc@mail.gmail.com \
    --to=markryde@gmail.com \
    --cc=netfilter-devel@lists.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).