LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux > 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
 
Thread Tools
Old 11-06-2009, 02:32 AM   #1
dodo76
LQ Newbie
 
Registered: Oct 2009
Posts: 5
Thanked: 0
sniffing AND stealing packets


[Log in to get rid of this advertisement]
Hello!

If you add a PF_PACKET socket then you will be sniffing all packets that is received on your interface. But your sniffing packets are only copies of the packet which will also be heading up the normal IP stack and maybe processed in other packet handlers too.

Is there a way to "steal" the original packet? I.e. to stop it from being processed by other packet handlers?

Thanks
BR
Robert
windows_vista dodo76 is offline     Reply With Quote
Old 11-06-2009, 12:11 PM   #2
nimnull22
Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1
Posts: 301
Thanked: 16
To put another comp between and process the traffic.
linux nimnull22 is offline     Reply With Quote
Old 11-08-2009, 03:29 PM   #3
dodo76
LQ Newbie
 
Registered: Oct 2009
Posts: 5
Thanked: 0

Original Poster
Quote:
Originally Posted by nimnull22 View Post
To put another comp between and process the traffic.
Thanks for answering but this was not what I meant.

I want to process the packet, but I want to do it at kernel level and NOT involve the usual network processing that exist in the kernel.

To be more frank:
I want to optimize the packet handling in the kernel, by writing the code myself. But I do not want to touch the kernel. Preferably I just want to write a module which I later can export to "any" linux distro (i.e. a portable solution).

Thanks
BR
Robert
windows_vista dodo76 is offline     Reply With Quote
Old 11-08-2009, 03:45 PM   #4
nimnull22
Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1
Posts: 301
Thanked: 16
Quote:
Originally Posted by dodo76 View Post

Is there a way to "steal" the original packet? I.e. to stop it from being processed by other packet handlers?
This is not the packets processing, this is stealing.

Quote:
Originally Posted by dodo76 View Post
I want to optimize the packet handling in the kernel...
What is wrong with it now. Kernel has a lot of different modules to process traffic.
linux nimnull22 is offline     Reply With Quote
Old 11-09-2009, 01:31 AM   #5
dodo76
LQ Newbie
 
Registered: Oct 2009
Posts: 5
Thanked: 0

Original Poster
Quote:
Originally Posted by nimnull22 View Post
This is not the packets processing, this is stealing.
I used the word "steal" since I wanted to know if there was a way to stop the kernel from making a copy to each of the packet handlers. I have seen that there is this mechanism called NETPOLL. It can "consume" the packet and essentially "steal" it from the packet handlers. But NETPOLL seems to have been developed for faulty situations (more like a network debug tool).

Quote:
Originally Posted by nimnull22 View Post
What is wrong with it now. Kernel has a lot of different modules to process traffic.
I do suspect that the kernel does more than I want to do. I was hoping that I were going to be able to reduce the processing time of each packet by writing the processing code myself. It seems you can easily do this by just adding a PF_PACKET handler (like sniff tools do). But since the packet will still be copied to the ordinary IP stack I assume that there will be at least some overhead (even if I have no socket connected for that packets port).

BR
Robert
windows_vista dodo76 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
Hijacking/stealing packets eddchr Linux - Networking 5 10-08-2008 02:32 AM
What is the pupose of sniffing network packets? LinuxCrazy Linux - Security 3 06-09-2007 02:30 PM
Sniffing Packets - Outside my LAN Palula Linux - Software 2 09-20-2005 01:31 PM
algorithm for sniffing IP packets? shrike_912 Programming 2 06-08-2004 03:48 PM
Sniffing: tcpdump gets some initial packets merlin-themage Linux - Networking 0 05-28-2004 08:07 AM


All times are GMT -5. The time now is 03:34 AM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration