netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Changing packets with netfilter nf_hooks: can I avoid the forward hook?
@ 2007-01-19 14:30 Mark Ryden
  0 siblings, 0 replies; only message in thread
From: Mark Ryden @ 2007-01-19 14:30 UTC (permalink / raw)
  To: netfilter-devel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-19 14:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-19 14:30 Changing packets with netfilter nf_hooks: can I avoid the forward hook? Mark Ryden

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