Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 May 2001 10:15:09 +0100
From:      Brian Somers <brian@Awfulhak.org>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        Brian Somers <brian@Awfulhak.org>, freebsd-arch@FreeBSD.ORG, brian@Awfulhak.org
Subject:   Re: How to handle cloning in a pseudo device. 
Message-ID:  <200105300915.f4U9F9H32416@hak.lan.Awfulhak.org>
In-Reply-To: Message from Poul-Henning Kamp <phk@critter.freebsd.dk>  of "Wed, 30 May 2001 10:48:47 %2B0200." <39755.991212527@critter> 

next in thread | previous in thread | raw e-mail | index | archive | help
> What you should do when people try to acccess /dev/tun is to
> create a hitherto unopened unit on the tunnel and mark the
> dev_t "CHEAP_CLONE".
> 
> If people just do an ls -l /dev/tun they get a random line
> and that dev_t will be GC'ed pretty quickly.

The problem I had was this:

  $ sudo kldload if_tun
  $ touch /dev/tun
  $ sudo kldunload if_tun
  $ ls -l /dev/tun*

The machine froze at that point - I assumed because if_tun hadn't 
destroy_dev()d tun0 (I haven't got the code any more so I can't give 
any more info right now).

I'm not clear about when devfs_reclaim() gets called (resulting in an 
auto-destroy_dev)) ?  Is that done by the syncer or something ?  I've 
mucked about with setting a 5 second timeout after calling make_dev() 
from the clone routine, but it doesn't exactly give me a warm feeling 
of doing things right :-/

> If they open /dev/tun they get a device and the tunopen allocates
> a softc and the dev_t stays.  When you close, remove the softc
> and the dev_t should be reclaimed again.
> 
> -- 
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe    
> Never attribute to malice what can adequately be explained by incompetence.

-- 
Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
      <http://www.Awfulhak.org>;                   <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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