]>
git.ipfire.org Git - people/ms/dnsmasq.git/blob - src/config.h
1 /* dnsmasq is Copyright (c) 2000-2014 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 KEYBLOCK_LEN 40 /* choose to mininise fragmentation when storing DNSSEC keys */
23 #define DNSSEC_WORK 50 /* Max number of queries to validate one question */
24 #define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */
25 #define FORWARD_TEST 50 /* try all servers every 50 queries */
26 #define FORWARD_TIME 20 /* or 20 seconds */
27 #define RANDOM_SOCKS 64 /* max simultaneous random ports */
28 #define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */
29 #define CACHESIZ 150 /* default cache size */
30 #define TTL_FLOOR_LIMIT 3600 /* don't allow --min-cache-ttl to raise TTL above this under any circumstances */
31 #define MAXLEASES 1000 /* maximum number of DHCP leases */
32 #define PING_WAIT 3 /* wait for ping address-in-use test */
33 #define PING_CACHE_TIME 30 /* Ping test assumed to be valid this long. */
34 #define DECLINE_BACKOFF 600 /* disable DECLINEd static addresses for this long */
35 #define DHCP_PACKET_MAX 16384 /* hard limit on DHCP packet size */
36 #define SMALLDNAME 50 /* most domain names are smaller than this */
37 #define CNAME_CHAIN 10 /* chains longer than this atr dropped for loop protection */
38 #define HOSTSFILE "/etc/hosts"
39 #define ETHERSFILE "/etc/ethers"
40 #define DEFLEASE 3600 /* default lease time, 1 hour */
41 #define CHUSER "nobody"
43 #define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
44 #define LOG_MAX 5 /* log-queue length */
45 #define RANDFILE "/dev/urandom"
46 #define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq" /* Default - may be overridden by config */
47 #define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq"
48 #define AUTH_TTL 600 /* default TTL for auth DNS */
49 #define SOA_REFRESH 1200 /* SOA refresh default */
50 #define SOA_RETRY 180 /* SOA retry default */
51 #define SOA_EXPIRY 1209600 /* SOA expiry default */
52 #define LOOP_TEST_DOMAIN "test" /* domain for loop testing, "test" is reserved by RFC 2606 and won't therefore clash */
53 #define LOOP_TEST_TYPE T_TXT
55 /* compile-time options: uncomment below to enable or do eg.
56 make COPTS=-DHAVE_BROKEN_RTC
59 define this on embedded systems which don't have an RTC
60 which keeps time over reboots. Causes dnsmasq to use uptime
61 for timing, and keep lease lengths rather than expiry times
62 in its leases file. This also make dnsmasq "flash disk friendly".
63 Normally, dnsmasq tries very hard to keep the on-disk leases file
64 up-to-date: rewriting it after every renewal. When HAVE_BROKEN_RTC
65 is in effect, the lease file is only written when a new lease is
66 created, or an old one destroyed. (Because those are the only times
67 it changes.) This vastly reduces the number of file writes, and makes
68 it viable to keep the lease file on a flash filesystem.
69 NOTE: when enabling or disabling this, be sure to delete any old
70 leases file, otherwise dnsmasq may get very confused.
73 define this to get dnsmasq's built-in TFTP server.
76 define this to get dnsmasq's DHCPv4 server.
79 define this to get dnsmasq's DHCPv6 server. (implies HAVE_DHCP).
82 define this to get the ability to call scripts on lease-change.
85 define this to get the ability to call Lua script on lease-change. (implies HAVE_SCRIPT)
88 define this if you want to link against libdbus, and have dnsmasq
89 support some methods to allow (re)configuration of the upstream DNS
93 define this if you want international domain name support.
94 NOTE: for backwards compatibility, IDN support is automatically
95 included when internationalisation support is built, using the
96 *-i18n makefile targets, even if HAVE_IDN is not explicitly set.
99 define this to include code which propogates conntrack marks from
100 incoming DNS queries to the corresponding upstream queries. This adds
101 a build-dependency on libnetfilter_conntrack, but the resulting binary will
102 still run happily on a kernel without conntrack support.
105 define this to include the ability to selectively add resolved ip addresses
109 define this to include the facility to act as an authoritative DNS
110 server for one or more zones.
113 include DNSSEC validator.
116 include functionality to probe for and remove DNS forwarding loops.
126 these are avilable to explictly disable compile time options which would
127 otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
128 which are enabled by default in the distributed source tree. Building dnsmasq
129 with something like "make COPTS=-DNO_SCRIPT" will do the trick.
132 Don't include the ECDSA cypher in DNSSEC validation. Needed for older Nettle versions.
134 Don't use and link against libgmp, Useful if nettle is built with --enable-mini-gmp.
139 the default locations of these files are determined below, but may be overridden
140 in a build command line using COPTS.
144 /* Defining this builds a binary which handles time differently and works better on a system without a
145 stable RTC (it uses uptime, not epoch time) and writes the DHCP leases file less often to avoid flash wear.
148 /* #define HAVE_BROKEN_RTC */
150 /* The default set of options to build. Built with these options, dnsmasq
151 has no library dependencies other than libc */
161 /* Build options which require external libraries.
163 Defining HAVE_<opt>_STATIC as _well_ as HAVE_<opt> will link the library statically.
165 You can use "make COPTS=-DHAVE_<opt>" instead of editing these.
168 /* #define HAVE_LUASCRIPT */
169 /* #define HAVE_DBUS */
170 /* #define HAVE_IDN */
171 /* #define HAVE_CONNTRACK */
172 /* #define HAVE_DNSSEC */
175 /* Default locations for important system files. */
178 # if defined(__FreeBSD__) || defined (__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
179 # define LEASEFILE "/var/db/dnsmasq.leases"
180 # elif defined(__sun__) || defined (__sun)
181 # define LEASEFILE "/var/cache/dnsmasq.leases"
182 # elif defined(__ANDROID__)
183 # define LEASEFILE "/data/misc/dhcp/dnsmasq.leases"
185 # define LEASEFILE "/var/lib/misc/dnsmasq.leases"
190 # if defined(__FreeBSD__)
191 # define CONFFILE "/usr/local/etc/dnsmasq.conf"
193 # define CONFFILE "/etc/dnsmasq.conf"
198 # if defined(__uClinux__)
199 # define RESOLVFILE "/etc/config/resolv.conf"
201 # define RESOLVFILE "/etc/resolv.conf"
206 # if defined(__ANDROID__)
207 # define RUNFILE "/data/dnsmasq.pid"
209 # define RUNFILE "/var/run/dnsmasq.pid"
213 /* platform dependent options: these are determined automatically below
218 define exactly one of these to alter interaction with kernel networking.
221 defined when GNU-style getopt_long available.
224 defined if struct sockaddr has sa_len field (*BSD)
227 /* Must preceed __linux__ since uClinux defines __linux__ too. */
228 #if defined(__uClinux__)
229 #define HAVE_LINUX_NETWORK
230 #define HAVE_GETOPT_LONG
231 #undef HAVE_SOCKADDR_SA_LEN
232 /* Never use fork() on uClinux. Note that this is subtly different from the
233 --keep-in-foreground option, since it also suppresses forking new
234 processes for TCP connections and disables the call-a-script on leasechange
235 system. It's intended for use on MMU-less kernels. */
238 #elif defined(__UCLIBC__)
239 #define HAVE_LINUX_NETWORK
240 #if defined(__UCLIBC_HAS_GNU_GETOPT__) || \
241 ((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21))
242 # define HAVE_GETOPT_LONG
244 #undef HAVE_SOCKADDR_SA_LEN
245 #if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__)
248 #if defined(__UCLIBC_HAS_IPV6__)
250 # define IPV6_V6ONLY 26
254 /* This is for glibc 2.x */
255 #elif defined(__linux__)
256 #define HAVE_LINUX_NETWORK
257 #define HAVE_GETOPT_LONG
258 #undef HAVE_SOCKADDR_SA_LEN
260 #elif defined(__FreeBSD__) || \
261 defined(__OpenBSD__) || \
262 defined(__DragonFly__) || \
263 defined(__FreeBSD_kernel__)
264 #define HAVE_BSD_NETWORK
265 /* Later verions of FreeBSD have getopt_long() */
266 #if defined(optional_argument) && defined(required_argument)
267 # define HAVE_GETOPT_LONG
269 #define HAVE_SOCKADDR_SA_LEN
271 #elif defined(__APPLE__)
272 #define HAVE_BSD_NETWORK
273 #define HAVE_GETOPT_LONG
274 #define HAVE_SOCKADDR_SA_LEN
275 /* Define before sys/socket.h is included so we get socklen_t */
276 #define _BSD_SOCKLEN_T_
277 /* Select the RFC_3542 version of the IPv6 socket API.
278 Define before netinet6/in6.h is included. */
279 #define __APPLE_USE_RFC_3542
282 #elif defined(__NetBSD__)
283 #define HAVE_BSD_NETWORK
284 #define HAVE_GETOPT_LONG
285 #define HAVE_SOCKADDR_SA_LEN
287 #elif defined(__sun) || defined(__sun__)
288 #define HAVE_SOLARIS_NETWORK
289 #define HAVE_GETOPT_LONG
290 #undef HAVE_SOCKADDR_SA_LEN
291 #define ETHER_ADDR_LEN 6
295 /* Decide if we're going to support IPv6 */
296 /* We assume that systems which don't have IPv6
297 headers don't have ntop and pton either */
299 #if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY)
301 # define ADDRSTRLEN INET6_ADDRSTRLEN
303 # if !defined(INET_ADDRSTRLEN)
304 # define INET_ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */
307 # define ADDRSTRLEN INET_ADDRSTRLEN
311 /* rules to implement compile-time option dependencies and
327 #if defined(NO_DHCP6) || !defined(HAVE_IPV6)
331 /* DHCP6 needs DHCP too */
336 #if defined(NO_SCRIPT) || !defined(HAVE_DHCP) || defined(NO_FORK)
338 #undef HAVE_LUASCRIPT
341 /* Must HAVE_SCRIPT to HAVE_LUASCRIPT */
342 #ifdef HAVE_LUASCRIPT
350 #if defined(NO_IPSET)
358 /* Define a string indicating which options are in use.
359 DNSMASQP_COMPILE_OPTS is only defined in dnsmasq.c */
361 #ifdef DNSMASQ_COMPILE_OPTS
363 static char *compile_opts
=
368 #ifndef HAVE_GETOPT_LONG
372 #ifdef HAVE_BROKEN_RTC
386 #if !defined(LOCALEDIR) && !defined(HAVE_IDN)
394 #if defined(HAVE_DHCP)
395 # if !defined (HAVE_DHCP6)
399 # if !defined(HAVE_SCRIPT)
402 # if !defined(HAVE_LUASCRIPT)
412 #ifndef HAVE_CONNTRACK