Update to dnsmasq v2.66rc3
[tomato.git] / release / src / router / dnsmasq / src / config.h
blob0aefdc9bebae07a1bf25af7a0b4d316eaf0e3011
1 /* dnsmasq is Copyright (c) 2000-2013 Simon Kelley
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.
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.
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/>.
17 #define FTABSIZ 150 /* max number of outstanding requests (default) */
18 #define MAX_PROCS 20 /* max no children for TCP requests */
19 #define CHILD_LIFETIME 150 /* secs 'till terminated (RFC1035 suggests > 120s) */
20 #define EDNS_PKTSZ 4096 /* default max EDNS.0 UDP packet from RFC5625 */
21 #define KEYBLOCK_LEN 140 /* choose to mininise fragmentation when storing DNSSEC keys */
22 #define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */
23 #define FORWARD_TEST 50 /* try all servers every 50 queries */
24 #define FORWARD_TIME 20 /* or 20 seconds */
25 #define RANDOM_SOCKS 64 /* max simultaneous random ports */
26 #define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */
27 #define CACHESIZ 150 /* default cache size */
28 #define MAXLEASES 1000 /* maximum number of DHCP leases */
29 #define PING_WAIT 3 /* wait for ping address-in-use test */
30 #define PING_CACHE_TIME 30 /* Ping test assumed to be valid this long. */
31 #define DECLINE_BACKOFF 600 /* disable DECLINEd static addresses for this long */
32 #define DHCP_PACKET_MAX 16384 /* hard limit on DHCP packet size */
33 #define SMALLDNAME 40 /* most domain names are smaller than this */
34 #define HOSTSFILE "/etc/hosts"
35 #define ETHERSFILE "/etc/ethers"
36 #define DEFLEASE 3600 /* default lease time, 1 hour */
37 #define CHUSER "nobody"
38 #define CHGRP "dip"
39 #define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
40 #define LOG_MAX 5 /* log-queue length */
41 #define RANDFILE "/dev/urandom"
42 #define EDNS0_OPTION_MAC 5 /* dyndns.org temporary assignment */
43 #define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq" /* Default - may be overridden by config */
44 #define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq"
45 #define AUTH_TTL 600 /* default TTL for auth DNS */
46 #define SOA_REFRESH 1200 /* SOA refresh default */
47 #define SOA_RETRY 180 /* SOA retry default */
48 #define SOA_EXPIRY 1209600 /* SOA expiry default */
49 #define RA_INTERVAL 600 /* Send unsolicited RA's this often when not provoked. */
51 /* compile-time options: uncomment below to enable or do eg.
52 make COPTS=-DHAVE_BROKEN_RTC
54 HAVE_BROKEN_RTC
55 define this on embedded systems which don't have an RTC
56 which keeps time over reboots. Causes dnsmasq to use uptime
57 for timing, and keep lease lengths rather than expiry times
58 in its leases file. This also make dnsmasq "flash disk friendly".
59 Normally, dnsmasq tries very hard to keep the on-disk leases file
60 up-to-date: rewriting it after every renewal. When HAVE_BROKEN_RTC
61 is in effect, the lease file is only written when a new lease is
62 created, or an old one destroyed. (Because those are the only times
63 it changes.) This vastly reduces the number of file writes, and makes
64 it viable to keep the lease file on a flash filesystem.
65 NOTE: when enabling or disabling this, be sure to delete any old
66 leases file, otherwise dnsmasq may get very confused.
68 HAVE_TFTP
69 define this to get dnsmasq's built-in TFTP server.
71 HAVE_DHCP
72 define this to get dnsmasq's DHCPv4 server.
74 HAVE_DHCP6
75 define this to get dnsmasq's DHCPv6 server. (implies HAVE_DHCP).
77 HAVE_SCRIPT
78 define this to get the ability to call scripts on lease-change.
80 HAVE_LUASCRIPT
81 define this to get the ability to call Lua script on lease-change. (implies HAVE_SCRIPT)
83 HAVE_DBUS
84 define this if you want to link against libdbus, and have dnsmasq
85 support some methods to allow (re)configuration of the upstream DNS
86 servers via DBus.
88 HAVE_IDN
89 define this if you want international domain name support.
90 NOTE: for backwards compatibility, IDN support is automatically
91 included when internationalisation support is built, using the
92 *-i18n makefile targets, even if HAVE_IDN is not explicitly set.
94 HAVE_CONNTRACK
95 define this to include code which propogates conntrack marks from
96 incoming DNS queries to the corresponding upstream queries. This adds
97 a build-dependency on libnetfilter_conntrack, but the resulting binary will
98 still run happily on a kernel without conntrack support.
100 HAVE_IPSET
101 define this to include the ability to selectively add resolved ip addresses
102 to given ipsets.
104 HAVE_AUTH
105 define this to include the facility to act as an authoritative DNS
106 server for one or more zones.
109 NO_IPV6
110 NO_TFTP
111 NO_DHCP
112 NO_DHCP6
113 NO_SCRIPT
114 NO_LARGEFILE
115 NO_AUTH
116 these are avilable to explictly disable compile time options which would
117 otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
118 which are enabled by default in the distributed source tree. Building dnsmasq
119 with something like "make COPTS=-DNO_SCRIPT" will do the trick.
121 LEASEFILE
122 CONFFILE
123 RESOLVFILE
124 the default locations of these files are determined below, but may be overridden
125 in a build command line using COPTS.
130 /* The default set of options to build. Built with these options, dnsmasq
131 has no library dependencies other than libc */
133 #define HAVE_DHCP
134 #define HAVE_DHCP6
135 #define HAVE_TFTP
136 #define HAVE_SCRIPT
137 #define HAVE_AUTH
138 #define HAVE_IPSET
139 /* #define HAVE_LUASCRIPT */
140 /* #define HAVE_BROKEN_RTC */
141 /* #define HAVE_DBUS */
142 /* #define HAVE_IDN */
143 /* #define HAVE_CONNTRACK */
146 /* Default locations for important system files. */
148 #ifndef LEASEFILE
149 # if defined(__FreeBSD__) || defined (__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
150 # define LEASEFILE "/var/db/dnsmasq.leases"
151 # elif defined(__sun__) || defined (__sun)
152 # define LEASEFILE "/var/cache/dnsmasq.leases"
153 # elif defined(__ANDROID__)
154 # define LEASEFILE "/data/misc/dhcp/dnsmasq.leases"
155 # else
156 # define LEASEFILE "/var/lib/misc/dnsmasq.leases"
157 # endif
158 #endif
160 #ifndef CONFFILE
161 # if defined(__FreeBSD__)
162 # define CONFFILE "/usr/local/etc/dnsmasq.conf"
163 # else
164 # define CONFFILE "/etc/dnsmasq.conf"
165 # endif
166 #endif
168 #ifndef RESOLVFILE
169 # if defined(__uClinux__)
170 # define RESOLVFILE "/etc/config/resolv.conf"
171 # else
172 # define RESOLVFILE "/etc/resolv.conf"
173 # endif
174 #endif
176 #ifndef RUNFILE
177 # if defined(__ANDROID__)
178 # define RUNFILE "/data/dnsmasq.pid"
179 # else
180 # define RUNFILE "/var/run/dnsmasq.pid"
181 # endif
182 #endif
184 /* platform dependent options: these are determined automatically below
186 HAVE_LINUX_NETWORK
187 HAVE_BSD_NETWORK
188 HAVE_SOLARIS_NETWORK
189 define exactly one of these to alter interaction with kernel networking.
191 HAVE_GETOPT_LONG
192 defined when GNU-style getopt_long available.
194 HAVE_ARC4RANDOM
195 defined if arc4random() available to get better security from DNS spoofs
196 by using really random ids (OpenBSD)
198 HAVE_SOCKADDR_SA_LEN
199 defined if struct sockaddr has sa_len field (*BSD)
202 /* Must preceed __linux__ since uClinux defines __linux__ too. */
203 #if defined(__uClinux__)
204 #define HAVE_LINUX_NETWORK
205 #define HAVE_GETOPT_LONG
206 #undef HAVE_ARC4RANDOM
207 #undef HAVE_SOCKADDR_SA_LEN
208 /* Never use fork() on uClinux. Note that this is subtly different from the
209 --keep-in-foreground option, since it also suppresses forking new
210 processes for TCP connections and disables the call-a-script on leasechange
211 system. It's intended for use on MMU-less kernels. */
212 #define NO_FORK
214 #elif defined(__UCLIBC__)
215 #define HAVE_LINUX_NETWORK
216 #if defined(__UCLIBC_HAS_GNU_GETOPT__) || \
217 ((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21))
218 # define HAVE_GETOPT_LONG
219 #endif
220 #undef HAVE_ARC4RANDOM
221 #undef HAVE_SOCKADDR_SA_LEN
222 #if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__)
223 # define NO_FORK
224 #endif
225 #if defined(__UCLIBC_HAS_IPV6__)
226 # ifndef IPV6_V6ONLY
227 # define IPV6_V6ONLY 26
228 # endif
229 #endif
231 /* This is for glibc 2.x */
232 #elif defined(__linux__)
233 #define HAVE_LINUX_NETWORK
234 #define HAVE_GETOPT_LONG
235 #undef HAVE_ARC4RANDOM
236 #undef HAVE_SOCKADDR_SA_LEN
238 #elif defined(__FreeBSD__) || \
239 defined(__OpenBSD__) || \
240 defined(__DragonFly__) || \
241 defined(__FreeBSD_kernel__)
242 #define HAVE_BSD_NETWORK
243 /* Later verions of FreeBSD have getopt_long() */
244 #if defined(optional_argument) && defined(required_argument)
245 # define HAVE_GETOPT_LONG
246 #endif
247 #if !defined(__FreeBSD_kernel__)
248 # define HAVE_ARC4RANDOM
249 #endif
250 #define HAVE_SOCKADDR_SA_LEN
252 #elif defined(__APPLE__)
253 #define HAVE_BSD_NETWORK
254 #define HAVE_GETOPT_LONG
255 #define HAVE_ARC4RANDOM
256 #define HAVE_SOCKADDR_SA_LEN
257 /* Define before sys/socket.h is included so we get socklen_t */
258 #define _BSD_SOCKLEN_T_
260 #elif defined(__NetBSD__)
261 #define HAVE_BSD_NETWORK
262 #define HAVE_GETOPT_LONG
263 #undef HAVE_ARC4RANDOM
264 #define HAVE_SOCKADDR_SA_LEN
266 #elif defined(__sun) || defined(__sun__)
267 #define HAVE_SOLARIS_NETWORK
268 #define HAVE_GETOPT_LONG
269 #undef HAVE_ARC4RANDOM
270 #undef HAVE_SOCKADDR_SA_LEN
271 #define ETHER_ADDR_LEN 6
273 #endif
275 /* Decide if we're going to support IPv6 */
276 /* We assume that systems which don't have IPv6
277 headers don't have ntop and pton either */
279 #if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY)
280 # define HAVE_IPV6
281 # define ADDRSTRLEN INET6_ADDRSTRLEN
282 #elif defined(INET_ADDRSTRLEN)
283 # undef HAVE_IPV6
284 # define ADDRSTRLEN INET_ADDRSTRLEN
285 #else
286 # undef HAVE_IPV6
287 # define ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */
288 #endif
291 /* rules to implement compile-time option dependencies and
292 the NO_XXX flags */
294 #ifdef NO_IPV6
295 #undef HAVE_IPV6
296 #endif
298 #ifdef NO_TFTP
299 #undef HAVE_TFTP
300 #endif
302 #ifdef NO_DHCP
303 #undef HAVE_DHCP
304 #undef HAVE_DHCP6
305 #endif
307 #if defined(NO_DHCP6) || !defined(HAVE_IPV6)
308 #undef HAVE_DHCP6
309 #endif
311 /* DHCP6 needs DHCP too */
312 #ifdef HAVE_DHCP6
313 #define HAVE_DHCP
314 #endif
316 #if defined(NO_SCRIPT) || !defined(HAVE_DHCP) || defined(NO_FORK)
317 #undef HAVE_SCRIPT
318 #undef HAVE_LUASCRIPT
319 #endif
321 /* Must HAVE_SCRIPT to HAVE_LUASCRIPT */
322 #ifdef HAVE_LUASCRIPT
323 #define HAVE_SCRIPT
324 #endif
326 #ifdef NO_AUTH
327 #undef HAVE_AUTH
328 #endif
330 #if defined(NO_IPSET) || !defined(HAVE_LINUX_NETWORK)
331 #undef HAVE_IPSET
332 #endif
334 /* Define a string indicating which options are in use.
335 DNSMASQP_COMPILE_OPTS is only defined in dnsmasq.c */
337 #ifdef DNSMASQ_COMPILE_OPTS
339 static char *compile_opts =
340 #ifndef HAVE_IPV6
341 "no-"
342 #endif
343 "IPv6 "
344 #ifndef HAVE_GETOPT_LONG
345 "no-"
346 #endif
347 "GNU-getopt "
348 #ifdef HAVE_BROKEN_RTC
349 "no-RTC "
350 #endif
351 #ifdef NO_FORK
352 "no-MMU "
353 #endif
354 #ifndef HAVE_DBUS
355 "no-"
356 #endif
357 "DBus "
358 #ifndef LOCALEDIR
359 "no-"
360 #endif
361 "i18n "
362 #if !defined(LOCALEDIR) && !defined(HAVE_IDN)
363 "no-"
364 #endif
365 "IDN "
366 #ifndef HAVE_DHCP
367 "no-"
368 #endif
369 "DHCP "
370 #if defined(HAVE_DHCP)
371 # if !defined (HAVE_DHCP6)
372 "no-"
373 # endif
374 "DHCPv6 "
375 # if !defined(HAVE_SCRIPT)
376 "no-scripts "
377 # else
378 # if !defined(HAVE_LUASCRIPT)
379 "no-"
380 # endif
381 "Lua "
382 # endif
383 #endif
384 #ifndef HAVE_TFTP
385 "no-"
386 #endif
387 "TFTP "
388 #ifndef HAVE_CONNTRACK
389 "no-"
390 #endif
391 "conntrack "
392 #ifndef HAVE_IPSET
393 "no-"
394 #endif
395 "ipset "
396 #ifdef HAVE_TOMATO
397 "Tomato-helper "
398 #endif
399 #ifndef HAVE_AUTH
400 "no-"
401 #endif
402 "auth";
404 #endif