]> git.ipfire.org Git - people/ms/dnsmasq.git/blame - src/config.h
import of dnsmasq-2.33.tar.gz
[people/ms/dnsmasq.git] / src / config.h
CommitLineData
e17fb629 1/* dnsmasq is Copyright (c) 2000-2006 Simon Kelley
9e4abcb5
SK
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
208b65c5 13#define VERSION "2.33"
9e4abcb5 14
208b65c5 15#define FTABSIZ 150 /* max number of outstanding requests (default) */
feba5c1d
SK
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 20 /* drop UDP queries after TIMEOUT seconds */
cdeda28f 20#define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */
9e4abcb5
SK
21#define LOGRATE 120 /* log table overflows every LOGRATE seconds */
22#define CACHESIZ 150 /* default cache size */
44a2a316 23#define MAXLEASES 150 /* maximum number of DHCP leases */
5e9e0efb
SK
24#define PING_WAIT 3 /* wait for ping address-in-use test */
25#define PING_CACHE_TIME 30 /* Ping test assumed to be valid this long. */
849a8357 26#define DECLINE_BACKOFF 600 /* disable DECLINEd static addresses for this long */
5e9e0efb 27#define DHCP_PACKET_MAX 16384 /* hard limit on DHCP packet size */
9e4abcb5 28#define SMALLDNAME 40 /* most domain names are smaller than this */
9e4abcb5 29#define HOSTSFILE "/etc/hosts"
44a2a316 30#define ETHERSFILE "/etc/ethers"
9e4abcb5
SK
31#ifdef __uClinux__
32# define RESOLVFILE "/etc/config/resolv.conf"
33#else
34# define RESOLVFILE "/etc/resolv.conf"
35#endif
36#define RUNFILE "/var/run/dnsmasq.pid"
44a2a316 37#if defined(__FreeBSD__) || defined (__OpenBSD__)
9e4abcb5
SK
38# define LEASEFILE "/var/db/dnsmasq.leases"
39#else
40# define LEASEFILE "/var/lib/misc/dnsmasq.leases"
feba5c1d
SK
41#endif
42#if defined(__FreeBSD__)
43# define CONFFILE "/usr/local/etc/dnsmasq.conf"
44#else
b49644f3 45# define CONFFILE "/etc/dnsmasq.conf"
9e4abcb5
SK
46#endif
47#define DEFLEASE 3600 /* default lease time, 1 hour */
48#define CHUSER "nobody"
49#define CHGRP "dip"
9e4abcb5
SK
50#define DHCP_SERVER_PORT 67
51#define DHCP_CLIENT_PORT 68
52
3d8df260
SK
53/* DBUS interface specifics */
54#define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq"
55#define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq"
56
3be34541
SK
57/* A small collection of RR-types which are missing on some platforms */
58
59#ifndef T_SRV
60# define T_SRV 33
61#endif
62
63#ifndef T_OPT
64# define T_OPT 41
65#endif
9e4abcb5 66
9e4abcb5
SK
67/* Get linux C library versions. */
68#if defined(__linux__) && !defined(__UCLIBC__) && !defined(__uClinux__)
7cebd20f
SK
69/*# include <libio.h> */
70# include <features.h>
9e4abcb5
SK
71#endif
72
73
74/* Follows system specific switches. If you run on a
75 new system, you may want to edit these.
76 May replace this with Autoconf one day.
77
5e9e0efb
SK
78HAVE_LINUX_NETWORK
79 define this to do networking the Linux way. When it's defined, the code will
80 use IP_PKTINFO, Linux capabilities and the RTnetlink system. If it's not defined,
81 a few facilities will be lost, namely support for multiple addresses on an interface,
82 DNS query retransmission, and (on some systems) wildcard interface binding.
9e4abcb5 83
44a2a316 84HAVE_BROKEN_RTC
5e9e0efb
SK
85 define this on embedded systems which don't have an RTC
86 which keeps time over reboots. Causes dnsmasq to use uptime
87 for timing, and keep lease lengths rather than expiry times
88 in its leases file. This also make dnsmasq "flash disk friendly".
89 Normally, dnsmasq tries very hard to keep the on-disk leases file
90 up-to-date: rewriting it after every renewal. When HAVE_BROKEN_RTC
91 is in effect, the lease file is only written when a new lease is
92 created, or an old one destroyed. (Because those are the only times
93 it changes.) This vastly reduces the number of file writes, and makes
94 it viable to keep the lease file on a flash filesystem.
44a2a316
SK
95 NOTE: when enabling or disabling this, be sure to delete any old
96 leases file, otherwise dnsmasq may get very confused.
44a2a316 97
33820b7e
SK
98HAVE_ISC_READER
99 define this to include the old ISC dhcpcd integration. Note that you cannot
100 set both HAVE_ISC_READER and HAVE_BROKEN_RTC.
101
9e4abcb5
SK
102HAVE_GETOPT_LONG
103 define this if you have GNU libc or GNU getopt.
104
105HAVE_ARC4RANDOM
106 define this if you have arc4random() to get better security from DNS spoofs
107 by using really random ids (OpenBSD)
108
109HAVE_RANDOM
110 define this if you have the 4.2BSD random() function (and its
111 associated srandom() function), which is at least as good as (if not
112 better than) the rand() function.
113
114HAVE_DEV_RANDOM
115 define this if you have the /dev/random device, which gives truly
116 random numbers but may run out of random numbers.
117
118HAVE_DEV_URANDOM
119 define this if you have the /dev/urandom device, which gives
120 semi-random numbers when it runs out of truly random numbers.
121
122HAVE_SOCKADDR_SA_LEN
123 define this if struct sockaddr has sa_len field (*BSD)
124
3d8df260
SK
125HAVE_DBUS
126 Define this if you want to link against libdbus, and have dnsmasq
127 define some methods to allow (re)configuration of the upstream DNS
128 servers via DBus.
129
9e4abcb5
SK
130NOTES:
131 For Linux you should define
5e9e0efb 132 HAVE_LINUX_NETWORK
9e4abcb5
SK
133 HAVE_GETOPT_LONG
134 HAVE_RANDOM
135 HAVE_DEV_RANDOM
136 HAVE_DEV_URANDOM
44a2a316 137 you should NOT define
9e4abcb5
SK
138 HAVE_ARC4RANDOM
139 HAVE_SOCKADDR_SA_LEN
140
141 For *BSD systems you should define
142 HAVE_SOCKADDR_SA_LEN
143 HAVE_RANDOM
9e4abcb5 144 you should NOT define
5e9e0efb 145 HAVE_LINUX_NETWORK
9e4abcb5 146 and you MAY define
fd9fa481
SK
147 HAVE_ARC4RANDOM - OpenBSD and FreeBSD and NetBSD version 2.0 or later
148 HAVE_DEV_URANDOM - OpenBSD and FreeBSD and NetBSD
149 HAVE_DEV_RANDOM - FreeBSD and NetBSD
150 (OpenBSD with hardware random number generator)
59353a6b 151 HAVE_GETOPT_LONG - NetBSD, later FreeBSD
fd9fa481 152 (FreeBSD and OpenBSD only if you link GNU getopt)
9e4abcb5
SK
153
154*/
155
309331f5
SK
156/* platform independent options- uncomment to enable */
157/* #define HAVE_BROKEN_RTC */
158/* #define HAVE_ISC_READER */
159/* #define HAVE_DBUS */
33820b7e
SK
160
161#if defined(HAVE_BROKEN_RTC) && defined(HAVE_ISC_READER)
162# error HAVE_ISC_READER is not compatible with HAVE_BROKEN_RTC
163#endif
164
165/* platform dependent options. */
166
9e4abcb5 167/* Must preceed __linux__ since uClinux defines __linux__ too. */
e17fb629 168#if defined(__uClinux__)
5e9e0efb 169#define HAVE_LINUX_NETWORK
9e4abcb5
SK
170#define HAVE_GETOPT_LONG
171#undef HAVE_ARC4RANDOM
172#define HAVE_RANDOM
173#define HAVE_DEV_URANDOM
174#define HAVE_DEV_RANDOM
9e4abcb5 175#undef HAVE_SOCKADDR_SA_LEN
59353a6b
SK
176/* Never use fork() on uClinux. Note that this is subtly different from the
177 --keep-in-foreground option, since it also suppresses forking new
178 processes for TCP connections. It's intended for use on MMU-less kernels. */
e17fb629
SK
179#define NO_FORK
180
181#elif defined(__UCLIBC__)
5e9e0efb 182#define HAVE_LINUX_NETWORK
e17fb629
SK
183#if defined(__UCLIBC_HAS_GNU_GETOPT__) || \
184 ((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21))
185# define HAVE_GETOPT_LONG
5e9e0efb 186#else
e17fb629 187# undef HAVE_GETOPT_LONG
5e9e0efb 188#endif
e17fb629
SK
189#undef HAVE_ARC4RANDOM
190#define HAVE_RANDOM
191#define HAVE_DEV_URANDOM
192#define HAVE_DEV_RANDOM
193#undef HAVE_SOCKADDR_SA_LEN
7cebd20f 194#if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__)
9e4abcb5
SK
195# define NO_FORK
196#endif
7cebd20f
SK
197#if defined(__UCLIBC_HAS_IPV6__)
198# ifndef IPV6_V6ONLY
199# define IPV6_V6ONLY 26
200# endif
e17fb629 201#endif
9e4abcb5 202
9e4abcb5
SK
203/* This is for glibc 2.x */
204#elif defined(__linux__)
5e9e0efb 205#define HAVE_LINUX_NETWORK
9e4abcb5
SK
206#define HAVE_GETOPT_LONG
207#undef HAVE_ARC4RANDOM
208#define HAVE_RANDOM
209#define HAVE_DEV_URANDOM
210#define HAVE_DEV_RANDOM
211#undef HAVE_SOCKADDR_SA_LEN
9e4abcb5
SK
212/* glibc < 2.2 has broken Sockaddr_in6 so we have to use our own. */
213/* glibc < 2.2 doesn't define in_addr_t */
214#if defined(__GLIBC__) && (__GLIBC__ == 2) && \
215 defined(__GLIBC_MINOR__) && (__GLIBC_MINOR__ < 2)
216typedef unsigned long in_addr_t;
9e4abcb5
SK
217# define HAVE_BROKEN_SOCKADDR_IN6
218#endif
9e4abcb5
SK
219
220#elif defined(__FreeBSD__) || defined(__OpenBSD__)
5e9e0efb 221#undef HAVE_LINUX_NETWORK
59353a6b
SK
222/* Later verions of FreeBSD have getopt_long() */
223#if defined(optional_argument) && defined(required_argument)
224# define HAVE_GETOPT_LONG
225#else
226# undef HAVE_GETOPT_LONG
227#endif
9e4abcb5
SK
228#define HAVE_ARC4RANDOM
229#define HAVE_RANDOM
230#define HAVE_DEV_URANDOM
231#define HAVE_SOCKADDR_SA_LEN
9e4abcb5
SK
232
233#elif defined(__APPLE__)
5e9e0efb 234#undef HAVE_LINUX_NETWORK
9e4abcb5
SK
235#undef HAVE_GETOPT_LONG
236#define HAVE_ARC4RANDOM
237#define HAVE_RANDOM
238#define HAVE_DEV_URANDOM
239#define HAVE_SOCKADDR_SA_LEN
9e4abcb5
SK
240/* Define before sys/socket.h is included so we get socklen_t */
241#define _BSD_SOCKLEN_T_
fd9fa481 242/* This is not defined in Mac OS X arpa/nameserv.h */
9e4abcb5 243#define IN6ADDRSZ 16
9e4abcb5
SK
244
245#elif defined(__NetBSD__)
5e9e0efb 246#undef HAVE_LINUX_NETWORK
fd9fa481 247#define HAVE_GETOPT_LONG
9e4abcb5
SK
248#undef HAVE_ARC4RANDOM
249#define HAVE_RANDOM
fd9fa481
SK
250#define HAVE_DEV_URANDOM
251#define HAVE_DEV_RANDOM
9e4abcb5 252#define HAVE_SOCKADDR_SA_LEN
9e4abcb5 253
9e4abcb5 254#endif
e17fb629
SK
255/* Decide if we're going to support IPv6 */
256/* We assume that systems which don't have IPv6
257 headers don't have ntop and pton either */
258
259#if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY) && !defined(NO_IPV6)
260# define HAVE_IPV6
261# define ADDRSTRLEN INET6_ADDRSTRLEN
262# if defined(SOL_IPV6)
263# define IPV6_LEVEL SOL_IPV6
264# else
265# define IPV6_LEVEL IPPROTO_IPV6
266# endif
267#elif defined(INET_ADDRSTRLEN)
268# undef HAVE_IPV6
269# define ADDRSTRLEN INET_ADDRSTRLEN
270#else
271# undef HAVE_IPV6
272# define ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */
273#endif
274