summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-11-17 11:08:53 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-11-17 11:08:53 +0000
commit0db477176bfd86205292a0bf2c2ea684dfea407c (patch)
treecb4089cc7a797be6f25d85e899e21ee697130d45
parent456114ddc3ad351c4cc6b20a3af5665a60418711 (diff)
tun devices get created (cloned) automagically when the device is opened.
the code took a shortcut which results in the new device not beeing added to its interface class group as it should. call the regular if_clone_create() instead of taking shortcuts, and all is fine. ok markus, tested Mike Belopuhov <mkb@crypt.org.ru>
-rw-r--r--sys/net/if_tun.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index aedbc76ae19..b8895f48e93 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.69 2005/11/16 10:45:33 henning Exp $ */
+/* $OpenBSD: if_tun.c,v 1.70 2005/11/17 11:08:52 henning Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -313,7 +313,11 @@ tunopen(dev_t dev, int flag, int mode, struct proc *p)
return (error);
if ((tp = tun_lookup(minor(dev))) == NULL) { /* create on demand */
- tun_clone_create(&tun_cloner, minor(dev));
+ char xname[IFNAMSIZ];
+
+ snprintf(xname, sizeof(xname), "%s%d", "tun", minor(dev));
+ if ((error = if_clone_create(xname)) != 0)
+ return (error);
if ((tp = tun_lookup(minor(dev))) == NULL)
return (ENXIO);