]>
git.ipfire.org Git - people/ms/dnsmasq.git/blob - src/config.h
1 /* dnsmasq is Copyright (c) 2000 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 /* Author's email: simon@thekelleys.org.uk */
17 #define FTABSIZ 150 /* max number of outstanding requests */
18 #define TIMEOUT 40 /* drop queries after TIMEOUT seconds */
19 #define LOGRATE 120 /* log table overflows every LOGRATE seconds */
20 #define CACHESIZ 150 /* default cache size */
21 #define SMALLDNAME 40 /* most domain names are smaller than this */
22 #define CONFFILE "/etc/dnsmasq.conf"
23 #define HOSTSFILE "/etc/hosts"
25 # define RESOLVFILE "/etc/config/resolv.conf"
27 # define RESOLVFILE "/etc/resolv.conf"
29 #define RUNFILE "/var/run/dnsmasq.pid"
31 # define LEASEFILE "/var/db/dnsmasq.leases"
33 # define LEASEFILE "/var/lib/misc/dnsmasq.leases"
35 #define DEFLEASE 3600 /* default lease time, 1 hour */
36 #define CHUSER "nobody"
38 #define IP6INTERFACES "/proc/net/if_inet6"
39 #define DHCP_SERVER_PORT 67
40 #define DHCP_CLIENT_PORT 68
42 /* Logfile stuff - change this to change the options and facility */
43 /* debug is true if the --no-daemon flag is given */
45 # define DNSMASQ_LOG_OPT(debug) (debug) ? LOG_PERROR : LOG_PID
47 # define DNSMASQ_LOG_OPT(debug) (debug) ? 0 : LOG_PID
51 # define DNSMASQ_LOG_FAC(debug) (debug) ? LOG_LOCAL0 : LOG_DAEMON
53 # define DNSMASQ_LOG_FAC(debug) LOG_DAEMON
57 /* Decide if we're going to support IPv6 */
58 /* We assume that systems which don't have IPv6
59 headers don't have ntop and pton either */
61 #if defined(INET6_ADDRSTRLEN)
63 # define ADDRSTRLEN INET6_ADDRSTRLEN
64 #elif defined(INET_ADDRSTRLEN)
66 # define ADDRSTRLEN INET_ADDRSTRLEN
69 # define ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */
72 /* Get linux C library versions. */
73 #if defined(__linux__) && !defined(__UCLIBC__) && !defined(__uClinux__)
78 /* Follows system specific switches. If you run on a
79 new system, you may want to edit these.
80 May replace this with Autoconf one day.
84 define this to do IPv6 interface discovery using
85 proc/net/if_inet6 ala LINUX.
88 define this if you have GNU libc or GNU getopt.
91 define this if you have arc4random() to get better security from DNS spoofs
92 by using really random ids (OpenBSD)
95 define this if you have the 4.2BSD random() function (and its
96 associated srandom() function), which is at least as good as (if not
97 better than) the rand() function.
100 define this if you have the /dev/random device, which gives truly
101 random numbers but may run out of random numbers.
104 define this if you have the /dev/urandom device, which gives
105 semi-random numbers when it runs out of truly random numbers.
108 define this if struct sockaddr has sa_len field (*BSD)
111 If your C library implements pselect, define this.
114 If your OS implements packet sockets, define this.
117 If your OS implements Berkeley PAcket filter, define this.
120 For Linux you should define
127 you should NOT define
131 For *BSD systems you should define
135 you should NOT define
138 HAVE_ARC4RANDOM - OpenBSD and FreeBSD
139 HAVE_DEV_URANDOM - OpenBSD and FreeBSD
140 HAVE_DEV_RANDOM - FreeBSD (OpenBSD with hardware random number generator)
141 HAVE_GETOPT_LONG - only if you link GNU getopt.
145 /* Must preceed __linux__ since uClinux defines __linux__ too. */
146 #if defined(__uClinux__) || defined(__UCLIBC__)
147 #undef HAVE_LINUX_IPV6_PROC
148 #define HAVE_GETOPT_LONG
149 #undef HAVE_ARC4RANDOM
151 #define HAVE_DEV_URANDOM
152 #define HAVE_DEV_RANDOM
153 #define HAVE_PF_PACKET
154 #undef HAVE_SOCKADDR_SA_LEN
156 /* Don't fork into background on uClinux */
157 #if defined(__uClinux__)
161 /* libc5 - must precede __linux__ too */
162 /* Note to build a libc5 binary on a modern Debian system:
163 install the packages altgcc libc5 and libc5-altdev
164 then run "make CC=i486-linuxlibc1-gcc" */
165 /* Note that compling dnsmasq 2.x under libc5 and kernel 2.0.x
166 is probably doomed - no packet socket for starters. */
167 #elif defined(__linux__) && \
168 defined(_LINUX_C_LIB_VERSION_MAJOR) && \
169 (_LINUX_C_LIB_VERSION_MAJOR == 5 )
171 #undef HAVE_LINUX_IPV6_PROC
172 #define HAVE_GETOPT_LONG
173 #undef HAVE_ARC4RANDOM
175 #define HAVE_DEV_URANDOM
176 #define HAVE_DEV_RANDOM
177 #undef HAVE_PF_PACKET
178 #undef HAVE_SOCKADDR_SA_LEN
180 /* Fix various misfeatures of libc5 headers */
182 typedef unsigned long in_addr_t
;
183 typedef size_t socklen_t
;
185 /* This is for glibc 2.x */
186 #elif defined(__linux__)
187 #define HAVE_LINUX_IPV6_PROC
188 #define HAVE_GETOPT_LONG
189 #undef HAVE_ARC4RANDOM
191 #define HAVE_DEV_URANDOM
192 #define HAVE_DEV_RANDOM
193 #undef HAVE_SOCKADDR_SA_LEN
195 #define HAVE_PF_PACKET
196 /* glibc < 2.2 has broken Sockaddr_in6 so we have to use our own. */
197 /* glibc < 2.2 doesn't define in_addr_t */
198 #if defined(__GLIBC__) && (__GLIBC__ == 2) && \
199 defined(__GLIBC_MINOR__) && (__GLIBC_MINOR__ < 2)
200 typedef unsigned long in_addr_t
;
201 #if defined(HAVE_IPV6)
202 # define HAVE_BROKEN_SOCKADDR_IN6
206 #elif defined(__FreeBSD__) || defined(__OpenBSD__)
207 #undef HAVE_LINUX_IPV6_PROC
208 #undef HAVE_GETOPT_LONG
209 #define HAVE_ARC4RANDOM
211 #define HAVE_DEV_URANDOM
212 #define HAVE_SOCKADDR_SA_LEN
216 #elif defined(__APPLE__)
217 #undef HAVE_LINUX_IPV6_PROC
218 #undef HAVE_GETOPT_LONG
219 #define HAVE_ARC4RANDOM
221 #define HAVE_DEV_URANDOM
222 #define HAVE_SOCKADDR_SA_LEN
225 /* Define before sys/socket.h is included so we get socklen_t */
226 #define _BSD_SOCKLEN_T_
227 /* The two below are not defined in Mac OS X arpa/nameserv.h */
231 #elif defined(__NetBSD__)
232 #undef HAVE_LINUX_IPV6_PROC
233 #undef HAVE_GETOPT_LONG
234 #undef HAVE_ARC4RANDOM
236 #undef HAVE_DEV_URANDOM
237 #undef HAVE_DEV_RANDOM
238 #define HAVE_SOCKADDR_SA_LEN
242 /* env "LIBS=-lsocket -lnsl" make */
243 #elif defined(__sun) || defined(__sun__)
244 #undef HAVE_LINUX_IPV6_PROC
245 #undef HAVE_GETOPT_LONG
246 #undef HAVE_ARC4RANDOM
248 #undef HAVE_DEV_URANDOM
249 #undef HAVE_DEV_RANDOM
250 #undef HAVE_SOCKADDR_SA_LEN