xref: /onnv-gate/usr/src/uts/common/inet/ip/keysockddi.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/errno.h>
310Sstevel@tonic-gate #include <sys/modctl.h>
320Sstevel@tonic-gate #include <inet/common.h>
330Sstevel@tonic-gate #include <inet/ipsec_impl.h>
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #define	INET_NAME	"keysock"
365240Snordmark #define	INET_MODSTRTAB	keysockinfo
375240Snordmark #define	INET_DEVSTRTAB	keysockinfo
38*6668Smarkfen #define	INET_MODDESC	"PF_KEY socket STREAMS module"
39*6668Smarkfen #define	INET_DEVDESC	"PF_KEY socket STREAMS driver"
400Sstevel@tonic-gate #define	INET_DEVMINOR	0
410Sstevel@tonic-gate #define	INET_DEVMTFLAGS	(D_MP|D_MTPERMOD|D_MTPUTSHARED)
420Sstevel@tonic-gate #define	INET_MODMTFLAGS	INET_DEVMTFLAGS
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #include "../inetddi.c"
450Sstevel@tonic-gate 
460Sstevel@tonic-gate 
470Sstevel@tonic-gate struct modlinkage *keysock_modlp = NULL;
480Sstevel@tonic-gate 
490Sstevel@tonic-gate int
_init(void)500Sstevel@tonic-gate _init(void)
510Sstevel@tonic-gate {
520Sstevel@tonic-gate 	int	error;
530Sstevel@tonic-gate 
540Sstevel@tonic-gate 	if (!keysock_ddi_init())
550Sstevel@tonic-gate 		return (ENOMEM);
560Sstevel@tonic-gate 	error = mod_install(&modlinkage);
570Sstevel@tonic-gate 	if (error != 0)
580Sstevel@tonic-gate 		keysock_ddi_destroy();
590Sstevel@tonic-gate 	else
600Sstevel@tonic-gate 		keysock_modlp = &modlinkage;
610Sstevel@tonic-gate 
620Sstevel@tonic-gate 	return (error);
630Sstevel@tonic-gate }
640Sstevel@tonic-gate 
650Sstevel@tonic-gate int
_fini(void)660Sstevel@tonic-gate _fini(void)
670Sstevel@tonic-gate {
680Sstevel@tonic-gate 	int	error;
690Sstevel@tonic-gate 
700Sstevel@tonic-gate 	error = mod_remove(&modlinkage);
710Sstevel@tonic-gate 	if (error != 0)
720Sstevel@tonic-gate 		return (error);
730Sstevel@tonic-gate 
740Sstevel@tonic-gate 	keysock_ddi_destroy();
750Sstevel@tonic-gate 	keysock_modlp = NULL;
760Sstevel@tonic-gate 	return (0);
770Sstevel@tonic-gate }
780Sstevel@tonic-gate 
790Sstevel@tonic-gate int
_info(struct modinfo * modinfop)800Sstevel@tonic-gate _info(struct modinfo *modinfop)
810Sstevel@tonic-gate {
820Sstevel@tonic-gate 	return (mod_info(&modlinkage, modinfop));
830Sstevel@tonic-gate }
84