don't use DVUNIT_ANY as unit number to attach pseudo devices,
use FSTATE_STAR and cf_unit=0 like normal devices. Thanks to Arnaud Degroote for the bug report and testing.
This commit is contained in:
parent
004b1a75b4
commit
814e248430
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: if_tap.c,v 1.26 2007/03/04 06:03:17 christos Exp $ */
|
/* $NetBSD: if_tap.c,v 1.27 2007/03/09 18:42:22 drochner Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2004 The NetBSD Foundation.
|
* Copyright (c) 2003, 2004 The NetBSD Foundation.
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.26 2007/03/04 06:03:17 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.27 2007/03/09 18:42:22 drochner Exp $");
|
||||||
|
|
||||||
#if defined(_KERNEL_OPT)
|
#if defined(_KERNEL_OPT)
|
||||||
#include "bpfilter.h"
|
#include "bpfilter.h"
|
||||||
|
@ -588,11 +588,6 @@ tap_clone_create(struct if_clone *ifc, int unit)
|
||||||
* interface cloning API, and call tap_clone_create above.
|
* interface cloning API, and call tap_clone_create above.
|
||||||
* opening the cloning device node, whose minor number is TAP_CLONER.
|
* opening the cloning device node, whose minor number is TAP_CLONER.
|
||||||
* See below for an explanation on how this part work.
|
* See below for an explanation on how this part work.
|
||||||
*
|
|
||||||
* config_attach_pseudo can be called with unit = DVUNIT_ANY to have
|
|
||||||
* autoconf(9) choose a unit number for us. This is what happens when
|
|
||||||
* the cloner is openend, while the ifcloner interface creates a device
|
|
||||||
* with a specific unit number.
|
|
||||||
*/
|
*/
|
||||||
static struct tap_softc *
|
static struct tap_softc *
|
||||||
tap_clone_creator(int unit)
|
tap_clone_creator(int unit)
|
||||||
|
@ -602,8 +597,14 @@ tap_clone_creator(int unit)
|
||||||
cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK);
|
cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK);
|
||||||
cf->cf_name = tap_cd.cd_name;
|
cf->cf_name = tap_cd.cd_name;
|
||||||
cf->cf_atname = tap_ca.ca_name;
|
cf->cf_atname = tap_ca.ca_name;
|
||||||
cf->cf_unit = unit;
|
if (unit == -1) {
|
||||||
cf->cf_fstate = FSTATE_STAR;
|
/* let autoconf find the first free one */
|
||||||
|
cf->cf_unit = 0;
|
||||||
|
cf->cf_fstate = FSTATE_STAR;
|
||||||
|
} else {
|
||||||
|
cf->cf_unit = unit;
|
||||||
|
cf->cf_fstate = FSTATE_NOTFOUND;
|
||||||
|
}
|
||||||
|
|
||||||
return (struct tap_softc *)config_attach_pseudo(cf);
|
return (struct tap_softc *)config_attach_pseudo(cf);
|
||||||
}
|
}
|
||||||
|
@ -706,7 +707,7 @@ tap_dev_cloner(struct lwp *l)
|
||||||
if ((error = falloc(l, &fp, &fd)) != 0)
|
if ((error = falloc(l, &fp, &fd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
if ((sc = tap_clone_creator(DVUNIT_ANY)) == NULL) {
|
if ((sc = tap_clone_creator(-1)) == NULL) {
|
||||||
FILE_UNUSE(fp, l);
|
FILE_UNUSE(fp, l);
|
||||||
ffree(fp);
|
ffree(fp);
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
|
|
Loading…
Reference in New Issue