LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-01-2009, 09:24 AM   #1
Kunsheng
Member
 
Registered: Mar 2009
Posts: 82

Rep: Reputation: 16
Priorities on Netfilter hook and kernel socket


Hello everyone,

I am working on a kernel module that would situate on a router between two machines in a intranet.

Basically I don't want the client know the server but my router.
The router is reponsible for forwading packets to the server and send resopnse to client from the server transparently.

Now I simply finishing 'fowarding ' by netfilter in 'Pre_route' hook. ( Modifing my_ipheader->daddr in receiving client or server packets).

The new feaures I am going to add is buffering on the router.
I am thinking of establish a kernel socket in a separate thread in the router, then when I catch the packet from client or server in netfilter, I would modify the my_ipheader->daddr to the real address of the router, in which the kernel socket would handle and buffering the packets.

yet I am not quite sure about the following issues:

1. Do I have to handle things in Post-route hook ? My module currently works good in forwarding (since my router is not really forwarding anything besides packets from the client and the server). I am not sure whether there are some potential issues there.

2. For the kernel socket, if I establish one, would it receive packets that between pre_route hook and post_route hook ? (After pre_local_in and before post_local_in)


I know this could somewhat be done with user-level socket but I really like to test netfilter and kernel socket.

Any idea is well appreciated,


Thanks,

-Kun

Last edited by Kunsheng; 05-01-2009 at 12:14 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send copied skb in netfilter hook? simon_qwl Programming 5 04-18-2012 05:24 AM
Looking for idea on firewall project based on netfilter hook Kunsheng Programming 2 03-18-2009 04:59 PM
netfilter hook problem mihirsevak Linux - Networking 2 10-21-2007 01:17 AM
netfilter hook forward packets tim24 Linux - Networking 3 03-27-2006 03:14 PM
netfilter hook function error jinxcat Programming 1 09-23-2005 04:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration