LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-13-2012, 12:28 PM   #1
palt
LQ Newbie
 
Registered: Jul 2012
Posts: 7

Rep: Reputation: Disabled
How to send IP packets directly to IP layer?


Hello!
At first I should say that I have no a lot of experience in Linux network programming under the kernel. But I want to implement one idea that is interesting for me. And this implementation should work under the kernel.
Shortly this idea consist in using netfilter framework to filter internal IP traffic. I want to redirect all input IP traffic from remote host (for example under Windows OS) to my machine. How it will work under Windows is not important now. One importance I will receive external IP traffic via serial line. Receiving IP packets is implemented under the kernel by special module. Now I want to send received IP packets directly to IP layer of my Linux machine to use netfilter framework to filter these packets. But I don't know exactly how to do this . Is it possible to use ip_rcv() function directly? Or may be I should emulate a network device? Also may be somebody have source examples for my situation...

Thanks!
 
Old 07-13-2012, 04:41 PM   #2
Maz_
LQ Newbie
 
Registered: May 2006
Location: Finland
Distribution: fedora
Posts: 15

Rep: Reputation: 0
I guess it would be way better to do that in userspace. If you really want to do that in kernel, you'd better go ask this in netdev mail list. If your idea is reasonable you'll propably get help - it if is not - well, you'll hear that too. Just do not forget the etiquette when mailing at netdev

in userspace you could propably get packets for filtering using netlink sockets.
 
Old 07-14-2012, 05:57 AM   #3
palt
LQ Newbie
 
Registered: Jul 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Maz, thanks for your reply! I want to use the kernel level due to perfomance. High level of perfomance if very important for me.
As you recomend I have read a part of documentation to the netlink. To get filtered packets I should use NETLINK_FIREWALL protocol. But I didn't find what kind of netlink protocols I should use to send IP packets into the netfilter kernel chains to filter these packets. Can you promt to me what protocol I should use to send IP packets into the kernel?
 
Old 07-18-2012, 03:45 AM   #4
SuperJediWombat!
Member
 
Registered: Apr 2009
Location: Perth, Australia
Distribution: Ubuntu/CentOS
Posts: 208

Rep: Reputation: 51
That has already been implemented in the kernel using tun/tap devices.
 
1 members found this post helpful.
Old 07-20-2012, 03:59 PM   #5
palt
LQ Newbie
 
Registered: Jul 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
SuperJediWombat,
thanks! I've read short information about tun/tap devices. I think it seems to be very intersting for me. I'll continue to investigate these devices. Thanks!
 
  


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
Directly access received packets in buffer hjazz6 Linux - Networking 1 03-30-2011 03:25 PM
netstat : packets directly received from backlog pcarey Linux - Newbie 1 06-12-2009 08:15 AM
IP layer send packet shuperb Linux - Kernel 2 06-27-2008 11:19 PM
Replay Packets at the device layer with a kernel daemon mriganayan Linux - Networking 1 03-16-2007 01:37 PM
LICQ: send through server OR send directly mikeshn Linux - Software 0 06-09-2003 06:14 PM

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

All times are GMT -5. The time now is 09:22 PM.

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