From: "Roar Bjørgum Rotvik" <roarbr@tihlde.org>
To: linux lover <linux_lover2004@yahoo.com>
Cc: linux-net@vger.kernel.org, netdev@oss.sgi.com
Subject: Re: Required resources on network driver programming
Date: Mon, 20 Dec 2004 10:44:05 +0100 [thread overview]
Message-ID: <41C69EE5.7070907@tihlde.org> (raw)
In-Reply-To: <20041220074535.64217.qmail@web52208.mail.yahoo.com>
linux lover wrote:
>
> Hi all,
> I am newbie to Linux kernel
> programming. I want to write my own virtual network
> device driver that take every packets from IP layer
> just print the contents of packet(header part with its
> starting addresses only) and send it to actual device
> driver for packet transmission and at receiving end
> receive packet from NIC card again print the header
> addresses and send it to upper layer for normal packet
> processing.
> I require help about where can i get
> resources or any book for writing virtual network
> driver with SAMPLE EXAMPLES?
Another mail gave you pointers to driver programming.
Here are links to TUN/TAP, a virtual ethernet (or point-to-point) device
driver in the Linux kernel.
With TAP you have a virtual ethernet device, where the device driver is
replaced with a userspace application (that you write) that receives all
data sent to the tap device (for instance tap0) from the linux kernel
network stack.
This data contains ethernet header + all other payload (like IP-header +
IP data with either TCP/UDP or arp-packets)..
Your userspace app may also send data to a tap-device and this data will
be sent to the linux network stack like it came from a real ethernet device.
So your userspace app may do whatever it want with the data, it may
print out the contents of the IP layer and forward the data to another
PC using the real ethernet device (eth0, or another network medium).
The other PC may do the opposite, i.e. receive the data from the
ethernet device and send then to the tap device.
Your application may even encapsulate the data send between the two PC
in any protocol you may like (you got tunneling).
If you wanted to do all in kernel mode this is not what you want, but
tun/tap code may give you some tips on how to create a virtual ethernet
device..
See these links:
http://lxr.linux.no/source/drivers/net/tun.c?v=2.6.8.1
http://vtun.sourceforge.net/tun/
http://vtun.sourceforge.net/tun/faq.html
--
Roar B. Rotvik
next prev parent reply other threads:[~2004-12-20 9:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-20 7:45 Required resources on network driver programming linux lover
2004-12-20 9:06 ` Michael Renzmann
2004-12-20 9:44 ` Roar Bjørgum Rotvik [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-12-20 21:34 Rudolf Ladyzhenskii
2004-12-20 21:34 Rudolf Ladyzhenskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41C69EE5.7070907@tihlde.org \
--to=roarbr@tihlde.org \
--cc=linux-net@vger.kernel.org \
--cc=linux_lover2004@yahoo.com \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).