Subject: Re: Sample (but possibly useful) LKM: fake Ethernet device
To: Neil Ludban <>
From: Manuel Bouyer <>
List: tech-kern
Date: 11/09/2003 18:43:52
On Sat, Nov 08, 2003 at 05:36:13PM -0500, Neil Ludban wrote:
> >[...]
> >>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.
> Do you have any examples where it would be correct or easier for the
> application to be doing this configuration?  I've always thought of
> it as administrative setup, so ifconfig would be used to create the
> clone, set the media, and add routes (or brconfig); ifconfig doesn't
> support TUNSLMODE.
> The application should have a way of confirming the media type (and
> might be required to do so to prevent accidents?).

Yes, and for this the application can use TUNSLMODE. No need for a new minor

> >>- doesn't delete routes when device is closed
> >
> >
> >It probably shouldn't. We just need to turn the interface down.
> IMHO the character device is like the wire between a physical NIC and
> the switch.  A closed device would be equivalent to no carrier link
> status.

Yes, and this is just setting link status to down, not deleting routes
or addresses.
Maybe it's better than bringing the whole interface down, but in any case
no address or route should be deleted.

> >>- removed support for ALTQ
> >
> >
> >Why ?
> >
> IIRC, tun_start was conditionally compiled in only when ALTQ support
> was compiled in, and ether_output needed it.  It was easier to remove
> than to hope it still worked correctly after modification.  I'll put it
> back in when I'm finished.


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