Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 2006 14:55:42 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Johnny Choque <jchoque@tlmat.unican.es>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Virtual device driver programming
Message-ID:  <20060623145326.U12942@fledge.watson.org>
In-Reply-To: <006701c696ad$81b41850$2bba90c1@Altair>
References:  <006701c696ad$81b41850$2bba90c1@Altair>

next in thread | previous in thread | raw e-mail | index | archive | help

On Fri, 23 Jun 2006, Johnny Choque wrote:

> I'm interested in programming a virtual network device driver -Linux 
> concept- on a FreeBSD box. The idea behind of this sort of interface is the 
> following:
>
> "From the kernel's point of view, a network interface is a software object 
> that can process outgoing packets, and the actual transmission mechanism 
> remains hidden inside the interface driver. Even though most interfaces are 
> associated to physical devices (or, for the loopback interface, to a 
> software-only data loop), it is possible to design network interface drivers 
> that rely on other interfaces to perform actual packet transmission. The 
> idea of a ``virtual'' interface can be useful to implement special-purpose 
> processing on data packets while avoiding to hack with the network subsystem 
> of the kernel."
>
> I know that is not too complicated to program this sort of functionality in 
> linux but I would like to do it over freebsd, has anybody some idea on how 
> could I start doing it? I've been searching in the freebsd handbook but I 
> haven't found anything really relevant.

tap(4) and tun(4) describe pseudo-devices you can use to instantiate ethernet 
and tunnel interfaces from user space.  Programs attach to pseudo-devices, and 
using read/write operations on the pseudo-device, can receive and generate 
packets on the network interface.  In kernel, the ifnet(9) API is used to 
implement network interfaces -- nothing in the API requires that the 
under-side of a network interface be hardware.  In fact, a great many network 
types without underlying hardware have been implemented, including the 
loopback interface, encapsulation interfaces, and the tap/tun interface 
drivers.

Robert N M Watson
Computer Laboratory
University of Cambridge



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060623145326.U12942>