xref: /illumos-gate/usr/src/uts/common/inet/ip/keysockddi.c (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #include <sys/types.h>
27 #include <sys/conf.h>
28 #include <sys/errno.h>
29 #include <sys/modctl.h>
30 #include <inet/common.h>
31 #include <inet/ipsec_impl.h>
32 
33 #define	INET_NAME	"keysock"
34 #define	INET_MODSTRTAB	keysockinfo
35 #define	INET_DEVSTRTAB	keysockinfo
36 #define	INET_MODDESC	"PF_KEY socket STREAMS module"
37 #define	INET_DEVDESC	"PF_KEY socket STREAMS driver"
38 #define	INET_DEVMINOR	0
39 #define	INET_DEVMTFLAGS	(D_MP|D_MTPERMOD|D_MTPUTSHARED)
40 #define	INET_MODMTFLAGS	INET_DEVMTFLAGS
41 
42 #include "../inetddi.c"
43 
44 
45 struct modlinkage *keysock_modlp = NULL;
46 
47 int
_init(void)48 _init(void)
49 {
50 	int	error;
51 
52 	if (!keysock_ddi_init())
53 		return (ENOMEM);
54 	error = mod_install(&modlinkage);
55 	if (error != 0)
56 		keysock_ddi_destroy();
57 	else
58 		keysock_modlp = &modlinkage;
59 
60 	return (error);
61 }
62 
63 int
_fini(void)64 _fini(void)
65 {
66 	int	error;
67 
68 	error = mod_remove(&modlinkage);
69 	if (error != 0)
70 		return (error);
71 
72 	keysock_ddi_destroy();
73 	keysock_modlp = NULL;
74 	return (0);
75 }
76 
77 int
_info(struct modinfo * modinfop)78 _info(struct modinfo *modinfop)
79 {
80 	return (mod_info(&modlinkage, modinfop));
81 }
82