]>
git.ipfire.org Git - people/ms/dnsmasq.git/blob - src/config.h
1 /* dnsmasq is Copyright (c) 2000-2015 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 TCP_MAX_QUERIES 100 /* Maximum number of queries per incoming TCP connection */
21 #define EDNS_PKTSZ 4096 /* default max EDNS.0 UDP packet from RFC5625 */
22 #define SAFE_PKTSZ 1280 /* "go anywhere" UDP packet size */
23 #define KEYBLOCK_LEN 40 /* choose to mininise fragmentation when storing DNSSEC keys */
24 #define DNSSEC_WORK 50 /* Max number of queries to validate one question */
25 #define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */
26 #define FORWARD_TEST 50 /* try all servers every 50 queries */
27 #define FORWARD_TIME 20 /* or 20 seconds */
28 #define RANDOM_SOCKS 64 /* max simultaneous random ports */
29 #define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */
30 #define CACHESIZ 150 /* default cache size */
31 #define TTL_FLOOR_LIMIT 3600 /* don't allow --min-cache-ttl to raise TTL above this under any circumstances */
32 #define MAXLEASES 1000 /* maximum number of DHCP leases */
33 #define PING_WAIT 3 /* wait for ping address-in-use test */
34 #define PING_CACHE_TIME 30 /* Ping test assumed to be valid this long. */
35 #define DECLINE_BACKOFF 600 /* disable DECLINEd static addresses for this long */
36 #define DHCP_PACKET_MAX 16384 /* hard limit on DHCP packet size */
37 #define SMALLDNAME 50 /* most domain names are smaller than this */
38 #define CNAME_CHAIN 10 /* chains longer than this atr dropped for loop protection */
39 #define HOSTSFILE "/etc/hosts"
40 #define ETHERSFILE "/etc/ethers"
41 #define DEFLEASE 3600 /* default lease time, 1 hour */
42 #define CHUSER "nobody"
44 #define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
45 #define LOG_MAX 5 /* log-queue length */
46 #define RANDFILE "/dev/urandom"
47 #define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq" /* Default - may be overridden by config */
48 #define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq"
49 #define AUTH_TTL 600 /* default TTL for auth DNS */
50 #define SOA_REFRESH 1200 /* SOA refresh default */
51 #define SOA_RETRY 180 /* SOA retry default */
52 #define SOA_EXPIRY 1209600 /* SOA expiry default */
53 #define LOOP_TEST_DOMAIN "test" /* domain for loop testing, "test" is reserved by RFC 2606 and won't therefore clash */
54 #define LOOP_TEST_TYPE T_TXT
56 /* compile-time options: uncomment below to enable or do eg.
57 make COPTS=-DHAVE_BROKEN_RTC
60 define this on embedded systems which don't have an RTC
61 which keeps time over reboots. Causes dnsmasq to use uptime
62 for timing, and keep lease lengths rather than expiry times
63 in its leases file. This also make dnsmasq "flash disk friendly".
64 Normally, dnsmasq tries very hard to keep the on-disk leases file
65 up-to-date: rewriting it after every renewal. When HAVE_BROKEN_RTC
66 is in effect, the lease file is only written when a new lease is
67 created, or an old one destroyed. (Because those are the only times
68 it changes.) This vastly reduces the number of file writes, and makes
69 it viable to keep the lease file on a flash filesystem.
70 NOTE: when enabling or disabling this, be sure to delete any old
71 leases file, otherwise dnsmasq may get very confused.
74 define this to get dnsmasq's built-in TFTP server.
77 define this to get dnsmasq's DHCPv4 server.
80 define this to get dnsmasq's DHCPv6 server. (implies HAVE_DHCP).
83 define this to get the ability to call scripts on lease-change.
86 define this to get the ability to call Lua script on lease-change. (implies HAVE_SCRIPT)
89 define this if you want to link against libdbus, and have dnsmasq
90 support some methods to allow (re)configuration of the upstream DNS
94 define this if you want international domain name support.
95 NOTE: for backwards compatibility, IDN support is automatically
96 included when internationalisation support is built, using the
97 *-i18n makefile targets, even if HAVE_IDN is not explicitly set.
100 define this to include code which propogates conntrack marks from
101 incoming DNS queries to the corresponding upstream queries. This adds
102 a build-dependency on libnetfilter_conntrack, but the resulting binary will
103 still run happily on a kernel without conntrack support.
106 define this to include the ability to selectively add resolved ip addresses
110 define this to include the facility to act as an authoritative DNS
111 server for one or more zones.
114 include DNSSEC validator.
117 include functionality to probe for and remove DNS forwarding loops.
120 use the Linux inotify facility to efficiently re-read configuration files.
130 these are avilable to explictly disable compile time options which would
131 otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
132 which are enabled by default in the distributed source tree. Building dnsmasq
133 with something like "make COPTS=-DNO_SCRIPT" will do the trick.
136 Don't include the ECDSA cypher in DNSSEC validation. Needed for older Nettle versions.
138 Don't use and link against libgmp, Useful if nettle is built with --enable-mini-gmp.
143 the default locations of these files are determined below, but may be overridden
144 in a build command line using COPTS.
148 /* Defining this builds a binary which handles time differently and works better on a system without a
149 stable RTC (it uses uptime, not epoch time) and writes the DHCP leases file less often to avoid flash wear.
152 /* #define HAVE_BROKEN_RTC */
154 /* The default set of options to build. Built with these options, dnsmasq
155 has no library dependencies other than libc */
165 /* Build options which require external libraries.
167 Defining HAVE_<opt>_STATIC as _well_ as HAVE_<opt> will link the library statically.
169 You can use "make COPTS=-DHAVE_<opt>" instead of editing these.
172 /* #define HAVE_LUASCRIPT */
173 /* #define HAVE_DBUS */
174 /* #define HAVE_IDN */
175 /* #define HAVE_CONNTRACK */
176 /* #define HAVE_DNSSEC */
179 /* Default locations for important system files. */
182 # if defined(__FreeBSD__) || defined (__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
183 # define LEASEFILE "/var/db/dnsmasq.leases"
184 # elif defined(__sun__) || defined (__sun)
185 # define LEASEFILE "/var/cache/dnsmasq.leases"
186 # elif defined(__ANDROID__)
187 # define LEASEFILE "/data/misc/dhcp/dnsmasq.leases"
189 # define LEASEFILE "/var/lib/misc/dnsmasq.leases"
194 # if defined(__FreeBSD__)
195 # define CONFFILE "/usr/local/etc/dnsmasq.conf"
197 # define CONFFILE "/etc/dnsmasq.conf"
202 # if defined(__uClinux__)
203 # define RESOLVFILE "/etc/config/resolv.conf"
205 # define RESOLVFILE "/etc/resolv.conf"
210 # if defined(__ANDROID__)
211 # define RUNFILE "/data/dnsmasq.pid"
213 # define RUNFILE "/var/run/dnsmasq.pid"
217 /* platform dependent options: these are determined automatically below
222 define exactly one of these to alter interaction with kernel networking.
225 defined when GNU-style getopt_long available.
228 defined if struct sockaddr has sa_len field (*BSD)
231 /* Must preceed __linux__ since uClinux defines __linux__ too. */
232 #if defined(__uClinux__)
233 #define HAVE_LINUX_NETWORK
234 #define HAVE_GETOPT_LONG
235 #undef HAVE_SOCKADDR_SA_LEN
236 /* Never use fork() on uClinux. Note that this is subtly different from the
237 --keep-in-foreground option, since it also suppresses forking new
238 processes for TCP connections and disables the call-a-script on leasechange
239 system. It's intended for use on MMU-less kernels. */
242 #elif defined(__UCLIBC__)
243 #define HAVE_LINUX_NETWORK
244 #if defined(__UCLIBC_HAS_GNU_GETOPT__) || \
245 ((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21))
246 # define HAVE_GETOPT_LONG
248 #undef HAVE_SOCKADDR_SA_LEN
249 #if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__)
252 #if defined(__UCLIBC_HAS_IPV6__)
254 # define IPV6_V6ONLY 26
258 /* This is for glibc 2.x */
259 #elif defined(__linux__)
260 #define HAVE_LINUX_NETWORK
261 #define HAVE_GETOPT_LONG
262 #undef HAVE_SOCKADDR_SA_LEN
264 #elif defined(__FreeBSD__) || \
265 defined(__OpenBSD__) || \
266 defined(__DragonFly__) || \
267 defined(__FreeBSD_kernel__)
268 #define HAVE_BSD_NETWORK
269 /* Later verions of FreeBSD have getopt_long() */
270 #if defined(optional_argument) && defined(required_argument)
271 # define HAVE_GETOPT_LONG
273 #define HAVE_SOCKADDR_SA_LEN
275 #elif defined(__APPLE__)
276 #define HAVE_BSD_NETWORK
277 #define HAVE_GETOPT_LONG
278 #define HAVE_SOCKADDR_SA_LEN
279 /* Define before sys/socket.h is included so we get socklen_t */
280 #define _BSD_SOCKLEN_T_
281 /* Select the RFC_3542 version of the IPv6 socket API.
282 Define before netinet6/in6.h is included. */
283 #define __APPLE_USE_RFC_3542
286 #elif defined(__NetBSD__)
287 #define HAVE_BSD_NETWORK
288 #define HAVE_GETOPT_LONG
289 #define HAVE_SOCKADDR_SA_LEN
291 #elif defined(__sun) || defined(__sun__)
292 #define HAVE_SOLARIS_NETWORK
293 #define HAVE_GETOPT_LONG
294 #undef HAVE_SOCKADDR_SA_LEN
295 #define ETHER_ADDR_LEN 6
299 /* Decide if we're going to support IPv6 */
300 /* We assume that systems which don't have IPv6
301 headers don't have ntop and pton either */
303 #if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY)
305 # define ADDRSTRLEN INET6_ADDRSTRLEN
307 # if !defined(INET_ADDRSTRLEN)
308 # define INET_ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */
311 # define ADDRSTRLEN INET_ADDRSTRLEN
315 /* rules to implement compile-time option dependencies and
331 #if defined(NO_DHCP6) || !defined(HAVE_IPV6)
335 /* DHCP6 needs DHCP too */
340 #if defined(NO_SCRIPT) || !defined(HAVE_DHCP) || defined(NO_FORK)
342 #undef HAVE_LUASCRIPT
345 /* Must HAVE_SCRIPT to HAVE_LUASCRIPT */
346 #ifdef HAVE_LUASCRIPT
354 #if defined(NO_IPSET)
362 #if defined (HAVE_LINUX_NETWORK) && !defined(NO_INOTIFY)
366 /* Define a string indicating which options are in use.
367 DNSMASQP_COMPILE_OPTS is only defined in dnsmasq.c */
369 #ifdef DNSMASQ_COMPILE_OPTS
371 static char *compile_opts
=
376 #ifndef HAVE_GETOPT_LONG
380 #ifdef HAVE_BROKEN_RTC
394 #if !defined(LOCALEDIR) && !defined(HAVE_IDN)
402 #if defined(HAVE_DHCP)
403 # if !defined (HAVE_DHCP6)
407 # if !defined(HAVE_SCRIPT)
410 # if !defined(HAVE_LUASCRIPT)
420 #ifndef HAVE_CONNTRACK