| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_tap.c,v 1.57 2009/04/11 23:05:26 christos Exp $ */ | | 1 | /* $NetBSD: if_tap.c,v 1.58 2009/07/23 17:53:17 plunky Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation. | | 4 | * Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -23,27 +23,27 @@ | | | @@ -23,27 +23,27 @@ |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * tap(4) is a virtual Ethernet interface. It appears as a real Ethernet | | 30 | * tap(4) is a virtual Ethernet interface. It appears as a real Ethernet |
31 | * device to the system, but can also be accessed by userland through a | | 31 | * device to the system, but can also be accessed by userland through a |
32 | * character device interface, which allows reading and injecting frames. | | 32 | * character device interface, which allows reading and injecting frames. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | __KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.57 2009/04/11 23:05:26 christos Exp $"); | | 36 | __KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.58 2009/07/23 17:53:17 plunky Exp $"); |
37 | | | 37 | |
38 | #if defined(_KERNEL_OPT) | | 38 | #if defined(_KERNEL_OPT) |
39 | #include "bpfilter.h" | | 39 | #include "bpfilter.h" |
40 | #include "opt_modular.h" | | 40 | #include "opt_modular.h" |
41 | #include "opt_compat_netbsd.h" | | 41 | #include "opt_compat_netbsd.h" |
42 | #endif | | 42 | #endif |
43 | | | 43 | |
44 | #include <sys/param.h> | | 44 | #include <sys/param.h> |
45 | #include <sys/systm.h> | | 45 | #include <sys/systm.h> |
46 | #include <sys/kernel.h> | | 46 | #include <sys/kernel.h> |
47 | #include <sys/malloc.h> | | 47 | #include <sys/malloc.h> |
48 | #include <sys/conf.h> | | 48 | #include <sys/conf.h> |
49 | #include <sys/device.h> | | 49 | #include <sys/device.h> |
| @@ -648,27 +648,27 @@ static struct tap_softc * | | | @@ -648,27 +648,27 @@ static struct tap_softc * |
648 | tap_clone_creator(int unit) | | 648 | tap_clone_creator(int unit) |
649 | { | | 649 | { |
650 | struct cfdata *cf; | | 650 | struct cfdata *cf; |
651 | | | 651 | |
652 | cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK); | | 652 | cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK); |
653 | cf->cf_name = tap_cd.cd_name; | | 653 | cf->cf_name = tap_cd.cd_name; |
654 | cf->cf_atname = tap_ca.ca_name; | | 654 | cf->cf_atname = tap_ca.ca_name; |
655 | if (unit == -1) { | | 655 | if (unit == -1) { |
656 | /* let autoconf find the first free one */ | | 656 | /* let autoconf find the first free one */ |
657 | cf->cf_unit = 0; | | 657 | cf->cf_unit = 0; |
658 | cf->cf_fstate = FSTATE_STAR; | | 658 | cf->cf_fstate = FSTATE_STAR; |
659 | } else { | | 659 | } else { |
660 | cf->cf_unit = unit; | | 660 | cf->cf_unit = unit; |
661 | cf->cf_fstate = FSTATE_FOUND; | | 661 | cf->cf_fstate = FSTATE_NOTFOUND; |
662 | } | | 662 | } |
663 | | | 663 | |
664 | return device_private(config_attach_pseudo(cf)); | | 664 | return device_private(config_attach_pseudo(cf)); |
665 | } | | 665 | } |
666 | | | 666 | |
667 | /* | | 667 | /* |
668 | * The clean design of if_clone and autoconf(9) makes that part | | 668 | * The clean design of if_clone and autoconf(9) makes that part |
669 | * really straightforward. The second argument of config_detach | | 669 | * really straightforward. The second argument of config_detach |
670 | * means neither QUIET nor FORCED. | | 670 | * means neither QUIET nor FORCED. |
671 | */ | | 671 | */ |
672 | static int | | 672 | static int |
673 | tap_clone_destroy(struct ifnet *ifp) | | 673 | tap_clone_destroy(struct ifnet *ifp) |
674 | { | | 674 | { |