]> git.ipfire.org Git - people/ms/dnsmasq.git/blob - src/config.h
import of dnsmasq-2.40.tar.gz
[people/ms/dnsmasq.git] / src / config.h
1 /* dnsmasq is Copyright (c) 2000-2007 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.
6
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.
11 */
12
13 #define VERSION "2.40"
14
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"
30 #ifdef __uClinux__
31 # define RESOLVFILE "/etc/config/resolv.conf"
32 #else
33 # define RESOLVFILE "/etc/resolv.conf"
34 #endif
35 #define RUNFILE "/var/run/dnsmasq.pid"
36 #if defined(__FreeBSD__) || defined (__OpenBSD__) || defined(__DragonFly__)
37 # define LEASEFILE "/var/db/dnsmasq.leases"
38 #else
39 # define LEASEFILE "/var/lib/misc/dnsmasq.leases"
40 #endif
41 #if defined(__FreeBSD__)
42 # define CONFFILE "/usr/local/etc/dnsmasq.conf"
43 #else
44 # define CONFFILE "/etc/dnsmasq.conf"
45 #endif
46 #define DEFLEASE 3600 /* default lease time, 1 hour */
47 #define CHUSER "nobody"
48 #define CHGRP "dip"
49 #define DHCP_SERVER_PORT 67
50 #define DHCP_CLIENT_PORT 68
51 #define TFTP_PORT 69
52 #define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
53 #define LOG_MAX 5 /* log-queue length */
54
55 /* DBUS interface specifics */
56 #define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq"
57 #define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq"
58
59 /* A small collection of RR-types which are missing on some platforms */
60
61 #ifndef T_SIG
62 # define T_SIG 24
63 #endif
64
65 #ifndef T_SRV
66 # define T_SRV 33
67 #endif
68
69 #ifndef T_OPT
70 # define T_OPT 41
71 #endif
72
73 #ifndef T_TKEY
74 # define T_TKEY 249
75 #endif
76
77 #ifndef T_TSIG
78 # define T_TSIG 250
79 #endif
80
81
82 /* Get linux C library versions. */
83 #if defined(__linux__) && !defined(__UCLIBC__) && !defined(__uClinux__)
84 /*# include <libio.h> */
85 # include <features.h>
86 #endif
87
88
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.
92
93 HAVE_LINUX_NETWORK
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.
98
99 HAVE_BROKEN_RTC
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.
112
113 HAVE_ISC_READER
114 define this to include the old ISC dhcpcd integration. Note that you cannot
115 set both HAVE_ISC_READER and HAVE_BROKEN_RTC.
116
117 HAVE_TFTP
118 define this to get dnsmasq's built-in TFTP server.
119
120 HAVE_GETOPT_LONG
121 define this if you have GNU libc or GNU getopt.
122
123 HAVE_ARC4RANDOM
124 define this if you have arc4random() to get better security from DNS spoofs
125 by using really random ids (OpenBSD)
126
127 HAVE_RANDOM
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.
131
132 HAVE_DEV_RANDOM
133 define this if you have the /dev/random device, which gives truly
134 random numbers but may run out of random numbers.
135
136 HAVE_DEV_URANDOM
137 define this if you have the /dev/urandom device, which gives
138 semi-random numbers when it runs out of truly random numbers.
139
140 HAVE_SOCKADDR_SA_LEN
141 define this if struct sockaddr has sa_len field (*BSD)
142
143 HAVE_DBUS
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
146 servers via DBus.
147
148 NOTES:
149 For Linux you should define
150 HAVE_LINUX_NETWORK
151 HAVE_GETOPT_LONG
152 HAVE_RANDOM
153 HAVE_DEV_RANDOM
154 HAVE_DEV_URANDOM
155 you should NOT define
156 HAVE_ARC4RANDOM
157 HAVE_SOCKADDR_SA_LEN
158
159 For *BSD systems you should define
160 HAVE_SOCKADDR_SA_LEN
161 HAVE_RANDOM
162 you should NOT define
163 HAVE_LINUX_NETWORK
164 and you MAY 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)
171
172 */
173
174 /* platform independent options- uncomment to enable */
175 #define HAVE_TFTP
176 /* #define HAVE_BROKEN_RTC */
177 /* #define HAVE_ISC_READER */
178 /* #define HAVE_DBUS */
179
180 #if defined(HAVE_BROKEN_RTC) && defined(HAVE_ISC_READER)
181 # error HAVE_ISC_READER is not compatible with HAVE_BROKEN_RTC
182 #endif
183
184 /* Allow TFTP to be disabled with COPT=-DNO_TFTP */
185 #ifdef NO_TFTP
186 #undef HAVE_TFTP
187 #endif
188
189 /* platform dependent options. */
190
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
196 #define HAVE_RANDOM
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. */
204 #define NO_FORK
205
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
211 #else
212 # undef HAVE_GETOPT_LONG
213 #endif
214 #undef HAVE_ARC4RANDOM
215 #define HAVE_RANDOM
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__)
220 # define NO_FORK
221 #endif
222 #if defined(__UCLIBC_HAS_IPV6__)
223 # ifndef IPV6_V6ONLY
224 # define IPV6_V6ONLY 26
225 # endif
226 #endif
227
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
233 #define HAVE_RANDOM
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
243 #endif
244
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
250 #else
251 # undef HAVE_GETOPT_LONG
252 #endif
253 #define HAVE_ARC4RANDOM
254 #define HAVE_RANDOM
255 #define HAVE_DEV_URANDOM
256 #define HAVE_SOCKADDR_SA_LEN
257
258 #elif defined(__APPLE__)
259 #undef HAVE_LINUX_NETWORK
260 #undef HAVE_GETOPT_LONG
261 #define HAVE_ARC4RANDOM
262 #define HAVE_RANDOM
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 */
268 #define IN6ADDRSZ 16
269
270 #elif defined(__NetBSD__)
271 #undef HAVE_LINUX_NETWORK
272 #define HAVE_GETOPT_LONG
273 #undef HAVE_ARC4RANDOM
274 #define HAVE_RANDOM
275 #define HAVE_DEV_URANDOM
276 #define HAVE_DEV_RANDOM
277 #define HAVE_SOCKADDR_SA_LEN
278
279 #endif
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 */
284
285 #if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY) && !defined(NO_IPV6)
286 # define HAVE_IPV6
287 # define ADDRSTRLEN INET6_ADDRSTRLEN
288 # if defined(SOL_IPV6)
289 # define IPV6_LEVEL SOL_IPV6
290 # else
291 # define IPV6_LEVEL IPPROTO_IPV6
292 # endif
293 #elif defined(INET_ADDRSTRLEN)
294 # undef HAVE_IPV6
295 # define ADDRSTRLEN INET_ADDRSTRLEN
296 #else
297 # undef HAVE_IPV6
298 # define ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */
299 #endif
300