Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_impl.h
+++ new/usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24 24 * Copyright 2015 Joyent, Inc.
25 25 */
26 26
27 27 #ifndef _IPMGMT_IMPL_H
28 28 #define _IPMGMT_IMPL_H
29 29
30 30 #ifdef __cplusplus
31 31 extern "C" {
32 32 #endif
33 33
34 34 #include <net/if.h>
35 35 #include <libnvpair.h>
36 36 #include <libipadm.h>
37 37 #include <ipadm_ipmgmt.h>
38 38 #include <syslog.h>
39 39 #include <pthread.h>
40 40 #include <libscf.h>
41 41
42 42 #define IPMGMT_STRSIZE 256
43 43 #define IPMGMTD_FMRI "svc:/network/ip-interface-management:default"
44 44
45 45 /* ipmgmt_door.c */
46 46 extern void ipmgmt_handler(void *, char *, size_t, door_desc_t *, uint_t);
47 47
48 48 /* ipmgmt_util.c */
49 49 extern void ipmgmt_log(int, const char *, ...);
50 50 extern int ipmgmt_cpfile(const char *, const char *, boolean_t);
51 51
52 52 /* ipmgmt_persist.c */
53 53
54 54 /*
55 55 * following are the list of DB walker callback functions and the callback
56 56 * arguments for each of the callback functions used by the daemon
57 57 */
58 58 /* following functions take 'ipmgmt_prop_arg_t' as the callback argument */
59 59 extern db_wfunc_t ipmgmt_db_getprop, ipmgmt_db_resetprop;
60 60
61 61 /* following functions take ipadm_dbwrite_cbarg_t as callback argument */
62 62 extern db_wfunc_t ipmgmt_db_add, ipmgmt_db_update;
63 63
64 64 typedef struct {
65 65 char *cb_ifname;
66 66 ipadm_if_info_t *cb_ifinfo;
67 67 } ipmgmt_getif_cbarg_t;
68 68 extern db_wfunc_t ipmgmt_db_getif;
69 69
70 70 typedef struct {
71 71 char *cb_aobjname;
72 72 char *cb_ifname;
73 73 nvlist_t *cb_onvl;
74 74 int cb_ocnt;
75 75 } ipmgmt_getaddr_cbarg_t;
76 76 extern db_wfunc_t ipmgmt_db_getaddr;
77 77
78 78 typedef struct {
79 79 sa_family_t cb_family;
80 80 char *cb_ifname;
81 81 } ipmgmt_if_cbarg_t;
82 82 extern db_wfunc_t ipmgmt_db_setif, ipmgmt_db_resetif;
83 83
84 84 typedef struct {
85 85 char *cb_aobjname;
86 86 } ipmgmt_resetaddr_cbarg_t;
87 87 extern db_wfunc_t ipmgmt_db_resetaddr;
88 88
89 89 typedef struct {
90 90 sa_family_t cb_family;
91 91 nvlist_t *cb_invl;
92 92 nvlist_t *cb_onvl;
93 93 int cb_ocnt;
94 94 } ipmgmt_initif_cbarg_t;
95 95 extern db_wfunc_t ipmgmt_db_initif;
96 96
97 97 /*
98 98 * A linked list of address object nodes. Each node in the list tracks
99 99 * following information for the address object identified by `am_aobjname'.
100 100 * - interface on which the address is created
101 101 * - logical interface number on which the address is created
102 102 * - address family
103 103 * - `am_nextnum' identifies the next number to use to generate user part
104 104 * of `aobjname'.
105 105 * - address type (static, dhcp or addrconf)
106 106 * - `am_flags' indicates if this addrobj in active and/or persist config
107 107 * - if `am_atype' is IPADM_ADDR_IPV6_ADDRCONF then `am_ifid' holds the
108 108 * interface-id used to configure auto-configured addresses
109 109 */
110 110 typedef struct ipmgmt_aobjmap_s {
111 111 struct ipmgmt_aobjmap_s *am_next;
112 112 char am_aobjname[IPADM_AOBJSIZ];
113 113 char am_ifname[LIFNAMSIZ];
114 114 int32_t am_lnum;
115 115 sa_family_t am_family;
116 116 ipadm_addr_type_t am_atype;
117 117 uint32_t am_nextnum;
118 118 uint32_t am_flags;
119 119 boolean_t am_linklocal;
120 120 struct sockaddr_storage am_ifid;
121 121 } ipmgmt_aobjmap_t;
122 122
123 123 /* linked list of `aobjmap' nodes, protected by RW lock */
124 124 typedef struct ipmgmt_aobjmap_list_s {
125 125 ipmgmt_aobjmap_t *aobjmap_head;
126 126 pthread_rwlock_t aobjmap_rwlock;
127 127 } ipmgmt_aobjmap_list_t;
128 128
129 129 /* global `aobjmap' defined in ipmgmt_main.c */
130 130 extern ipmgmt_aobjmap_list_t aobjmap;
131 131
132 132 /* operations on the `aobjmap' linked list */
133 133 #define ADDROBJ_ADD 0x00000001
134 134 #define ADDROBJ_DELETE 0x00000002
135 135 #define ADDROBJ_LOOKUPADD 0x00000004
136 136 #define ADDROBJ_SETLIFNUM 0x00000008
137 137
138 138 #define IPADM_FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
139 139
140 140 /*
141 141 * With the initial integration of the daemon (PSARC 2010/080), the version
142 142 * of the ipadm data-store (/etc/ipadm/ipadm.conf) was 0. A subsequent fix
143 143 * needed an upgrade to the data-store and we bumped the version to 1.
144 144 */
145 145 #define IPADM_DB_VERSION 1
146 146
147 147 typedef enum ipadm_path {
148 148 IPADM_PATH_TMPFS_DIR = 1,
149 149 IPADM_PATH_ADDROBJ_MAP_DB,
150 150 IPADM_PATH_DB,
151 151 IPADM_PATH_VOL_DB
152 152 } ipadm_path_t;
153 153
154 154 /* SCF resources required to interact with svc.configd */
155 155 typedef struct scf_resources {
156 156 scf_handle_t *sr_handle;
157 157 scf_instance_t *sr_inst;
158 158 scf_propertygroup_t *sr_pg;
159 159 scf_property_t *sr_prop;
160 160 scf_value_t *sr_val;
161 161 scf_transaction_t *sr_tx;
162 162 scf_transaction_entry_t *sr_ent;
163 163 } scf_resources_t;
164 164
165 165 extern int ipmgmt_db_walk(db_wfunc_t *, void *, ipadm_db_op_t);
166 166 extern int ipmgmt_aobjmap_op(ipmgmt_aobjmap_t *, uint32_t);
167 167 extern boolean_t ipmgmt_aobjmap_init(void *, nvlist_t *, char *,
168 168 size_t, int *);
169 169 extern int ipmgmt_persist_aobjmap(ipmgmt_aobjmap_t *,
170 170 ipadm_db_op_t);
171 171 extern boolean_t ipmgmt_ngz_firstboot_postinstall();
172 172 extern int ipmgmt_persist_if(ipmgmt_if_arg_t *);
173 173 extern void ipmgmt_init_prop();
174 174 extern boolean_t ipmgmt_db_upgrade(void *, nvlist_t *, char *,
175 175 size_t, int *);
176 176 extern int ipmgmt_create_scf_resources(const char *,
177 177 scf_resources_t *);
178 178 extern void ipmgmt_release_scf_resources(scf_resources_t *);
179 179 extern boolean_t ipmgmt_needs_upgrade(scf_resources_t *);
180 180 extern void ipmgmt_update_dbver(scf_resources_t *);
181 181
182 182 extern void ipmgmt_path(ipadm_path_t, char *, size_t);
183 183
184 184 #ifdef __cplusplus
185 185 }
186 186 #endif
187 187
188 188 #endif /* _IPMGMT_IMPL_H */
|
↓ open down ↓ |
188 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX