LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-26-2004, 06:49 AM   #1
doraiashok
LQ Newbie
 
Registered: Nov 2003
Posts: 19

Rep: Reputation: 0
IP Packet filter


Hi,

Does any one know how to filter a IP packet based on data using socket programming?

I have used raw socket i.e, SOCK_RAW with PF_PACKET but i seem to get a copy of the received IP packet and not the packet itself so i am not able to discard it.

I have been having this problem for a long long time so please help.

Thanx.
 
Old 02-26-2004, 07:35 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
I think that's not really possible. To handle the actual packets you need to be in kernelspace. One possible way I can think of, though, is to use netfilter (iptables) to specify a rule that forwards a packet to userspace. Use the "QUEUE" target for this.

The only thing I know about this is that it should be possible (if the kernel is configured to support this). It's only mentioned in the man page (search for "userspace"). Have a look in the netfilter doc's in the kernel sources or on www.netfilter.org for more info.
 
Old 02-26-2004, 11:21 AM   #3
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
if you want to write a kernel level filter, see here: www.1nfamus.netfirms for an example or search the board for firewall i've postd it here as well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Packet Filter to redirect a packet to a user level process akawale Linux - Networking 3 09-01-2006 12:06 PM
About BSF(BSD Packet Filter) docterling Linux - Networking 5 05-20-2004 07:59 AM
packet filter firewall naveenpurswani Programming 2 03-29-2004 02:54 PM
Differences between a simple packet filter, and a firewall... Grim Reaper Linux - Networking 9 03-06-2003 01:32 AM
Network Packet Filter vs ipchains Nephlite Linux - Networking 1 02-04-2002 03:16 AM

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

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