Print this page
7388 Support DHCP Client FQDN. Allow IAID/DUID for all v4.
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/libipadm/common/ipadm_ipmgmt.h
+++ new/usr/src/lib/libipadm/common/ipadm_ipmgmt.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 *
|
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
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 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 + * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
23 24 */
24 25
25 26 #ifndef _IPADM_IPMGMT_H
26 27 #define _IPADM_IPMGMT_H
27 28
28 29 #ifdef __cplusplus
29 30 extern "C" {
30 31 #endif
31 32 #include <sys/types.h>
32 33 #include <sys/stat.h>
33 34 #include <fcntl.h>
34 35 #include <sys/mman.h>
35 36 #include <door.h>
36 37 #include <libipadm.h>
37 38 #include <inet/tunables.h>
38 39
39 40 /*
40 41 * Function declarations and data structures shared by libipadm.so and
41 42 * the IP management daemon.
42 43 */
43 44
|
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
44 45 /* Authorization required to configure network interfaces */
45 46 #define NETWORK_INTERFACE_CONFIG_AUTH "solaris.network.interface.config"
46 47
47 48 /*
48 49 * Data store read/write utilities related declarations.
49 50 */
50 51 /*
51 52 * For more information on these definitions please refer to the top of
52 53 * ipadm_persist.c. These are the name of the nvpairs which hold the
53 54 * respective values. All nvpairs private to ipadm have names that begin
54 - * with "_". Note below that 'prefixlen' is an address property and therefore
55 - * not a private nvpair name.
55 + * with "_". Note below that 'prefixlen' and 'reqhost' are address
56 + * properties and therefore not a private nvpair name.
56 57 */
57 58 #define IPADM_NVP_PROTONAME "_protocol" /* protocol name */
58 59 #define IPADM_NVP_IFNAME "_ifname" /* interface name */
59 60 #define IPADM_NVP_AOBJNAME "_aobjname" /* addrobj name */
60 61 #define IPADM_NVP_FAMILY "_family" /* address family */
61 62 #define IPADM_NVP_IPV4ADDR "_ipv4addr" /* name of IPv4 addr nvlist */
62 63 #define IPADM_NVP_IPNUMADDR "_addr" /* local address */
63 64 #define IPADM_NVP_IPADDRHNAME "_aname" /* local hostname */
64 65 #define IPADM_NVP_IPDADDRHNAME "_dname" /* remote hostname */
65 66 #define IPADM_NVP_PREFIXLEN "prefixlen" /* prefixlen */
67 +#define IPADM_NVP_REQHOST "reqhost" /* requested hostname */
66 68 #define IPADM_NVP_IPV6ADDR "_ipv6addr" /* name of IPv6 addr nvlist */
67 69 #define IPADM_NVP_DHCP "_dhcp" /* name of DHCP nvlist */
68 70 #define IPADM_NVP_WAIT "_wait" /* DHCP timeout value */
69 71 #define IPADM_NVP_PRIMARY "_primary" /* DHCP primary interface */
70 72 #define IPADM_NVP_LIFNUM "_lifnum" /* logical interface number */
71 73 #define IPADM_NVP_INTFID "_intfid" /* name of IPv6 intfid nvlist */
72 74 #define IPADM_NVP_STATELESS "_stateless" /* IPv6 autoconf stateless */
73 75 #define IPADM_NVP_STATEFUL "_stateful" /* IPv6 autoconf dhcpv6 */
74 76
75 77 #define IPADM_PRIV_NVP(s) ((s)[0] == '_' && (s)[1] != '_')
76 78
77 79 /*
78 80 * All protocol properties that are private to ipadm are stored in the
79 81 * ipadm datastore with "__" as prefix. This is to ensure there
80 82 * is no collision of namespace between ipadm private nvpair names and
81 83 * the private protocol property names.
82 84 */
83 85 #define IPADM_PERSIST_PRIVPROP_PREFIX "__"
84 86
85 87 /* data-store operations */
86 88 typedef enum {
87 89 IPADM_DB_WRITE = 0, /* Writes to DB */
88 90 IPADM_DB_DELETE, /* Deletes an entry from DB */
89 91 IPADM_DB_READ /* Read from DB */
90 92 } ipadm_db_op_t;
91 93
92 94 /*
93 95 * callback arg used by db_wfunc_t that writes to DB. The contents to be
94 96 * written to DB are captured in `dbw_nvl'.
95 97 */
96 98 typedef struct ipadm_dbwrite_cbarg_s {
97 99 nvlist_t *dbw_nvl;
98 100 uint_t dbw_flags;
99 101 } ipadm_dbwrite_cbarg_t;
100 102
101 103 /*
102 104 * door related function declarations and data structures.
103 105 */
104 106
105 107 /* The door file for the ipmgmt (ip-interface management) daemon */
106 108 #define IPMGMT_DOOR "/etc/svc/volatile/ipadm/ipmgmt_door"
107 109 #define MAXPROTONAMELEN 32
108 110
109 111 /* door call command type */
110 112 typedef enum {
111 113 IPMGMT_CMD_SETPROP = 1, /* persist property */
112 114 IPMGMT_CMD_SETIF, /* persist interface */
113 115 IPMGMT_CMD_SETADDR, /* persist address */
114 116 IPMGMT_CMD_GETPROP, /* retrieve persisted property value */
115 117 IPMGMT_CMD_GETIF, /* retrieve persisted interface conf. */
116 118 IPMGMT_CMD_GETADDR, /* retrieve persisted addresses */
117 119 IPMGMT_CMD_RESETIF, /* purge interface configuration */
118 120 IPMGMT_CMD_RESETADDR, /* purge address configuration */
119 121 IPMGMT_CMD_RESETPROP, /* purge property configuration */
120 122 IPMGMT_CMD_INITIF, /* retrieve interfaces to initialize */
121 123 IPMGMT_CMD_ADDROBJ_LOOKUPADD, /* addr. object lookup & add */
122 124 IPMGMT_CMD_ADDROBJ_SETLIFNUM, /* set lifnum on the addrobj */
123 125 IPMGMT_CMD_ADDROBJ_ADD, /* add addr. object to addrobj map */
124 126 IPMGMT_CMD_LIF2ADDROBJ, /* lifname to addrobj mapping */
125 127 IPMGMT_CMD_AOBJNAME2ADDROBJ /* aobjname to addrobj mapping */
126 128 } ipmgmt_door_cmd_type_t;
127 129
128 130 /*
129 131 * Note: We need to keep the size of the structure the same on amd64 and i386
130 132 * for all door_call arguments and door_return structures.
131 133 */
132 134 /* door_call argument */
133 135 typedef struct ipmgmt_arg {
134 136 ipmgmt_door_cmd_type_t ia_cmd;
135 137 } ipmgmt_arg_t;
136 138
137 139 /* IPMGMT_CMD_{SETPROP|GETPROP|RESETPROP} door_call argument */
138 140 typedef struct ipmgmt_prop_arg_s {
139 141 ipmgmt_door_cmd_type_t ia_cmd;
140 142 uint32_t ia_flags;
141 143 char ia_ifname[LIFNAMSIZ];
142 144 char ia_aobjname[IPADM_AOBJSIZ];
143 145 char ia_module[MAXPROTONAMELEN];
144 146 char ia_pname[MAXPROPNAMELEN];
|
↓ open down ↓ |
69 lines elided |
↑ open up ↑ |
145 147 char ia_pval[MAXPROPVALLEN];
146 148 } ipmgmt_prop_arg_t;
147 149 /*
148 150 * ia_flags used in ipmgmt_prop_arg_t.
149 151 * - APPEND updates the multi-valued property entry with a new value
150 152 * - REDUCE updates the multi-valued property entry by removing a value
151 153 */
152 154 #define IPMGMT_APPEND 0x00000001
153 155 #define IPMGMT_REMOVE 0x00000002
154 156
157 +/*
158 + * ipadm_addr_type_t-specific values that are cached in ipmgmtd and can
159 + * make a round-trip back to client programs
160 + */
161 +typedef union {
162 + struct {
163 + boolean_t ipmgmt_linklocal;
164 + struct sockaddr_in6 ipmgmt_ifid;
165 + } ipmgmt_ipv6_cache_s;
166 + struct {
167 + boolean_t ipmgmt_primary;
168 + char ipmgmt_reqhost[MAXNAMELEN];
169 + } ipmgmt_dhcp_cache_s;
170 +} ipmgmt_addr_type_cache_u;
171 +
155 172 /* IPMGMT_CMD_GETIF door_call argument structure */
156 173 typedef struct ipmgmt_getif_arg_s {
157 174 ipmgmt_door_cmd_type_t ia_cmd;
158 175 uint32_t ia_flags;
159 176 char ia_ifname[LIFNAMSIZ];
160 177 } ipmgmt_getif_arg_t;
161 178
162 179 /* IPMGMT_CMD_RESETIF, IPMGMT_CMD_SETIF door_call argument structure */
163 180 typedef struct ipmgmt_if_arg_s {
164 181 ipmgmt_door_cmd_type_t ia_cmd;
165 182 uint32_t ia_flags;
166 183 char ia_ifname[LIFNAMSIZ];
167 184 sa_family_t ia_family;
168 185 } ipmgmt_if_arg_t;
169 186
170 187 /* IPMGMT_CMD_INITIF door_call argument structure */
171 188 typedef struct ipmgmt_initif_arg_s {
172 189 ipmgmt_door_cmd_type_t ia_cmd;
173 190 uint32_t ia_flags;
174 191 sa_family_t ia_family;
175 192 size_t ia_nvlsize;
176 193 /* packed nvl follows */
177 194 } ipmgmt_initif_arg_t;
178 195
179 196 /* IPMGMT_CMD_SETADDR door_call argument */
180 197 typedef struct ipmgmt_setaddr_arg_s {
181 198 ipmgmt_door_cmd_type_t ia_cmd;
182 199 uint32_t ia_flags;
183 200 size_t ia_nvlsize;
184 201 /* packed nvl follows */
185 202 } ipmgmt_setaddr_arg_t;
186 203
187 204 /* IPMGMT_CMD_GETADDR door_call argument */
188 205 typedef struct ipmgmt_getaddr_arg_s {
189 206 ipmgmt_door_cmd_type_t ia_cmd;
190 207 uint32_t ia_flags;
191 208 char ia_ifname[LIFNAMSIZ];
192 209 sa_family_t ia_family;
193 210 char ia_aobjname[IPADM_AOBJSIZ];
194 211 } ipmgmt_getaddr_arg_t;
195 212
196 213 /* IPMGMT_CMD_RESETADDR door_call argument */
197 214 typedef struct ipmgmt_addr_arg_s {
198 215 ipmgmt_door_cmd_type_t ia_cmd;
199 216 uint32_t ia_flags;
200 217 char ia_aobjname[IPADM_AOBJSIZ];
201 218 int32_t ia_lnum;
202 219 } ipmgmt_addr_arg_t;
203 220
204 221 /*
205 222 * IPMGMT_CMD_{ADDROBJ_ADD|ADDROBJ_LOOKUPADD|LIFNUM2ADDROBJ|
206 223 * ADDROBJ2LIFNUM} door_call argument.
207 224 */
208 225 typedef struct ipmgmt_aobjop_arg_s {
209 226 ipmgmt_door_cmd_type_t ia_cmd;
210 227 uint32_t ia_flags;
211 228 char ia_aobjname[IPADM_AOBJSIZ];
212 229 char ia_ifname[LIFNAMSIZ];
213 230 int32_t ia_lnum;
|
↓ open down ↓ |
49 lines elided |
↑ open up ↑ |
214 231 sa_family_t ia_family;
215 232 ipadm_addr_type_t ia_atype;
216 233 } ipmgmt_aobjop_arg_t;
217 234
218 235 /*
219 236 * ia_flags used inside the arguments for interface/address commands
220 237 * - ACTIVE updates the running configuration
221 238 * - PERSIST updates the permanent data store
222 239 * - INIT indicates that operation being performed is under init
223 240 * context
241 + * - PROPS_ONLY indicates the update changes the running configuration of
242 + * "props" data on the interface/address object. The props are
243 + * cached there on the parent, so a PROPS_ONLY change does not
244 + * affect the ACTIVE/PERSIST state of the parent.
224 245 */
225 246 #define IPMGMT_ACTIVE 0x00000001
226 247 #define IPMGMT_PERSIST 0x00000002
227 248 #define IPMGMT_INIT 0x00000004
249 +#define IPMGMT_PROPS_ONLY 0x00000008
228 250
229 251 /* door call return value */
230 252 typedef struct ipmgmt_retval_s {
231 253 int32_t ir_err;
232 254 } ipmgmt_retval_t;
233 255
234 256 /* IPMGMT_CMD_GETADDR door_return value */
235 257 typedef struct ipmgmt_get_rval_s {
236 258 int32_t ir_err;
237 259 size_t ir_nvlsize;
238 260 /* packed nvl follows */
239 261 } ipmgmt_get_rval_t;
240 262
241 263 /* IPMGMT_CMD_GETPROP door_return value */
242 264 typedef struct ipmgmt_getprop_rval_s {
243 265 int32_t ir_err;
244 266 char ir_pval[MAXPROPVALLEN];
245 267 } ipmgmt_getprop_rval_t;
246 268
247 269 /* IPMGMT_CMD_GETIF door_return value */
248 270 typedef struct ipmgmt_getif_rval_s {
249 271 int32_t ir_err;
250 272 uint32_t ir_ifcnt;
251 273 ipadm_if_info_t ir_ifinfo[1];
252 274 } ipmgmt_getif_rval_t;
|
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
253 275
254 276 /* IPMGMT_CMD_{LOOKUPADD|LIFNUM2ADDROBJ|ADDROBJ2LIFNUM} door_return value */
255 277 typedef struct ipmgmt_aobjop_rval_s {
256 278 int32_t ir_err;
257 279 char ir_aobjname[IPADM_AOBJSIZ];
258 280 char ir_ifname[LIFNAMSIZ];
259 281 int32_t ir_lnum;
260 282 sa_family_t ir_family;
261 283 uint32_t ir_flags;
262 284 ipadm_addr_type_t ir_atype;
263 - struct sockaddr_storage ir_ifid;
285 + ipmgmt_addr_type_cache_u ir_atype_cache;
264 286 } ipmgmt_aobjop_rval_t;
265 287
288 +#define ipmgmt_ir_intfid ir_atype_cache. \
289 + ipmgmt_ipv6_cache_s.ipmgmt_ifid
290 +#define ipmgmt_ir_primary ir_atype_cache. \
291 + ipmgmt_dhcp_cache_s.ipmgmt_primary
292 +#define ipmgmt_ir_reqhost ir_atype_cache. \
293 + ipmgmt_dhcp_cache_s.ipmgmt_reqhost
294 +
266 295 /* DB walk callback functions */
267 296 typedef boolean_t db_wfunc_t(void *, nvlist_t *, char *, size_t, int *);
268 297 extern int ipadm_rw_db(db_wfunc_t *, void *, const char *, mode_t,
269 298 ipadm_db_op_t);
270 299
271 300 /* zone related functions */
272 301 /*
273 302 * callback function to persist an interface in ipmgmtd data store
274 303 */
275 304 typedef void (*persist_cb_t)(char *, boolean_t, boolean_t);
276 305 /*
277 306 * ipmgmtd/libipadm network initialization interface.
278 307 */
279 308 extern ipadm_status_t ipadm_init_net_from_gz(ipadm_handle_t, char *,
280 309 persist_cb_t);
281 310
282 311 #ifdef __cplusplus
283 312 }
284 313 #endif
285 314
286 315 #endif /* _IPADM_IPMGMT_H */
|
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX