]> git.ipfire.org Git - people/ms/dnsmasq.git/blob - src/config.h
import of dnsmasq-2.57.tar.gz
[people/ms/dnsmasq.git] / src / config.h
1 /* dnsmasq is Copyright (c) 2000-2011 Simon Kelley
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 dated June, 1991, or
6 (at your option) version 3 dated 29 June, 2007.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #define VERSION "2.57"
18
19 #define FTABSIZ 150 /* max number of outstanding requests (default) */
20 #define MAX_PROCS 20 /* max no children for TCP requests */
21 #define CHILD_LIFETIME 150 /* secs 'till terminated (RFC1035 suggests > 120s) */
22 #define EDNS_PKTSZ 4096 /* default max EDNS.0 UDP packet from RFC5625 */
23 #define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */
24 #define FORWARD_TEST 50 /* try all servers every 50 queries */
25 #define FORWARD_TIME 20 /* or 20 seconds */
26 #define RANDOM_SOCKS 64 /* max simultaneous random ports */
27 #define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */
28 #define CACHESIZ 150 /* default cache size */
29 #define MAXLEASES 1000 /* maximum number of DHCP leases */
30 #define PING_WAIT 3 /* wait for ping address-in-use test */
31 #define PING_CACHE_TIME 30 /* Ping test assumed to be valid this long. */
32 #define DECLINE_BACKOFF 600 /* disable DECLINEd static addresses for this long */
33 #define DHCP_PACKET_MAX 16384 /* hard limit on DHCP packet size */
34 #define SMALLDNAME 40 /* most domain names are smaller than this */
35 #define HOSTSFILE "/etc/hosts"
36 #define ETHERSFILE "/etc/ethers"
37 #ifdef __uClinux__
38 # define RESOLVFILE "/etc/config/resolv.conf"
39 #else
40 # define RESOLVFILE "/etc/resolv.conf"
41 #endif
42 #define RUNFILE "/var/run/dnsmasq.pid"
43
44 #ifndef LEASEFILE
45 # if defined(__FreeBSD__) || defined (__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
46 # define LEASEFILE "/var/db/dnsmasq.leases"
47 # elif defined(__sun__) || defined (__sun)
48 # define LEASEFILE "/var/cache/dnsmasq.leases"
49 # elif defined(__ANDROID__)
50 # define LEASEFILE "/data/misc/dhcp/dnsmasq.leases"
51 # else
52 # define LEASEFILE "/var/lib/misc/dnsmasq.leases"
53 # endif
54 #endif
55
56 #ifndef CONFFILE
57 # if defined(__FreeBSD__)
58 # define CONFFILE "/usr/local/etc/dnsmasq.conf"
59 # else
60 # define CONFFILE "/etc/dnsmasq.conf"
61 # endif
62 #endif
63
64 #define DEFLEASE 3600 /* default lease time, 1 hour */
65 #define CHUSER "nobody"
66 #define CHGRP "dip"
67 #define NAMESERVER_PORT 53
68 #define DHCP_SERVER_PORT 67
69 #define DHCP_CLIENT_PORT 68
70 #define DHCP_SERVER_ALTPORT 1067
71 #define DHCP_CLIENT_ALTPORT 1068
72 #define PXE_PORT 4011
73 #define TFTP_PORT 69
74 #define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
75 #define LOG_MAX 5 /* log-queue length */
76 #define RANDFILE "/dev/urandom"
77 #define DAD_WAIT 20 /* retry binding IPv6 sockets for this long */
78 #define EDNS0_OPTION_MAC 5 /* dyndns.org temporary assignment */
79
80 /* DBUS interface specifics */
81 #define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq"
82 #define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq"
83
84 /* Follows system specific switches. If you run on a
85 new system, you may want to edit these.
86 May replace this with Autoconf one day.
87
88 HAVE_LINUX_NETWORK
89 HAVE_BSD_NETWORK
90 HAVE_SOLARIS_NETWORK
91 define exactly one of these to alter interaction with kernel networking.
92
93 HAVE_BROKEN_RTC
94 define this on embedded systems which don't have an RTC
95 which keeps time over reboots. Causes dnsmasq to use uptime
96 for timing, and keep lease lengths rather than expiry times
97 in its leases file. This also make dnsmasq "flash disk friendly".
98 Normally, dnsmasq tries very hard to keep the on-disk leases file
99 up-to-date: rewriting it after every renewal. When HAVE_BROKEN_RTC
100 is in effect, the lease file is only written when a new lease is
101 created, or an old one destroyed. (Because those are the only times
102 it changes.) This vastly reduces the number of file writes, and makes
103 it viable to keep the lease file on a flash filesystem.
104 NOTE: when enabling or disabling this, be sure to delete any old
105 leases file, otherwise dnsmasq may get very confused.
106
107 HAVE_TFTP
108 define this to get dnsmasq's built-in TFTP server.
109
110 HAVE_DHCP
111 define this to get dnsmasq's DHCP server.
112
113 HAVE_SCRIPT
114 define this to get the ability to call scripts on lease-change
115
116 HAVE_GETOPT_LONG
117 define this if you have GNU libc or GNU getopt.
118
119 HAVE_ARC4RANDOM
120 define this if you have arc4random() to get better security from DNS spoofs
121 by using really random ids (OpenBSD)
122
123 HAVE_SOCKADDR_SA_LEN
124 define this if struct sockaddr has sa_len field (*BSD)
125
126 HAVE_DBUS
127 define this if you want to link against libdbus, and have dnsmasq
128 support some methods to allow (re)configuration of the upstream DNS
129 servers via DBus.
130
131 HAVE_IDN
132 define this if you want international domain name support.
133 NOTE: for backwards compatibility, IDN support is automatically
134 included when internationalisation support is built, using the
135 *-i18n makefile targets, even if HAVE_IDN is not explicitly set.
136
137 NOTES:
138 For Linux you should define
139 HAVE_LINUX_NETWORK
140 HAVE_GETOPT_LONG
141 you should NOT define
142 HAVE_ARC4RANDOM
143 HAVE_SOCKADDR_SA_LEN
144
145 For *BSD systems you should define
146 HAVE_BSD_NETWORK
147 HAVE_SOCKADDR_SA_LEN
148 and you MAY define
149 HAVE_ARC4RANDOM - OpenBSD and FreeBSD and NetBSD version 2.0 or later
150 HAVE_GETOPT_LONG - NetBSD, later FreeBSD
151 (FreeBSD and OpenBSD only if you link GNU getopt)
152
153 */
154
155 /* platform independent options- uncomment to enable */
156 #define HAVE_DHCP
157 #define HAVE_TFTP
158 #define HAVE_SCRIPT
159 /* #define HAVE_BROKEN_RTC */
160 /* #define HAVE_DBUS */
161 /* #define HAVE_IDN */
162
163 /* Allow TFTP to be disabled with COPTS=-DNO_TFTP */
164 #ifdef NO_TFTP
165 #undef HAVE_TFTP
166 #endif
167
168 /* Allow DHCP to be disabled with COPTS=-DNO_DHCP */
169 #ifdef NO_DHCP
170 #undef HAVE_DHCP
171 #endif
172
173 /* Allow scripts to be disabled with COPTS=-DNO_SCRIPT */
174 #ifdef NO_SCRIPT
175 #undef HAVE_SCRIPT
176 #endif
177
178
179
180 /* platform dependent options. */
181
182 /* Must preceed __linux__ since uClinux defines __linux__ too. */
183 #if defined(__uClinux__)
184 #define HAVE_LINUX_NETWORK
185 #define HAVE_GETOPT_LONG
186 #undef HAVE_ARC4RANDOM
187 #undef HAVE_SOCKADDR_SA_LEN
188 /* Never use fork() on uClinux. Note that this is subtly different from the
189 --keep-in-foreground option, since it also suppresses forking new
190 processes for TCP connections and disables the call-a-script on leasechange
191 system. It's intended for use on MMU-less kernels. */
192 #define NO_FORK
193
194 #elif defined(__UCLIBC__)
195 #define HAVE_LINUX_NETWORK
196 #if defined(__UCLIBC_HAS_GNU_GETOPT__) || \
197 ((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21))
198 # define HAVE_GETOPT_LONG
199 #endif
200 #undef HAVE_ARC4RANDOM
201 #undef HAVE_SOCKADDR_SA_LEN
202 #if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__)
203 # define NO_FORK
204 #endif
205 #if defined(__UCLIBC_HAS_IPV6__)
206 # ifndef IPV6_V6ONLY
207 # define IPV6_V6ONLY 26
208 # endif
209 #endif
210
211 /* This is for glibc 2.x */
212 #elif defined(__linux__)
213 #define HAVE_LINUX_NETWORK
214 #define HAVE_GETOPT_LONG
215 #undef HAVE_ARC4RANDOM
216 #undef HAVE_SOCKADDR_SA_LEN
217
218 #elif defined(__FreeBSD__) || \
219 defined(__OpenBSD__) || \
220 defined(__DragonFly__) || \
221 defined(__FreeBSD_kernel__)
222 #define HAVE_BSD_NETWORK
223 /* Later verions of FreeBSD have getopt_long() */
224 #if defined(optional_argument) && defined(required_argument)
225 # define HAVE_GETOPT_LONG
226 #endif
227 #if !defined(__FreeBSD_kernel__)
228 # define HAVE_ARC4RANDOM
229 #endif
230 #define HAVE_SOCKADDR_SA_LEN
231
232 #elif defined(__APPLE__)
233 #define HAVE_BSD_NETWORK
234 #define HAVE_GETOPT_LONG
235 #define HAVE_ARC4RANDOM
236 #define HAVE_SOCKADDR_SA_LEN
237 /* Define before sys/socket.h is included so we get socklen_t */
238 #define _BSD_SOCKLEN_T_
239
240 #elif defined(__NetBSD__)
241 #define HAVE_BSD_NETWORK
242 #define HAVE_GETOPT_LONG
243 #undef HAVE_ARC4RANDOM
244 #define HAVE_SOCKADDR_SA_LEN
245
246 #elif defined(__sun) || defined(__sun__)
247 #define HAVE_SOLARIS_NETWORK
248 #define HAVE_GETOPT_LONG
249 #undef HAVE_ARC4RANDOM
250 #undef HAVE_SOCKADDR_SA_LEN
251 #define ETHER_ADDR_LEN 6
252
253 #endif
254
255 /* Decide if we're going to support IPv6 */
256 /* IPv6 can be forced off with "make COPTS=-DNO_IPV6" */
257 /* We assume that systems which don't have IPv6
258 headers don't have ntop and pton either */
259
260 #if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY) && !defined(NO_IPV6)
261 # define HAVE_IPV6
262 # define ADDRSTRLEN INET6_ADDRSTRLEN
263 # if defined(SOL_IPV6)
264 # define IPV6_LEVEL SOL_IPV6
265 # else
266 # define IPV6_LEVEL IPPROTO_IPV6
267 # endif
268 #elif defined(INET_ADDRSTRLEN)
269 # undef HAVE_IPV6
270 # define ADDRSTRLEN INET_ADDRSTRLEN
271 #else
272 # undef HAVE_IPV6
273 # define ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */
274 #endif
275
276 /* Can't do scripts without fork */
277 #ifdef NOFORK
278 # undef HAVE_SCRIPT
279 #endif
280