LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-14-2006, 04:01 AM   #1
zhubaining
LQ Newbie
 
Registered: Aug 2005
Posts: 12

Rep: Reputation: 0
Several questions about using netfilter


These days I am using netfilter to make kernel module which behaves like a gateway. More exactly, this module runs on a machine that has two NICs, one connects to internal network and the other connects to a router that can accesses the Internet. The module will inspect (and modify if necessary) the packets that come from one NIC, then transfer them to another NIC.

I plan to add a hook function to NF_IP_PRE_ROUTING to do this.
Now I have several questions about writing my hook function, as listed below:
1. Inside the hook function, how could I know which NIC the packet comes from? Through the Destination MAC Address that contained in the struct sk_buff?
2. For any ARP request, I want to give a reply of my own MAC (ARP spoofing), which function should I use for send back an ARP reply? What is more, after sending out reply, my hook function should return NF_STOLEN?
3. For some TCP/UDP packets, after modifying some fields (for example, destination IP or Port number), I want to forward it directly to another NIC without passing them to protocol stack and application, how can I achieve this? Again, my hook function should return NF_STOLEN?

Thanks in advance.
 
  


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
Netfilter and 2.6.16.2 krizzz Slackware 8 04-13-2006 10:17 PM
Do I really need a netfilter/firewall? Trijicon Linux - Security 6 10-15-2005 04:58 PM
netfilter query cranium2004 Linux - Networking 1 11-21-2004 12:51 PM
IPCHAINS or NETFILTER? cottonmouth Linux - Networking 1 11-18-2002 03:54 PM
Netfilter Questions jrmann1999 Linux - Networking 0 06-29-2001 07:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:11 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