xref: /onnv-gate/usr/src/uts/common/inet/ip/ipsecespddi.c (revision 6668:9fa3fc23fb8f)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
55240Snordmark  * Common Development and Distribution License (the "License").
65240Snordmark  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6668Smarkfen  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #include <sys/types.h>
290Sstevel@tonic-gate #include <sys/conf.h>
300Sstevel@tonic-gate #include <sys/modctl.h>
310Sstevel@tonic-gate #include <sys/errno.h>
320Sstevel@tonic-gate #include <inet/common.h>
330Sstevel@tonic-gate #include <inet/ip.h>
340Sstevel@tonic-gate #include <inet/ipsec_impl.h>
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #define	INET_NAME	"ipsecesp"
375240Snordmark #define	INET_MODSTRTAB	ipsecespinfo
385240Snordmark #define	INET_DEVSTRTAB	ipinfov6
39*6668Smarkfen #define	INET_MODDESC	"IPsec ESP STREAMS module"
40*6668Smarkfen #define	INET_DEVDESC	"IPsec ESP STREAMS driver"
415240Snordmark #define	INET_DEVMINOR	0
420Sstevel@tonic-gate #define	INET_DEVMTFLAGS	IP_DEVMTFLAGS	/* since as a driver we're ip */
430Sstevel@tonic-gate #define	INET_MODMTFLAGS	(D_MP|D_MTOCEXCL|D_MTOUTPERIM)
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #include "../inetddi.c"
460Sstevel@tonic-gate 
470Sstevel@tonic-gate int
_init(void)480Sstevel@tonic-gate _init(void)
490Sstevel@tonic-gate {
500Sstevel@tonic-gate 	int	error;
510Sstevel@tonic-gate 
520Sstevel@tonic-gate 	/*
530Sstevel@tonic-gate 	 * Note: After mod_install succeeds, another thread can enter
540Sstevel@tonic-gate 	 * therefore all initialization is done before it and any
550Sstevel@tonic-gate 	 * de-initialization needed done if it fails.
560Sstevel@tonic-gate 	 */
570Sstevel@tonic-gate 	if (!ipsecesp_ddi_init())
580Sstevel@tonic-gate 		return (ENOMEM);
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 	error = mod_install(&modlinkage);
610Sstevel@tonic-gate 	if (error != 0)
620Sstevel@tonic-gate 		ipsecesp_ddi_destroy();
630Sstevel@tonic-gate 
640Sstevel@tonic-gate 	return (error);
650Sstevel@tonic-gate }
660Sstevel@tonic-gate 
670Sstevel@tonic-gate int
_fini(void)680Sstevel@tonic-gate _fini(void)
690Sstevel@tonic-gate {
700Sstevel@tonic-gate 	int	error;
710Sstevel@tonic-gate 
720Sstevel@tonic-gate 	error = mod_remove(&modlinkage);
730Sstevel@tonic-gate 	if (error != 0)
740Sstevel@tonic-gate 		return (error);
750Sstevel@tonic-gate 
760Sstevel@tonic-gate 	ipsecesp_ddi_destroy();
770Sstevel@tonic-gate 	return (0);
780Sstevel@tonic-gate }
790Sstevel@tonic-gate 
800Sstevel@tonic-gate int
_info(struct modinfo * modinfop)810Sstevel@tonic-gate _info(struct modinfo *modinfop)
820Sstevel@tonic-gate {
830Sstevel@tonic-gate 	return (mod_info(&modlinkage, modinfop));
840Sstevel@tonic-gate }
85