Skip to contentSkip to conversation

How to reflect received packet in PreRouting hook

DISCUSSION jblicn 1 participant 1 message Mar 30, 2003 netfilter

lore
Share & tools
lore

jblicn

author
#0 lore raw

Dear all,

I am developing a kernel module to handle IP packet. My problem is how to reflect received packet to the sender.

I got the packet by a NF_PRE_ROUTING hook. I switched the source and destination address( which is local address ) of the IP header, and then return NF_ACCEPT.But after doing this, the packet will be dropped.

If I switch the src and dst address, and modify the src(local) address to be a non local address. The packet will traverse the FORWARD and POST_ROUTING hooks, and will be send back to the sender.

But change the src address to be a non-local address is not allowed in my project.

How to solve this problem.

Thank you very much

Jiangbo Li