xref: /illumos-gate/usr/src/lib/libipsecutil/common/ikedoor.h (revision f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_IKEDOOR_H
27 #define	_IKEDOOR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <limits.h>
36 #include <sys/sysmacros.h>
37 #include <net/pfkeyv2.h>
38 #include <door.h>
39 
40 /*
41  * This version number is intended to stop the calling process from
42  * getting confused if a structure is changed and a mismatch occurs.
43  * This should be incremented each time a structure is changed.
44  */
45 #define	DOORVER 2
46 #define	DOORNM	"/var/run/ike_door"
47 
48 
49 typedef enum {
50 	IKE_SVC_GET_DBG,
51 	IKE_SVC_SET_DBG,
52 
53 	IKE_SVC_GET_PRIV,
54 	IKE_SVC_SET_PRIV,
55 
56 	IKE_SVC_GET_STATS,
57 
58 	IKE_SVC_GET_P1,
59 	IKE_SVC_DEL_P1,
60 	IKE_SVC_DUMP_P1S,
61 	IKE_SVC_FLUSH_P1S,
62 
63 	IKE_SVC_GET_RULE,
64 	IKE_SVC_NEW_RULE,
65 	IKE_SVC_DEL_RULE,
66 	IKE_SVC_DUMP_RULES,
67 	IKE_SVC_READ_RULES,
68 	IKE_SVC_WRITE_RULES,
69 
70 	IKE_SVC_GET_PS,
71 	IKE_SVC_NEW_PS,
72 	IKE_SVC_DEL_PS,
73 	IKE_SVC_DUMP_PS,
74 	IKE_SVC_READ_PS,
75 	IKE_SVC_WRITE_PS,
76 
77 	IKE_SVC_DBG_RBDUMP,
78 
79 	IKE_SVC_GET_DEFS,
80 
81 	IKE_SVC_ERROR
82 } ike_svccmd_t;
83 
84 #define	IKE_SVC_MAX	IKE_SVC_ERROR
85 
86 
87 /*
88  * Support structures/defines
89  */
90 
91 #define	IKEDOORROUNDUP(i)   P2ROUNDUP((i), sizeof (uint64_t))
92 
93 /*
94  * Debug categories.  The debug level is a bitmask made up of
95  * flags indicating the desired categories; only 31 bits are
96  * available, as the highest-order bit designates an invalid
97  * setting.
98  */
99 #define	D_INVALID	0x80000000
100 
101 #define	D_CERT		0x00000001	/* certificate management */
102 #define	D_KEY		0x00000002	/* key management */
103 #define	D_OP		0x00000004	/* operational: config, init, mem */
104 #define	D_P1		0x00000008	/* phase 1 negotiation */
105 #define	D_P2		0x00000010	/* phase 2 negotiation */
106 #define	D_PFKEY		0x00000020	/* pf key interface */
107 #define	D_POL		0x00000040	/* policy management */
108 #define	D_PROP		0x00000080	/* proposal construction */
109 #define	D_DOOR		0x00000100	/* door server */
110 #define	D_CONFIG	0x00000200	/* config file processing */
111 
112 #define	D_HIGHBIT	0x00000200
113 #define	D_ALL		0x000003ff
114 
115 /*
116  * Access privilege levels: define level of access to keying information.
117  * The privileges granted at each level is a superset of the privileges
118  * granted at all lower levels.
119  *
120  * The door operations which require special privileges are:
121  *
122  *	- receiving keying material for SAs and preshared key entries
123  *	  IKE_PRIV_KEYMAT must be set for this.
124  *
125  *	- get/dump/new/delete/read/write preshared keys
126  *	  IKE_PRIV_KEYMAT or IKE_PRIV_MODKEYS must be set to do this.
127  *	  If IKE_PRIV_MODKEYS is set, the information returned for a
128  *	  get/dump request will not include the actual key; in order
129  *	  to get the key itself, IKE_PRIV_KEYMAT must be set.
130  *
131  *	- modifying the privilege level: the daemon's privilege level
132  *	  is set when the daemon is started; the level may only be
133  *	  lowered via the door interface.
134  *
135  * All other operations are allowed at any privilege level.
136  */
137 #define	IKE_PRIV_MINIMUM	0
138 #define	IKE_PRIV_MODKEYS	1
139 #define	IKE_PRIV_KEYMAT		2
140 #define	IKE_PRIV_MAXIMUM	2
141 
142 /* global ike stats formatting structure */
143 typedef struct {
144 	uint32_t	st_init_p1_current;
145 	uint32_t	st_resp_p1_current;
146 	uint32_t	st_init_p1_total;
147 	uint32_t	st_resp_p1_total;
148 	uint32_t	st_init_p1_attempts;
149 	uint32_t	st_resp_p1_attempts;
150 	uint32_t	st_init_p1_noresp;   /* failed; no response from peer */
151 	uint32_t	st_init_p1_respfail; /* failed, but peer responded */
152 	uint32_t	st_resp_p1_fail;
153 	uint32_t	st_reserved;
154 	char		st_pkcs11_libname[PATH_MAX];
155 } ike_stats_t;
156 
157 /* structure used to pass default values used by in.iked back to ikeadm */
158 typedef struct {
159 	uint32_t	rule_p1_lifetime_secs;
160 	uint32_t	rule_p1_minlife;
161 	uint32_t	rule_p1_nonce_len;
162 	uint32_t	rule_p2_lifetime_secs;
163 	uint32_t	rule_p2_softlife_secs;
164 	uint32_t	rule_p2_lifetime_kb;
165 	uint32_t	rule_p2_softlife_kb;
166 	uint32_t	rule_p2_minlife;
167 	uint32_t	rule_p2_def_minlife;
168 	uint32_t	rule_p2_nonce_len;
169 	uint32_t	rule_p2_pfs;
170 	uint32_t	rule_p2_minsoft;
171 	uint32_t	rule_max_certs;
172 	uint32_t	rule_ike_port;
173 	uint32_t	rule_natt_port;
174 } ike_defaults_t;
175 
176 /* data formatting structures for P1 SA dumps */
177 typedef struct {
178 	struct sockaddr_storage	loc_addr;
179 	struct sockaddr_storage	rem_addr;
180 #define	beg_iprange	loc_addr
181 #define	end_iprange	rem_addr
182 } ike_addr_pr_t;
183 
184 typedef struct {
185 	uint64_t	cky_i;
186 	uint64_t	cky_r;
187 } ike_cky_pr_t;
188 
189 typedef struct {
190 	ike_cky_pr_t	p1hdr_cookies;
191 	uint8_t		p1hdr_major;
192 	uint8_t		p1hdr_minor;
193 	uint8_t		p1hdr_xchg;
194 	uint8_t		p1hdr_isinit;
195 	uint32_t	p1hdr_state;
196 } ike_p1_hdr_t;
197 
198 /* values for p1hdr_xchg (aligned with RFC2408, section 3.1) */
199 #define	IKE_XCHG_NONE			0
200 #define	IKE_XCHG_BASE			1
201 #define	IKE_XCHG_IDENTITY_PROTECT	2
202 #define	IKE_XCHG_AUTH_ONLY		3
203 #define	IKE_XCHG_AGGRESSIVE		4
204 /* following not from RFC; used only for preshared key definitions */
205 #define	IKE_XCHG_IP_AND_AGGR		240
206 /* also not from RFC; used as wildcard */
207 #define	IKE_XCHG_ANY			256
208 
209 /* values for p1hdr_state */
210 #define	IKE_SA_STATE_INVALID	0
211 #define	IKE_SA_STATE_INIT	1
212 #define	IKE_SA_STATE_SENT_SA	2
213 #define	IKE_SA_STATE_SENT_KE	3
214 #define	IKE_SA_STATE_SENT_LAST	4
215 #define	IKE_SA_STATE_DONE	5
216 #define	IKE_SA_STATE_DELETED	6
217 
218 typedef struct {
219 	uint16_t	p1xf_dh_group;
220 	uint16_t	p1xf_encr_alg;
221 	uint16_t	p1xf_encr_low_bits;
222 	uint16_t	p1xf_encr_high_bits;
223 	uint16_t	p1xf_auth_alg;
224 	uint16_t	p1xf_auth_meth;
225 	uint16_t	p1xf_prf;
226 	uint16_t	p1xf_pfs;
227 	uint32_t	p1xf_max_secs;
228 	uint32_t	p1xf_max_kbytes;
229 	uint32_t	p1xf_max_keyuses;
230 } ike_p1_xform_t;
231 
232 /* values for p1xf_dh_group (aligned with RFC2409, Appendix A) */
233 #define	IKE_GRP_DESC_MODP_768	1
234 #define	IKE_GRP_DESC_MODP_1024	2
235 #define	IKE_GRP_DESC_EC2N_155	3
236 #define	IKE_GRP_DESC_EC2N_185	4
237 /* values for p1xf_dh_group (aligned with RFC3526) */
238 #define	IKE_GRP_DESC_MODP_1536	5
239 #define	IKE_GRP_DESC_MODP_2048	14
240 #define	IKE_GRP_DESC_MODP_3072	15
241 #define	IKE_GRP_DESC_MODP_4096	16
242 #define	IKE_GRP_DESC_MODP_6144	17
243 #define	IKE_GRP_DESC_MODP_8192	18
244 
245 /* values for p1xf_auth_meth (aligned with RFC2409, Appendix A) */
246 #define	IKE_AUTH_METH_PRE_SHARED_KEY	1
247 #define	IKE_AUTH_METH_DSS_SIG		2
248 #define	IKE_AUTH_METH_RSA_SIG		3
249 #define	IKE_AUTH_METH_RSA_ENCR		4
250 #define	IKE_AUTH_METH_RSA_ENCR_REVISED	5
251 
252 /* values for p1xf_prf */
253 #define	IKE_PRF_NONE		0
254 #define	IKE_PRF_HMAC_MD5	1
255 #define	IKE_PRF_HMAC_SHA1	2
256 
257 typedef struct {
258 	/*
259 	 * NOTE: the new and del counters count the actual number of SAs,
260 	 * not the number of "suites", as defined in the ike monitoring
261 	 * mib draft; we do this because we don't have a good way of
262 	 * tracking the deletion of entire suites (we're notified of
263 	 * deleted qm sas individually).
264 	 */
265 	uint32_t	p1stat_new_qm_sas;
266 	uint32_t	p1stat_del_qm_sas;
267 	uint64_t	p1stat_start;
268 	uint32_t	p1stat_kbytes;
269 	uint32_t	p1stat_keyuses;
270 } ike_p1_stats_t;
271 
272 typedef struct {
273 	uint32_t	p1err_decrypt;
274 	uint32_t	p1err_hash;
275 	uint32_t	p1err_otherrx;
276 	uint32_t	p1err_tx;
277 } ike_p1_errors_t;
278 
279 typedef struct {
280 	uint32_t	p1key_type;
281 	uint32_t	p1key_len;
282 	/*
283 	 * followed by (len - sizeof (ike_p1_key_t)) bytes of hex data,
284 	 * 64-bit aligned (pad bytes are added at the end, if necessary,
285 	 * and NOT INCLUDED in the len value, which reflects the actual
286 	 * key size).
287 	 */
288 } ike_p1_key_t;
289 
290 /* key info types for ike_p1_key_t struct */
291 #define	IKE_KEY_PRESHARED	1
292 #define	IKE_KEY_SKEYID		2
293 #define	IKE_KEY_SKEYID_D	3
294 #define	IKE_KEY_SKEYID_A	4
295 #define	IKE_KEY_SKEYID_E	5
296 #define	IKE_KEY_ENCR		6
297 #define	IKE_KEY_IV		7
298 
299 typedef struct {
300 	ike_p1_hdr_t	p1sa_hdr;
301 	ike_p1_xform_t	p1sa_xform;
302 	ike_addr_pr_t	p1sa_ipaddrs;
303 	uint16_t	p1sa_stat_off;
304 	uint16_t	p1sa_stat_len;
305 	uint16_t	p1sa_error_off;
306 	uint16_t	p1sa_error_len;
307 	uint16_t	p1sa_localid_off;
308 	uint16_t	p1sa_localid_len;
309 	uint16_t	p1sa_remoteid_off;
310 	uint16_t	p1sa_remoteid_len;
311 	uint16_t	p1sa_key_off;
312 	uint16_t	p1sa_key_len;
313 	uint32_t	p1sa_reserved;
314 	/*
315 	 * variable-length structures will be included here, as
316 	 * indicated by offset/length fields.
317 	 * stats and errors will be formatted as ike_p1_stats_t and
318 	 * ike_p1_errors_t, respectively.
319 	 * key info will be formatted as a series of p1_key_t structs.
320 	 * local/remote ids will be formatted as sadb_ident_t structs.
321 	 */
322 } ike_p1_sa_t;
323 
324 
325 #define	MAX_LABEL_LEN	256
326 
327 
328 /* data formatting structure for policy (rule) dumps */
329 
330 typedef struct {
331 	char		rule_label[MAX_LABEL_LEN];
332 	uint32_t	rule_kmcookie;
333 	uint16_t	rule_ike_mode;
334 	uint16_t	rule_local_idtype;	/* SADB_IDENTTYPE_* value */
335 	uint32_t	rule_p1_nonce_len;
336 	uint32_t	rule_p2_nonce_len;
337 	uint32_t	rule_p2_pfs;
338 	uint32_t	rule_p2_lifetime_secs;
339 	uint32_t	rule_p2_softlife_secs;
340 	uint32_t	rule_p2_lifetime_kb;
341 	uint32_t	rule_p2_softlife_kb;
342 	uint16_t	rule_xform_cnt;
343 	uint16_t	rule_xform_off;
344 	uint16_t	rule_locip_cnt;
345 	uint16_t	rule_locip_off;
346 	uint16_t	rule_remip_cnt;
347 	uint16_t	rule_remip_off;
348 	uint16_t	rule_locid_inclcnt;
349 	uint16_t	rule_locid_exclcnt;
350 	uint16_t	rule_locid_off;
351 	uint16_t	rule_remid_inclcnt;
352 	uint16_t	rule_remid_exclcnt;
353 	uint16_t	rule_remid_off;
354 	/*
355 	 * Followed by several lists of variable-length structures, described
356 	 * by counts and offsets:
357 	 *	transforms			ike_p1_xform_t structs
358 	 *	ranges of local ip addrs	ike_addr_pr_t structs
359 	 *	ranges of remote ip addrs	ike_addr_pr_t structs
360 	 *	local identification strings	null-terminated ascii strings
361 	 *	remote identification strings	null-terminated ascii strings
362 	 */
363 } ike_rule_t;
364 
365 
366 /*
367  * data formatting structure for preshared keys
368  * ps_ike_mode field uses the IKE_XCHG_* defs
369  */
370 typedef struct {
371 	ike_addr_pr_t	ps_ipaddrs;
372 	uint16_t	ps_ike_mode;
373 	uint16_t	ps_localid_off;
374 	uint16_t	ps_localid_len;
375 	uint16_t	ps_remoteid_off;
376 	uint16_t	ps_remoteid_len;
377 	uint16_t	ps_key_off;
378 	uint16_t	ps_key_len;
379 	uint16_t	ps_key_bits;
380 	/*
381 	 * followed by variable-length structures, as indicated by
382 	 * offset/length fields.
383 	 * key info will be formatted as an array of bytes.
384 	 * local/remote ids will be formatted as sadb_ident_t structs.
385 	 */
386 } ike_ps_t;
387 
388 
389 /* identification types */
390 #define	IKE_ID_IDENT_PAIR	1
391 #define	IKE_ID_ADDR_PAIR	2
392 #define	IKE_ID_CKY_PAIR		3
393 #define	IKE_ID_LABEL		4
394 
395 
396 /* locations for read/write requests */
397 #define	IKE_RW_LOC_DEFAULT	1
398 #define	IKE_RW_LOC_USER_SPEC	2
399 
400 
401 /* door interface error codes */
402 #define	IKE_ERR_NO_OBJ		1	/* nothing found to match the request */
403 #define	IKE_ERR_NO_DESC		2	/* fd was required with this request */
404 #define	IKE_ERR_ID_INVALID	3	/* invalid id info was provided */
405 #define	IKE_ERR_LOC_INVALID	4	/* invalid location info was provided */
406 #define	IKE_ERR_CMD_INVALID	5	/* invalid command was provided */
407 #define	IKE_ERR_DATA_INVALID	6	/* invalid data was provided */
408 #define	IKE_ERR_CMD_NOTSUP	7	/* unsupported command */
409 #define	IKE_ERR_REQ_INVALID	8	/* badly formatted request */
410 #define	IKE_ERR_NO_PRIV		9	/* privilege level not high enough */
411 #define	IKE_ERR_SYS_ERR		10	/* syserr occurred while processing */
412 #define	IKE_ERR_DUP_IGNORED	11	/* attempt to add a duplicate entry */
413 
414 
415 /*
416  * IKE_SVC_GET_DBG
417  * Used to request the current debug level.
418  *
419  * Upon request, dbg_level is 0 (don't care).
420  *
421  * Upon return, dbg_level contains the current value.
422  *
423  *
424  * IKE_SVC_SET_DBG
425  * Used to request modification of the debug level.
426  *
427  * Upon request, dbg_level contains desired level.  If debug output is
428  * to be directed to a different file, the fd should be passed in the
429  * door_desc_t field of the door_arg_t param.  NOTE: if the daemon is
430  * currently running in the background with no debug set, an output
431  * file MUST be given.
432  *
433  * Upon return, dbg_level contains the old debug level, and acknowledges
434  * successful completion of the request.  If an error is encountered,
435  * ike_err_t is returned instead, with appropriate error value and cmd
436  * IKE_SVC_ERROR.
437  */
438 typedef struct {
439 	ike_svccmd_t	cmd;
440 	uint32_t	dbg_level;
441 } ike_dbg_t;
442 
443 /*
444  * IKE_SVC_GET_PRIV
445  * Used to request the current privilege level.
446  *
447  * Upon request, priv_level is 0 (don't care).
448  *
449  * Upon return, priv_level contains the current value.
450  *
451  *
452  * IKE_SVC_SET_PRIV
453  * Used to request modification of the privilege level.
454  *
455  * Upon request, priv_level contains the desired level.  The level may
456  * only be lowered via the door interface; it cannot be raised.  Thus,
457  * if in.iked is started at the lowest level, it cannot be changed.
458  *
459  * Upon return, priv_level contains the old privilege level, and
460  * acknowledges successful completion of the request.  If an error is
461  * encountered, ike_err_t is returned instead, with appropriate error
462  * value and cmd IKE_SVC_ERROR.
463  */
464 typedef struct {
465 	ike_svccmd_t	cmd;
466 	uint32_t	priv_level;
467 } ike_priv_t;
468 
469 
470 /*
471  * IKE_SVC_GET_STATS
472  * Used to request current statistics on Phase 1 SA creation and
473  * failures.  The statistics represent all activity in in.iked.
474  *
475  * Upon request, cmd is set, and stat_len does not matter.
476  *
477  * Upon successful return, stat_len contains the total size of the
478  * returned buffer, which contains first the ike_statreq_t struct,
479  * followed by the stat data in the ike_stats_t structure. In case
480  * of an error in processing the request, ike_err_t is returned with
481  * IKE_SVC_ERROR command and appropriate error code.
482  */
483 typedef struct {
484 	ike_svccmd_t	cmd;
485 	uint32_t	stat_len;
486 } ike_statreq_t;
487 
488 /*
489  * IKE_SVC_GET_DEFS
490  * Used to request default values from in.iked.
491  *
492  * Upon request, cmd is set, and stat_len does not matter.
493  *
494  * Upon successful return, stat_len contains the total size of the
495  * returned buffer, this contains a pair of ike_defaults_t's.
496  */
497 typedef struct {
498 	ike_svccmd_t	cmd;
499 	uint32_t	stat_len;
500 	uint32_t	version;
501 } ike_defreq_t;
502 
503 /*
504  * IKE_SVC_DUMP_{P1S|RULES|PS}
505  * Used to request a table dump, and to return info for a single table
506  * item.  The expectation is that all of the table data will be passed
507  * through the door, one entry at a time; an individual request must be
508  * sent for each entry, however (the door server can't send unrequested
509  * data).
510  *
511  * Upon request: cmd is set, and dump_next contains the item number
512  * requested (0 for first request).  dump_len is 0; no data follows.
513  *
514  * Upon return: cmd is set, and dump_next contains the item number of
515  * the *next* item in the table (to be used in the subsequent request).
516  * dump_next = 0 indicates that this is the last item in the table.
517  * dump_len is the total length (data + struct) returned.  Data is
518  * formatted as indicated by the cmd type:
519  *   IKE_SVC_DUMP_P1S:		ike_p1_sa_t
520  *   IKE_SVC_DUMP_RULES:	ike_rule_t
521  *   IKE_SVC_DUMP_PS:		ike_ps_t
522  */
523 typedef struct {
524 	ike_svccmd_t	cmd;
525 	uint32_t	dump_len;
526 	union {
527 		struct {
528 			uint32_t	dump_unext;
529 			uint32_t	dump_ureserved;
530 		} dump_actual;
531 		uint64_t dump_alignment;
532 	} dump_u;
533 #define	dump_next dump_u.dump_actual.dump_unext
534 #define	dump_reserved dump_u.dump_actual.dump_ureserved
535 	/* dump_len - sizeof (ike_dump_t) bytes of data included here */
536 } ike_dump_t;
537 
538 
539 /*
540  * IKE_SVC_GET_{P1|RULE|PS}
541  * Used to request and return individual table items.
542  *
543  * Upon request: get_len is the total msg length (struct + id data);
544  * get_idtype indicates the type of identification being used.
545  *   IKE_SVC_GET_P1:		ike_addr_pr_t or ike_cky_pr_t
546  *   IKE_SVC_GET_RULE:		char string (label)
547  *   IKE_SVC_GET_PS:		ike_addr_pr_t or pair of sadb_ident_t
548  *
549  * Upon return: get_len is the total size (struct + data), get_idtype
550  * is unused, and the data that follows is formatted according to cmd:
551  *   IKE_SVC_GET_P1:		ike_p1_sa_t
552  *   IKE_SVC_GET_RULE:		ike_rule_t
553  *   IKE_SVC_GET_PS:		ike_ps_t
554  */
555 typedef struct {
556 	ike_svccmd_t	cmd;
557 	uint32_t	get_len;
558 	union {
559 		struct {
560 			uint32_t	getu_idtype;
561 			uint32_t	getu_reserved;
562 		} get_actual;
563 		uint64_t get_alignment;
564 	} get_u;
565 #define	get_idtype get_u.get_actual.getu_idtype
566 #define	get_reserved get_u.get_actual.getu_reserved
567 	/* get_len - sizeof (ike_get_t) bytes of data included here */
568 } ike_get_t;
569 
570 
571 /*
572  * IKE_SVC_NEW_{RULE|PS}
573  * Used to request and acknowledge insertion of a table item.
574  *
575  * Upon request: new_len is the total (data + struct) size passed, or 0.
576  * new_len = 0 => a door_desc_t is also included with a file descriptor
577  * for a file containing the data to be added.  The file should include
578  * a single item: a rule, or a pre-shared key.  For new_len != 0, the
579  * data is formatted according to the cmd type:
580  *   IKE_SVC_NEW_RULE:		ike_rule_t
581  *   IKE_SVC_NEW_PS:		ike_ps_t
582  *
583  * Upon return: new_len is 0; simply acknowledges successful insertion
584  * of the requested item.  If insertion is not successful, ike_err_t is
585  * returned instead with appropriate error value.
586  */
587 typedef struct {
588 	ike_svccmd_t	cmd;
589 	uint32_t	new_len;
590 	/* new_len - sizeof (ike_new_t) bytes included here */
591 	uint64_t	new_align;	/* Padding for 64-bit alignment. */
592 } ike_new_t;
593 
594 
595 /*
596  * IKE_SVC_DEL_{P1|RULE|PS}
597  * Used to request and acknowledge the deletion of an individual table
598  * item.
599  *
600  * Upon request: del_len is the total msg length (struct + id data);
601  * del_idtype indicates the type of identification being used.
602  *   IKE_SVC_DEL_P1:		ike_addr_pr_t or ike_cky_pr_t
603  *   IKE_SVC_DEL_RULE:		char string (label)
604  *   IKE_SVC_DEL_PS:		ike_addr_pr_t or pair of sadb_ident_t
605  *
606  * Upon return: acknowledges deletion of the requested item; del_len and
607  * del_idtype are unspecified.  If deletion is not successful, ike_err_t
608  * is returned instead with appropriate error value.
609  */
610 typedef struct {
611 	ike_svccmd_t	cmd;
612 	uint32_t	del_len;
613 	uint32_t	del_idtype;
614 	uint32_t	del_reserved;
615 	/* del_len - sizeof (ike_del_t) bytes of data included here. */
616 } ike_del_t;
617 
618 
619 /*
620  * IKE_SVC_READ_{RULES|PS}
621  * Used to ask daemon to re-read particular configuration info.
622  *
623  * Upon request: rw_loc indicates where the info should be read from:
624  * either from a user-supplied file descriptor(s), or from the default
625  * location(s).  If rw_loc indicates user-supplied location, the file
626  * descriptor(s) should be passed in the door_desc_t struct.  For the
627  * IKE_SVC_READ_RULES cmd, two file descriptors should be specified:
628  * first, one for the config file which contains the data to be read,
629  * and second, one for the cookie file which will be written to as
630  * in.iked process the config file.
631  *
632  * Upon return: rw_loc is unspecified; the message simply acknowledges
633  * successful completion of the request.  If an error occurred,
634  * ike_err_t is returned instead with appropriate error value.
635  *
636  *
637  * IKE_SVC_WRITE_{RULES|PS}
638  * Used to ask daemon to write its current config info to files.
639  *
640  * Request and return are handled the same as for the IKE_SVC_READ_*
641  * cmds; however, the rw_loc MUST be a user-supplied location.  Also,
642  * for the IKE_SVC_WRITE_RULES cmd, the cookie file fd is not required;
643  * only a single fd, for the file to which the config info should be
644  * written, should be passed in.
645  */
646 typedef struct {
647 	ike_svccmd_t	cmd;
648 	uint32_t	rw_loc;
649 } ike_rw_t;
650 
651 
652 /*
653  * IKE_SVC_FLUSH_P1S
654  * Used to request and acknowledge tear-down of all P1 SAs.
655  */
656 typedef struct {
657 	ike_svccmd_t	cmd;
658 } ike_flush_t;
659 
660 
661 /*
662  * IKE_SVC_ERROR
663  * Used on return if server encountered an error while processing
664  * the request.  An appropriate error code is included (as defined
665  * in this header file); in the case of IKE_ERR_SYS_ERR, a value
666  * from the UNIX errno space is included in the ike_err_unix field.
667  */
668 typedef struct {
669 	ike_svccmd_t	cmd;
670 	uint32_t	ike_err;
671 	uint32_t	ike_err_unix;
672 	uint32_t	ike_err_reserved;
673 } ike_err_t;
674 
675 
676 /*
677  * Generic type for use when the request/reply type is unknown
678  */
679 typedef struct {
680 	ike_svccmd_t	cmd;
681 } ike_cmd_t;
682 
683 
684 /*
685  * Union containing all possible request/retrun structures.
686  */
687 typedef union {
688 	ike_cmd_t	svc_cmd;
689 	ike_dbg_t	svc_dbg;
690 	ike_priv_t	svc_priv;
691 	ike_statreq_t	svc_stats;
692 	ike_dump_t	svc_dump;
693 	ike_get_t	svc_get;
694 	ike_new_t	svc_new;
695 	ike_del_t	svc_del;
696 	ike_rw_t	svc_rw;
697 	ike_flush_t	svc_flush;
698 	ike_err_t	svc_err;
699 	ike_defreq_t	svc_defaults;
700 } ike_service_t;
701 
702 #ifdef	__cplusplus
703 }
704 #endif
705 
706 #endif	/* _IKEDOOR_H */
707