xref: /titanic_44/usr/src/uts/common/inet/ip/keysockddi.c (revision 29e83d4b25fd82feb8e0e0fbe89f7e2a8438533d)
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 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <sys/types.h>
30 #include <sys/conf.h>
31 #include <sys/errno.h>
32 #include <sys/modctl.h>
33 #include <inet/common.h>
34 #include <inet/ipsec_impl.h>
35 
36 #define	INET_NAME	"keysock"
37 #define	INET_STRTAB	keysockinfo
38 #define	INET_MODDESC	"PF_KEY socket STREAMS module %I%"
39 #define	INET_DEVDESC	"PF_KEY socket STREAMS driver %I%"
40 #define	INET_DEVMINOR	0
41 #define	INET_DEVMTFLAGS	(D_MP|D_MTPERMOD|D_MTPUTSHARED)
42 #define	INET_MODMTFLAGS	INET_DEVMTFLAGS
43 
44 #include "../inetddi.c"
45 
46 
47 struct modlinkage *keysock_modlp = NULL;
48 
49 int
50 _init(void)
51 {
52 	int	error;
53 
54 	if (!keysock_ddi_init())
55 		return (ENOMEM);
56 	error = mod_install(&modlinkage);
57 	if (error != 0)
58 		keysock_ddi_destroy();
59 	else
60 		keysock_modlp = &modlinkage;
61 
62 	return (error);
63 }
64 
65 int
66 _fini(void)
67 {
68 	int	error;
69 
70 	error = mod_remove(&modlinkage);
71 	if (error != 0)
72 		return (error);
73 
74 	keysock_ddi_destroy();
75 	keysock_modlp = NULL;
76 	return (0);
77 }
78 
79 int
80 _info(struct modinfo *modinfop)
81 {
82 	return (mod_info(&modlinkage, modinfop));
83 }
84