Make tun interfaces perform auto-creation. This means that if a

program opens /dev/tun# and tun# has not been SIOCIFCREATE'd already,
it will be SIOCIFCREATE'd automatically.  FreeBSD's tun interfaces
behave in a somewhat similar fashion.
This commit is contained in:
atatat 2002-07-29 16:53:30 +00:00
parent c38f2b0214
commit 6675196afb

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tun.c,v 1.51 2002/03/13 06:43:18 itojun Exp $ */
/* $NetBSD: if_tun.c,v 1.52 2002/07/29 16:53:30 atatat Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
@ -15,7 +15,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.51 2002/03/13 06:43:18 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.52 2002/07/29 16:53:30 atatat Exp $");
#include "tun.h"
@ -230,6 +230,11 @@ tunopen(dev, flag, mode, p)
tp = tun_find_unit(dev);
if (!tp) {
(void)tun_clone_create(&tun_cloner, minor(dev));
tp = tun_find_unit(dev);
}
if (!tp)
return (ENXIO);