]> git.saurik.com Git - apple/ipsec.git/blame - ipsec-tools/racoon/localconf.h
ipsec-317.220.1.tar.gz
[apple/ipsec.git] / ipsec-tools / racoon / localconf.h
CommitLineData
52b7d2ce
A
1/* $Id: localconf.h,v 1.9.2.3 2005/11/06 17:18:26 monas Exp $ */
2
3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the project nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#ifndef _LOCALCONF_H
33#define _LOCALCONF_H
34
d1e348cf
A
35#if !TARGET_OS_EMBEDDED
36#include <vproc.h>
37#endif
65c25746 38#include <dispatch/dispatch.h>
bd966c25
A
39#if __has_include(<nw/private.h>)
40#include <nw/private.h>
41#else
d06a7ccb 42#include <network/nat64.h>
bd966c25 43#endif
65c25746
A
44#include "vmbuf.h"
45#include "ipsec_doi.h"
d1e348cf 46
52b7d2ce
A
47/* local configuration */
48
49#define LC_DEFAULT_CF SYSCONFDIR "/racoon.conf"
50
51#define LC_PATHTYPE_INCLUDE 0
52#define LC_PATHTYPE_PSK 1
53#define LC_PATHTYPE_CERT 2
65c25746
A
54#define LC_PATHTYPE_PIDFILE 3
55#define LC_PATHTYPE_LOGFILE 4
56#define LC_PATHTYPE_MAX 5
52b7d2ce
A
57
58#define LC_DEFAULT_PAD_MAXSIZE 20
59#define LC_DEFAULT_PAD_RANDOM TRUE
60#define LC_DEFAULT_PAD_RANDOMLEN FALSE
61#define LC_DEFAULT_PAD_STRICT FALSE
62#define LC_DEFAULT_PAD_EXCLTAIL TRUE
63#define LC_DEFAULT_RETRY_COUNTER 5
e8d9021d 64#define LC_DEFAULT_RETRY_INTERVAL 2
52b7d2ce
A
65#define LC_DEFAULT_COUNT_PERSEND 1
66#define LC_DEFAULT_RETRY_CHECKPH1 30
67#define LC_DEFAULT_WAIT_PH2COMPLETE 30
68#define LC_DEFAULT_NATT_KA_INTERVAL 20
69
70#define LC_DEFAULT_SECRETSIZE 16 /* 128 bits */
71
52b7d2ce
A
72#define LC_GSSENC_UTF16LE 0 /* GSS ID in UTF-16LE */
73#define LC_GSSENC_LATIN1 1 /* GSS ID in ISO-Latin-1 */
74#define LC_GSSENC_MAX 2
75
76#define LC_AUTOEXITSTATE_SET 0x00000001
77#define LC_AUTOEXITSTATE_CLIENT 0x00000010
78#define LC_AUTOEXITSTATE_ENABLED 0x00000011 /* both VPN client and set */
79
80
81struct vpnctl_socket_elem {
82 LIST_ENTRY(vpnctl_socket_elem) chain;
65c25746
A
83 int sock;
84 dispatch_source_t source;
7ebaebe2
A
85 uint32_t read_bytes_len;
86 uint32_t pending_bytes_len;
87 uint8_t *buffer;
52b7d2ce
A
88 LIST_HEAD(_bound_addrs, bound_addr) bound_addresses;
89};
90
91struct bound_addr {
92 LIST_ENTRY(bound_addr) chain;
93 u_int32_t address;
d06a7ccb 94 nw_nat64_prefix_t nat64_prefix;
d1e348cf
A
95 vchar_t *user_id;
96 vchar_t *user_pw;
97 vchar_t *version; /* our version string - if present */
52b7d2ce
A
98};
99
100struct redirect {
101 LIST_ENTRY(redirect) chain;
102 u_int32_t cluster_address;
103 u_int32_t redirect_address;
104 u_int16_t force;
105};
106
fd507379
A
107struct saved_msg_elem {
108 TAILQ_ENTRY(saved_msg_elem) chain;
109 void* msg;
110};
52b7d2ce 111
d1e348cf 112
52b7d2ce
A
113struct localconf {
114 char *racoon_conf; /* configuration filename */
115
116 uid_t uid;
117 gid_t gid;
52b7d2ce
A
118 u_int16_t port_isakmp; /* port for isakmp as default */
119 u_int16_t port_isakmp_natt; /* port for NAT-T use */
120 u_int16_t port_admin; /* port for admin */
121 int default_af; /* default address family */
122
52b7d2ce
A
123 int sock_vpncontrol;
124 int sock_pfkey;
125 int rtsock; /* routing socket */
65c25746
A
126 dispatch_source_t vpncontrol_source;
127 dispatch_source_t pfkey_source;
128 dispatch_source_t rt_source;
d1e348cf 129
52b7d2ce
A
130 LIST_HEAD(_vpnctl_socket_elem_, vpnctl_socket_elem) vpnctl_comm_socks;
131 LIST_HEAD(_redirect_, redirect) redirect_addresses;
132 int auto_exit_state; /* auto exit state */
133 int auto_exit_delay; /* auto exit delay until exit */
65c25746 134 schedule_ref auto_exit_sched; /* auto exit schedule */
52b7d2ce 135
fd507379 136 TAILQ_HEAD(_saved_msg_elem, saved_msg_elem) saved_msg_queue;
52b7d2ce
A
137 int autograbaddr;
138 struct myaddrs *myaddrs;
139
d1e348cf 140 char *logfile_param; /* from command line */
52b7d2ce 141 char *pathinfo[LC_PATHTYPE_MAX];
65c25746 142 vchar_t *ident[IDTYPE_MAX]; /* base of Identifier payload. */
52b7d2ce
A
143
144 int pad_random;
145 int pad_randomlen;
146 int pad_maxsize;
147 int pad_strict;
148 int pad_excltail;
149
150 int retry_counter; /* times to retry. */
151 int retry_interval; /* interval each retry. */
152 int count_persend; /* the number of packets each retry. */
153 /* above 3 values are copied into a handler. */
154
155 int retry_checkph1;
156 int wait_ph2complete;
157
158 int natt_ka_interval; /* NAT-T keepalive interval. */
05434fec 159 vchar_t *ext_nat_id; /* our address id for our nat address */
52b7d2ce
A
160
161 int secret_size;
162 int strict_address; /* strictly check addresses. */
163
164 int complex_bundle;
165 /*
166 * If we want to make a packet "IP2 AH ESP IP1 ULP",
167 * the SPD in KAME expresses AH transport + ESP tunnel.
168 * So racoon sent the proposal contained such the order.
169 * But lots of implementation interprets AH tunnel + ESP
170 * tunnel in this case. racoon has changed the format,
171 * usually uses this format. If the option, 'complex_bundle'
172 * is enable, racoon uses old format.
173 */
174
d1e348cf
A
175#if !TARGET_OS_EMBEDDED
176 vproc_transaction_t vt; /* returned by vproc_transaction_begin */
177#endif
52b7d2ce
A
178};
179
65c25746 180
52b7d2ce
A
181extern struct localconf *lcconf;
182
65c25746
A
183extern void initlcconf(void);
184extern void flushlcconf(void);
185extern void savelcconf(void);
186extern void restorelcconf(void);
187extern vchar_t *getpskbyname(vchar_t *);
188extern vchar_t *getpskbyaddr(struct sockaddr_storage *);
e8d9021d 189#if HAVE_KEYCHAIN
65c25746 190extern vchar_t *getpskfromkeychain(const char *, u_int8_t, int, vchar_t *);
52b7d2ce 191#endif
65c25746
A
192extern void getpathname(char *, int, int, const char *);
193extern int sittype2doi(int);
194extern int doitype2doi(int);
195extern vchar_t *getpsk(const char *, const int);
52b7d2ce 196
d1e348cf 197
52b7d2ce 198#endif /* _LOCALCONF_H */