Changing the desination address in kernel mode netfilter hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

  I want to be able to recieve UDP packets which are destined
to machine x and to send them (also by UDP) to  different
addresses.
I want to do it in kernel mode so that it will be more efficent.
Let's say at this stage that I know a different IP address
to which the packet will be sent. (Later it will be a table).
I wrote a module which receices packets using nf_register_hook()
of netfilter.It works OK;I am using the NF_IP_PRE_ROUTING hook ;  I
tested sending UDP packets on a certain
port and I verified they get to the hook method.

What should I do in order to change the destination IP address
so it will be to a different address?
Should I only change the IP address of the destination in the UDP
header??
I started digging into the netfilter layer in the kernel but it is
quite complex.

Which hook should I use ? is it  NF_IP_PRE_ROUTING ?
or NF_IP_FORWARD ?
Any Idea?

John  Que
(Sting)

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux