Home | History | Annotate | Download | only in ip
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License, Version 1.0 only
      6  * (the "License").  You may not use this file except in compliance
      7  * with the License.
      8  *
      9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10  * or http://www.opensolaris.org/os/licensing.
     11  * See the License for the specific language governing permissions
     12  * and limitations under the License.
     13  *
     14  * When distributing Covered Code, include this CDDL HEADER in each
     15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16  * If applicable, add the following below this CDDL HEADER, with the
     17  * fields enclosed by brackets "[]" replaced with your own identifying
     18  * information: Portions Copyright [yyyy] [name of copyright owner]
     19  *
     20  * CDDL HEADER END
     21  */
     22 /*
     23  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
     24  * Use is subject to license terms.
     25  */
     26 
     27 /* 6to4 tunnel module */
     28 
     29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     30 
     31 #include <sys/types.h>
     32 #include <sys/stream.h>
     33 #include <sys/stropts.h>
     34 
     35 #include <sys/isa_defs.h>
     36 
     37 #include <inet/common.h>
     38 
     39 #include <inet/ip.h>
     40 #include <inet/ip6.h>
     41 #include <inet/tun.h>
     42 
     43 #include <sys/modctl.h>
     44 
     45 /* streams linkages */
     46 static struct module_info tun6to4info = {
     47 	TUN6TO4_MODID, TUN6TO4_NAME, 1, INFPSZ, 65536, 1024
     48 };
     49 
     50 static struct qinit tun6to4rinit = {
     51 	(pfi_t)tun_rput,
     52 	(pfi_t)tun_rsrv,
     53 	tun_open,
     54 	tun_close,
     55 	NULL,
     56 	&tun6to4info
     57 };
     58 
     59 static struct qinit tun6to4winit = {
     60 	(pfi_t)tun_wput,
     61 	(pfi_t)tun_wsrv,
     62 	NULL,
     63 	NULL,
     64 	NULL,
     65 	&tun6to4info
     66 };
     67 
     68 static struct streamtab tun6to4_strtab = {
     69 	&tun6to4rinit, &tun6to4winit, NULL, NULL
     70 };
     71 
     72 static struct fmodsw tun6to4_fmodsw = {
     73 	TUN6TO4_NAME,
     74 	&tun6to4_strtab,
     75 	(D_MP | D_MTQPAIR | D_MTPUTSHARED)
     76 };
     77 
     78 static struct modlstrmod modlstrmod = {
     79 	&mod_strmodops, "6to4 tunneling module", &tun6to4_fmodsw
     80 };
     81 
     82 static struct modlinkage modlinkage = {
     83 	MODREV_1,
     84 	&modlstrmod,
     85 	NULL
     86 };
     87 
     88 int
     89 _init()
     90 {
     91 	return (mod_install(&modlinkage));
     92 }
     93 
     94 int
     95 _fini()
     96 {
     97 	return (mod_remove(&modlinkage));
     98 }
     99 
    100 int
    101 _info(struct modinfo *modinfop)
    102 {
    103 	return (mod_info(&modlinkage, modinfop));
    104 }
    105