]>
git.ipfire.org Git - people/ms/dnsmasq.git/blob - src/config.h
1 /* dnsmasq is Copyright (c) 2000-2007 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.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
13 #define VERSION "2.40"
15 #define FTABSIZ 150 /* max number of outstanding requests (default) */
16 #define MAX_PROCS 20 /* max no children for TCP requests */
17 #define CHILD_LIFETIME 150 /* secs 'till terminated (RFC1035 suggests > 120s) */
18 #define EDNS_PKTSZ 1280 /* default max EDNS.0 UDP packet from RFC2671 */
19 #define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */
20 #define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */
21 #define CACHESIZ 150 /* default cache size */
22 #define MAXLEASES 150 /* maximum number of DHCP leases */
23 #define PING_WAIT 3 /* wait for ping address-in-use test */
24 #define PING_CACHE_TIME 30 /* Ping test assumed to be valid this long. */
25 #define DECLINE_BACKOFF 600 /* disable DECLINEd static addresses for this long */
26 #define DHCP_PACKET_MAX 16384 /* hard limit on DHCP packet size */
27 #define SMALLDNAME 40 /* most domain names are smaller than this */
28 #define HOSTSFILE "/etc/hosts"
29 #define ETHERSFILE "/etc/ethers"
31 # define RESOLVFILE "/etc/config/resolv.conf"
33 # define RESOLVFILE "/etc/resolv.conf"
35 #define RUNFILE "/var/run/dnsmasq.pid"
36 #if defined(__FreeBSD__) || defined (__OpenBSD__) || defined(__DragonFly__)
37 # define LEASEFILE "/var/db/dnsmasq.leases"
39 # define LEASEFILE "/var/lib/misc/dnsmasq.leases"
41 #if defined(__FreeBSD__)
42 # define CONFFILE "/usr/local/etc/dnsmasq.conf"
44 # define CONFFILE "/etc/dnsmasq.conf"
46 #define DEFLEASE 3600 /* default lease time, 1 hour */
47 #define CHUSER "nobody"
49 #define DHCP_SERVER_PORT 67
50 #define DHCP_CLIENT_PORT 68
52 #define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
53 #define LOG_MAX 5 /* log-queue length */
55 /* DBUS interface specifics */
56 #define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq"
57 #define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq"
59 /* A small collection of RR-types which are missing on some platforms */
82 /* Get linux C library versions. */
83 #if defined(__linux__) && !defined(__UCLIBC__) && !defined(__uClinux__)
84 /*# include <libio.h> */
85 # include <features.h>
89 /* Follows system specific switches. If you run on a
90 new system, you may want to edit these.
91 May replace this with Autoconf one day.
94 define this to do networking the Linux way. When it's defined, the code will
95 use IP_PKTINFO, Linux capabilities and the RTnetlink system. If it's not defined,
96 a few facilities will be lost, namely support for multiple addresses on an interface,
97 DNS query retransmission, and (on some systems) wildcard interface binding.
100 define this on embedded systems which don't have an RTC
101 which keeps time over reboots. Causes dnsmasq to use uptime
102 for timing, and keep lease lengths rather than expiry times
103 in its leases file. This also make dnsmasq "flash disk friendly".
104 Normally, dnsmasq tries very hard to keep the on-disk leases file
105 up-to-date: rewriting it after every renewal. When HAVE_BROKEN_RTC
106 is in effect, the lease file is only written when a new lease is
107 created, or an old one destroyed. (Because those are the only times
108 it changes.) This vastly reduces the number of file writes, and makes
109 it viable to keep the lease file on a flash filesystem.
110 NOTE: when enabling or disabling this, be sure to delete any old
111 leases file, otherwise dnsmasq may get very confused.
114 define this to include the old ISC dhcpcd integration. Note that you cannot
115 set both HAVE_ISC_READER and HAVE_BROKEN_RTC.
118 define this to get dnsmasq's built-in TFTP server.
121 define this if you have GNU libc or GNU getopt.
124 define this if you have arc4random() to get better security from DNS spoofs
125 by using really random ids (OpenBSD)
128 define this if you have the 4.2BSD random() function (and its
129 associated srandom() function), which is at least as good as (if not
130 better than) the rand() function.
133 define this if you have the /dev/random device, which gives truly
134 random numbers but may run out of random numbers.
137 define this if you have the /dev/urandom device, which gives
138 semi-random numbers when it runs out of truly random numbers.
141 define this if struct sockaddr has sa_len field (*BSD)
144 Define this if you want to link against libdbus, and have dnsmasq
145 define some methods to allow (re)configuration of the upstream DNS
149 For Linux you should define
155 you should NOT define
159 For *BSD systems you should define
162 you should NOT define
165 HAVE_ARC4RANDOM - OpenBSD and FreeBSD and NetBSD version 2.0 or later
166 HAVE_DEV_URANDOM - OpenBSD and FreeBSD and NetBSD
167 HAVE_DEV_RANDOM - FreeBSD and NetBSD
168 (OpenBSD with hardware random number generator)
169 HAVE_GETOPT_LONG - NetBSD, later FreeBSD
170 (FreeBSD and OpenBSD only if you link GNU getopt)
174 /* platform independent options- uncomment to enable */
176 /* #define HAVE_BROKEN_RTC */
177 /* #define HAVE_ISC_READER */
178 /* #define HAVE_DBUS */
180 #if defined(HAVE_BROKEN_RTC) && defined(HAVE_ISC_READER)
181 # error HAVE_ISC_READER is not compatible with HAVE_BROKEN_RTC
184 /* Allow TFTP to be disabled with COPT=-DNO_TFTP */
189 /* platform dependent options. */
191 /* Must preceed __linux__ since uClinux defines __linux__ too. */
192 #if defined(__uClinux__)
193 #define HAVE_LINUX_NETWORK
194 #define HAVE_GETOPT_LONG
195 #undef HAVE_ARC4RANDOM
197 #define HAVE_DEV_URANDOM
198 #define HAVE_DEV_RANDOM
199 #undef HAVE_SOCKADDR_SA_LEN
200 /* Never use fork() on uClinux. Note that this is subtly different from the
201 --keep-in-foreground option, since it also suppresses forking new
202 processes for TCP connections and disables the call-a-script on leasechange
203 system. It's intended for use on MMU-less kernels. */
206 #elif defined(__UCLIBC__)
207 #define HAVE_LINUX_NETWORK
208 #if defined(__UCLIBC_HAS_GNU_GETOPT__) || \
209 ((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21))
210 # define HAVE_GETOPT_LONG
212 # undef HAVE_GETOPT_LONG
214 #undef HAVE_ARC4RANDOM
216 #define HAVE_DEV_URANDOM
217 #define HAVE_DEV_RANDOM
218 #undef HAVE_SOCKADDR_SA_LEN
219 #if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__)
222 #if defined(__UCLIBC_HAS_IPV6__)
224 # define IPV6_V6ONLY 26
228 /* This is for glibc 2.x */
229 #elif defined(__linux__)
230 #define HAVE_LINUX_NETWORK
231 #define HAVE_GETOPT_LONG
232 #undef HAVE_ARC4RANDOM
234 #define HAVE_DEV_URANDOM
235 #define HAVE_DEV_RANDOM
236 #undef HAVE_SOCKADDR_SA_LEN
237 /* glibc < 2.2 has broken Sockaddr_in6 so we have to use our own. */
238 /* glibc < 2.2 doesn't define in_addr_t */
239 #if defined(__GLIBC__) && (__GLIBC__ == 2) && \
240 defined(__GLIBC_MINOR__) && (__GLIBC_MINOR__ < 2)
241 typedef unsigned long in_addr_t
;
242 # define HAVE_BROKEN_SOCKADDR_IN6
245 #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
246 #undef HAVE_LINUX_NETWORK
247 /* Later verions of FreeBSD have getopt_long() */
248 #if defined(optional_argument) && defined(required_argument)
249 # define HAVE_GETOPT_LONG
251 # undef HAVE_GETOPT_LONG
253 #define HAVE_ARC4RANDOM
255 #define HAVE_DEV_URANDOM
256 #define HAVE_SOCKADDR_SA_LEN
258 #elif defined(__APPLE__)
259 #undef HAVE_LINUX_NETWORK
260 #undef HAVE_GETOPT_LONG
261 #define HAVE_ARC4RANDOM
263 #define HAVE_DEV_URANDOM
264 #define HAVE_SOCKADDR_SA_LEN
265 /* Define before sys/socket.h is included so we get socklen_t */
266 #define _BSD_SOCKLEN_T_
267 /* This is not defined in Mac OS X arpa/nameserv.h */
270 #elif defined(__NetBSD__)
271 #undef HAVE_LINUX_NETWORK
272 #define HAVE_GETOPT_LONG
273 #undef HAVE_ARC4RANDOM
275 #define HAVE_DEV_URANDOM
276 #define HAVE_DEV_RANDOM
277 #define HAVE_SOCKADDR_SA_LEN
280 /* Decide if we're going to support IPv6 */
281 /* IPv6 can be forced off with "make COPTS=-DNO_IPV6" */
282 /* We assume that systems which don't have IPv6
283 headers don't have ntop and pton either */
285 #if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY) && !defined(NO_IPV6)
287 # define ADDRSTRLEN INET6_ADDRSTRLEN
288 # if defined(SOL_IPV6)
289 # define IPV6_LEVEL SOL_IPV6
291 # define IPV6_LEVEL IPPROTO_IPV6
293 #elif defined(INET_ADDRSTRLEN)
295 # define ADDRSTRLEN INET_ADDRSTRLEN
298 # define ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */