Subject: Re: Sample (but possibly useful) LKM: fake Ethernet device
To: Neil Ludban <>
From: Manuel Bouyer <>
List: tech-kern
Date: 11/08/2003 19:09:16
On Fri, Nov 07, 2003 at 05:36:32PM -0500, Neil Ludban wrote:
> I've done some hacking on tun to support this.  Reading the character
> device with hexdump(1) was showing correct packets (ping from another
> window), then the project got sidelined by real work before I could test
> writes.  I think BPF was working as well.
> Several options if anybody wants to see this:
> 1) ask and I'll forward source files (from 1.6W)
> 2) I can rename and simplify into an ethernet only version
> 3) take more time and figure out how to rewrite as a generic tun

Well, tun(4) is probably the right place to put it.

> The hacked version:
> - uses minor number to determine if new clone type is IP or ethernet

I think this should be done from the TUNSLMODE ioctl, or maybe with the
ifconfig link* flags.

> - doesn't require super-user privileges (uses device permissions)

I don't see any reasons to restrict it to super-user.
Does anyone know why the current tun device restricts access to super-user ?

> - doesn't delete routes when device is closed

It probably shouldn't. We just need to turn the interface down.

> - removed support for ALTQ

Why ?

Manuel Bouyer <>
     NetBSD: 23 ans d'experience feront toujours la difference