Simon Kelley | 6174435 | 2013-01-31 14:34:40 +0000 | [diff] [blame] | 1 | /* dnsmasq is Copyright (c) 2000-2013 Simon Kelley |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 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 |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 5 | the Free Software Foundation; version 2 dated June, 1991, or |
| 6 | (at your option) version 3 dated 29 June, 2007. |
| 7 | |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 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. |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 12 | |
Simon Kelley | 73a08a2 | 2009-02-05 20:28:08 +0000 | [diff] [blame] | 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/>. |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Simon Kelley | 208b65c | 2006-08-05 21:41:37 +0100 | [diff] [blame] | 17 | #define FTABSIZ 150 /* max number of outstanding requests (default) */ |
Simon Kelley | feba5c1 | 2004-07-27 20:28:58 +0100 | [diff] [blame] | 18 | #define MAX_PROCS 20 /* max no children for TCP requests */ |
| 19 | #define CHILD_LIFETIME 150 /* secs 'till terminated (RFC1035 suggests > 120s) */ |
Simon Kelley | 316e273 | 2010-01-22 20:16:09 +0000 | [diff] [blame] | 20 | #define EDNS_PKTSZ 4096 /* default max EDNS.0 UDP packet from RFC5625 */ |
Simon Kelley | 7b4ad2e | 2012-04-04 14:05:35 +0100 | [diff] [blame] | 21 | #define KEYBLOCK_LEN 140 /* choose to mininise fragmentation when storing DNSSEC keys */ |
Simon Kelley | 1697269 | 2006-10-16 20:04:18 +0100 | [diff] [blame] | 22 | #define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */ |
Simon Kelley | 1f15b81 | 2009-10-13 17:49:32 +0100 | [diff] [blame] | 23 | #define FORWARD_TEST 50 /* try all servers every 50 queries */ |
Simon Kelley | 28866e9 | 2011-02-14 20:19:14 +0000 | [diff] [blame] | 24 | #define FORWARD_TIME 20 /* or 20 seconds */ |
Simon Kelley | 1a6bca8 | 2008-07-11 11:11:42 +0100 | [diff] [blame] | 25 | #define RANDOM_SOCKS 64 /* max simultaneous random ports */ |
Simon Kelley | cdeda28 | 2006-03-16 20:16:06 +0000 | [diff] [blame] | 26 | #define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */ |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 27 | #define CACHESIZ 150 /* default cache size */ |
Simon Kelley | 316e273 | 2010-01-22 20:16:09 +0000 | [diff] [blame] | 28 | #define MAXLEASES 1000 /* maximum number of DHCP leases */ |
Simon Kelley | 5e9e0ef | 2006-04-17 14:24:29 +0100 | [diff] [blame] | 29 | #define PING_WAIT 3 /* wait for ping address-in-use test */ |
| 30 | #define PING_CACHE_TIME 30 /* Ping test assumed to be valid this long. */ |
Simon Kelley | 849a835 | 2006-06-09 21:02:31 +0100 | [diff] [blame] | 31 | #define DECLINE_BACKOFF 600 /* disable DECLINEd static addresses for this long */ |
Simon Kelley | 5e9e0ef | 2006-04-17 14:24:29 +0100 | [diff] [blame] | 32 | #define DHCP_PACKET_MAX 16384 /* hard limit on DHCP packet size */ |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 33 | #define SMALLDNAME 40 /* most domain names are smaller than this */ |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 34 | #define HOSTSFILE "/etc/hosts" |
Simon Kelley | 44a2a31 | 2004-03-10 20:04:35 +0000 | [diff] [blame] | 35 | #define ETHERSFILE "/etc/ethers" |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 36 | #define DEFLEASE 3600 /* default lease time, 1 hour */ |
| 37 | #define CHUSER "nobody" |
| 38 | #define CHGRP "dip" |
| 39 | #define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */ |
| 40 | #define LOG_MAX 5 /* log-queue length */ |
| 41 | #define RANDFILE "/dev/urandom" |
Simon Kelley | ad09427 | 2012-08-10 17:10:54 +0100 | [diff] [blame] | 42 | #define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq" /* Default - may be overridden by config */ |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 43 | #define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq" |
Simon Kelley | 4f7b304 | 2012-11-28 21:27:02 +0000 | [diff] [blame] | 44 | #define AUTH_TTL 600 /* default TTL for auth DNS */ |
| 45 | #define SOA_REFRESH 1200 /* SOA refresh default */ |
| 46 | #define SOA_RETRY 180 /* SOA retry default */ |
| 47 | #define SOA_EXPIRY 1209600 /* SOA expiry default */ |
| 48 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 49 | /* compile-time options: uncomment below to enable or do eg. |
| 50 | make COPTS=-DHAVE_BROKEN_RTC |
| 51 | |
| 52 | HAVE_BROKEN_RTC |
| 53 | define this on embedded systems which don't have an RTC |
| 54 | which keeps time over reboots. Causes dnsmasq to use uptime |
| 55 | for timing, and keep lease lengths rather than expiry times |
| 56 | in its leases file. This also make dnsmasq "flash disk friendly". |
| 57 | Normally, dnsmasq tries very hard to keep the on-disk leases file |
| 58 | up-to-date: rewriting it after every renewal. When HAVE_BROKEN_RTC |
| 59 | is in effect, the lease file is only written when a new lease is |
| 60 | created, or an old one destroyed. (Because those are the only times |
| 61 | it changes.) This vastly reduces the number of file writes, and makes |
| 62 | it viable to keep the lease file on a flash filesystem. |
| 63 | NOTE: when enabling or disabling this, be sure to delete any old |
| 64 | leases file, otherwise dnsmasq may get very confused. |
| 65 | |
| 66 | HAVE_TFTP |
| 67 | define this to get dnsmasq's built-in TFTP server. |
| 68 | |
| 69 | HAVE_DHCP |
| 70 | define this to get dnsmasq's DHCPv4 server. |
| 71 | |
| 72 | HAVE_DHCP6 |
| 73 | define this to get dnsmasq's DHCPv6 server. (implies HAVE_DHCP). |
| 74 | |
| 75 | HAVE_SCRIPT |
| 76 | define this to get the ability to call scripts on lease-change. |
| 77 | |
| 78 | HAVE_LUASCRIPT |
| 79 | define this to get the ability to call Lua script on lease-change. (implies HAVE_SCRIPT) |
| 80 | |
| 81 | HAVE_DBUS |
| 82 | define this if you want to link against libdbus, and have dnsmasq |
| 83 | support some methods to allow (re)configuration of the upstream DNS |
| 84 | servers via DBus. |
| 85 | |
| 86 | HAVE_IDN |
| 87 | define this if you want international domain name support. |
| 88 | NOTE: for backwards compatibility, IDN support is automatically |
| 89 | included when internationalisation support is built, using the |
| 90 | *-i18n makefile targets, even if HAVE_IDN is not explicitly set. |
| 91 | |
| 92 | HAVE_CONNTRACK |
| 93 | define this to include code which propogates conntrack marks from |
| 94 | incoming DNS queries to the corresponding upstream queries. This adds |
| 95 | a build-dependency on libnetfilter_conntrack, but the resulting binary will |
| 96 | still run happily on a kernel without conntrack support. |
| 97 | |
Jason A. Donenfeld | 13d86c7 | 2013-02-22 18:20:53 +0000 | [diff] [blame] | 98 | HAVE_IPSET |
| 99 | define this to include the ability to selectively add resolved ip addresses |
| 100 | to given ipsets. |
| 101 | |
Simon Kelley | 4820dce | 2012-12-18 18:30:30 +0000 | [diff] [blame] | 102 | HAVE_AUTH |
| 103 | define this to include the facility to act as an authoritative DNS |
| 104 | server for one or more zones. |
| 105 | |
| 106 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 107 | NO_IPV6 |
| 108 | NO_TFTP |
| 109 | NO_DHCP |
| 110 | NO_DHCP6 |
| 111 | NO_SCRIPT |
| 112 | NO_LARGEFILE |
Simon Kelley | 4820dce | 2012-12-18 18:30:30 +0000 | [diff] [blame] | 113 | NO_AUTH |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 114 | these are avilable to explictly disable compile time options which would |
| 115 | otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or |
| 116 | which are enabled by default in the distributed source tree. Building dnsmasq |
| 117 | with something like "make COPTS=-DNO_SCRIPT" will do the trick. |
| 118 | |
| 119 | LEASEFILE |
| 120 | CONFFILE |
| 121 | RESOLVFILE |
| 122 | the default locations of these files are determined below, but may be overridden |
| 123 | in a build command line using COPTS. |
| 124 | |
| 125 | */ |
| 126 | |
| 127 | |
| 128 | /* The default set of options to build. Built with these options, dnsmasq |
| 129 | has no library dependencies other than libc */ |
| 130 | |
| 131 | #define HAVE_DHCP |
Simon Kelley | 0793380 | 2012-02-14 20:55:25 +0000 | [diff] [blame] | 132 | #define HAVE_DHCP6 |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 133 | #define HAVE_TFTP |
| 134 | #define HAVE_SCRIPT |
Simon Kelley | 4820dce | 2012-12-18 18:30:30 +0000 | [diff] [blame] | 135 | #define HAVE_AUTH |
Simon Kelley | 3ddad24 | 2013-03-21 17:56:06 +0000 | [diff] [blame] | 136 | #define HAVE_IPSET |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 137 | /* #define HAVE_LUASCRIPT */ |
| 138 | /* #define HAVE_BROKEN_RTC */ |
| 139 | /* #define HAVE_DBUS */ |
| 140 | /* #define HAVE_IDN */ |
| 141 | /* #define HAVE_CONNTRACK */ |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 142 | |
| 143 | |
| 144 | /* Default locations for important system files. */ |
Simon Kelley | 73a08a2 | 2009-02-05 20:28:08 +0000 | [diff] [blame] | 145 | |
| 146 | #ifndef LEASEFILE |
| 147 | # if defined(__FreeBSD__) || defined (__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__) |
| 148 | # define LEASEFILE "/var/db/dnsmasq.leases" |
| 149 | # elif defined(__sun__) || defined (__sun) |
| 150 | # define LEASEFILE "/var/cache/dnsmasq.leases" |
Simon Kelley | 572b41e | 2011-02-18 18:11:18 +0000 | [diff] [blame] | 151 | # elif defined(__ANDROID__) |
| 152 | # define LEASEFILE "/data/misc/dhcp/dnsmasq.leases" |
Simon Kelley | 73a08a2 | 2009-02-05 20:28:08 +0000 | [diff] [blame] | 153 | # else |
| 154 | # define LEASEFILE "/var/lib/misc/dnsmasq.leases" |
| 155 | # endif |
Simon Kelley | feba5c1 | 2004-07-27 20:28:58 +0100 | [diff] [blame] | 156 | #endif |
Simon Kelley | 73a08a2 | 2009-02-05 20:28:08 +0000 | [diff] [blame] | 157 | |
| 158 | #ifndef CONFFILE |
| 159 | # if defined(__FreeBSD__) |
| 160 | # define CONFFILE "/usr/local/etc/dnsmasq.conf" |
| 161 | # else |
| 162 | # define CONFFILE "/etc/dnsmasq.conf" |
| 163 | # endif |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 164 | #endif |
Simon Kelley | 73a08a2 | 2009-02-05 20:28:08 +0000 | [diff] [blame] | 165 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 166 | #ifndef RESOLVFILE |
| 167 | # if defined(__uClinux__) |
| 168 | # define RESOLVFILE "/etc/config/resolv.conf" |
| 169 | # else |
| 170 | # define RESOLVFILE "/etc/resolv.conf" |
| 171 | # endif |
| 172 | #endif |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 173 | |
Simon Kelley | 55d290a | 2012-06-29 20:58:32 +0100 | [diff] [blame] | 174 | #ifndef RUNFILE |
| 175 | # if defined(__ANDROID__) |
| 176 | # define RUNFILE "/data/dnsmasq.pid" |
| 177 | # else |
| 178 | # define RUNFILE "/var/run/dnsmasq.pid" |
| 179 | # endif |
| 180 | #endif |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 181 | |
| 182 | /* platform dependent options: these are determined automatically below |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 183 | |
Simon Kelley | 5e9e0ef | 2006-04-17 14:24:29 +0100 | [diff] [blame] | 184 | HAVE_LINUX_NETWORK |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 185 | HAVE_BSD_NETWORK |
| 186 | HAVE_SOLARIS_NETWORK |
| 187 | define exactly one of these to alter interaction with kernel networking. |
| 188 | |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 189 | HAVE_GETOPT_LONG |
Simon Kelley | da632e7 | 2012-03-26 11:14:05 +0100 | [diff] [blame] | 190 | defined when GNU-style getopt_long available. |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 191 | |
| 192 | HAVE_ARC4RANDOM |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 193 | defined if arc4random() available to get better security from DNS spoofs |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 194 | by using really random ids (OpenBSD) |
| 195 | |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 196 | HAVE_SOCKADDR_SA_LEN |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 197 | defined if struct sockaddr has sa_len field (*BSD) |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 198 | */ |
| 199 | |
| 200 | /* Must preceed __linux__ since uClinux defines __linux__ too. */ |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 201 | #if defined(__uClinux__) |
Simon Kelley | 5e9e0ef | 2006-04-17 14:24:29 +0100 | [diff] [blame] | 202 | #define HAVE_LINUX_NETWORK |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 203 | #define HAVE_GETOPT_LONG |
| 204 | #undef HAVE_ARC4RANDOM |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 205 | #undef HAVE_SOCKADDR_SA_LEN |
Simon Kelley | 59353a6 | 2004-11-21 19:34:28 +0000 | [diff] [blame] | 206 | /* Never use fork() on uClinux. Note that this is subtly different from the |
| 207 | --keep-in-foreground option, since it also suppresses forking new |
Simon Kelley | 5aabfc7 | 2007-08-29 11:24:47 +0100 | [diff] [blame] | 208 | processes for TCP connections and disables the call-a-script on leasechange |
| 209 | system. It's intended for use on MMU-less kernels. */ |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 210 | #define NO_FORK |
| 211 | |
| 212 | #elif defined(__UCLIBC__) |
Simon Kelley | 5e9e0ef | 2006-04-17 14:24:29 +0100 | [diff] [blame] | 213 | #define HAVE_LINUX_NETWORK |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 214 | #if defined(__UCLIBC_HAS_GNU_GETOPT__) || \ |
| 215 | ((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21)) |
| 216 | # define HAVE_GETOPT_LONG |
Simon Kelley | 5e9e0ef | 2006-04-17 14:24:29 +0100 | [diff] [blame] | 217 | #endif |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 218 | #undef HAVE_ARC4RANDOM |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 219 | #undef HAVE_SOCKADDR_SA_LEN |
Simon Kelley | 7cebd20 | 2006-05-06 14:13:33 +0100 | [diff] [blame] | 220 | #if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__) |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 221 | # define NO_FORK |
| 222 | #endif |
Simon Kelley | 7cebd20 | 2006-05-06 14:13:33 +0100 | [diff] [blame] | 223 | #if defined(__UCLIBC_HAS_IPV6__) |
| 224 | # ifndef IPV6_V6ONLY |
| 225 | # define IPV6_V6ONLY 26 |
| 226 | # endif |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 227 | #endif |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 228 | |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 229 | /* This is for glibc 2.x */ |
| 230 | #elif defined(__linux__) |
Simon Kelley | 5e9e0ef | 2006-04-17 14:24:29 +0100 | [diff] [blame] | 231 | #define HAVE_LINUX_NETWORK |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 232 | #define HAVE_GETOPT_LONG |
| 233 | #undef HAVE_ARC4RANDOM |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 234 | #undef HAVE_SOCKADDR_SA_LEN |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 235 | |
Simon Kelley | 9e03894 | 2008-05-30 20:06:34 +0100 | [diff] [blame] | 236 | #elif defined(__FreeBSD__) || \ |
| 237 | defined(__OpenBSD__) || \ |
| 238 | defined(__DragonFly__) || \ |
Simon Kelley | 8ef5ada | 2010-06-03 19:42:45 +0100 | [diff] [blame] | 239 | defined(__FreeBSD_kernel__) |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 240 | #define HAVE_BSD_NETWORK |
Simon Kelley | 59353a6 | 2004-11-21 19:34:28 +0000 | [diff] [blame] | 241 | /* Later verions of FreeBSD have getopt_long() */ |
| 242 | #if defined(optional_argument) && defined(required_argument) |
| 243 | # define HAVE_GETOPT_LONG |
Simon Kelley | 59353a6 | 2004-11-21 19:34:28 +0000 | [diff] [blame] | 244 | #endif |
Simon Kelley | 8ef5ada | 2010-06-03 19:42:45 +0100 | [diff] [blame] | 245 | #if !defined(__FreeBSD_kernel__) |
Simon Kelley | 1a6bca8 | 2008-07-11 11:11:42 +0100 | [diff] [blame] | 246 | # define HAVE_ARC4RANDOM |
| 247 | #endif |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 248 | #define HAVE_SOCKADDR_SA_LEN |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 249 | |
| 250 | #elif defined(__APPLE__) |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 251 | #define HAVE_BSD_NETWORK |
Simon Kelley | 316e273 | 2010-01-22 20:16:09 +0000 | [diff] [blame] | 252 | #define HAVE_GETOPT_LONG |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 253 | #define HAVE_ARC4RANDOM |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 254 | #define HAVE_SOCKADDR_SA_LEN |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 255 | /* Define before sys/socket.h is included so we get socklen_t */ |
| 256 | #define _BSD_SOCKLEN_T_ |
Simon Kelley | 6dbdc97 | 2013-10-28 14:22:57 +0000 | [diff] [blame] | 257 | /* Select the RFC_3542 version of the IPv6 socket API. |
| 258 | Define before netinet6/in6.h is included. */ |
| 259 | #define __APPLE_USE_RFC_3542 |
| 260 | |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 261 | #elif defined(__NetBSD__) |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 262 | #define HAVE_BSD_NETWORK |
Simon Kelley | fd9fa48 | 2004-10-21 20:24:00 +0100 | [diff] [blame] | 263 | #define HAVE_GETOPT_LONG |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 264 | #undef HAVE_ARC4RANDOM |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 265 | #define HAVE_SOCKADDR_SA_LEN |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 266 | |
| 267 | #elif defined(__sun) || defined(__sun__) |
| 268 | #define HAVE_SOLARIS_NETWORK |
Simon Kelley | 7622fc0 | 2009-06-04 20:32:05 +0100 | [diff] [blame] | 269 | #define HAVE_GETOPT_LONG |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 270 | #undef HAVE_ARC4RANDOM |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 271 | #undef HAVE_SOCKADDR_SA_LEN |
Simon Kelley | 7622fc0 | 2009-06-04 20:32:05 +0100 | [diff] [blame] | 272 | #define ETHER_ADDR_LEN 6 |
| 273 | |
Simon Kelley | 824af85 | 2008-02-12 20:43:05 +0000 | [diff] [blame] | 274 | #endif |
| 275 | |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 276 | /* Decide if we're going to support IPv6 */ |
| 277 | /* We assume that systems which don't have IPv6 |
| 278 | headers don't have ntop and pton either */ |
| 279 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 280 | #if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY) |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 281 | # define HAVE_IPV6 |
| 282 | # define ADDRSTRLEN INET6_ADDRSTRLEN |
Simon Kelley | b5a7ff4 | 2013-04-25 11:03:47 +0100 | [diff] [blame] | 283 | #else |
| 284 | # if !defined(INET_ADDRSTRLEN) |
| 285 | # define INET_ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */ |
| 286 | # endif |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 287 | # undef HAVE_IPV6 |
| 288 | # define ADDRSTRLEN INET_ADDRSTRLEN |
Simon Kelley | e17fb62 | 2006-01-14 20:33:46 +0000 | [diff] [blame] | 289 | #endif |
| 290 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 291 | |
| 292 | /* rules to implement compile-time option dependencies and |
| 293 | the NO_XXX flags */ |
| 294 | |
| 295 | #ifdef NO_IPV6 |
| 296 | #undef HAVE_IPV6 |
Simon Kelley | 1f15b81 | 2009-10-13 17:49:32 +0100 | [diff] [blame] | 297 | #endif |
| 298 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 299 | #ifdef NO_TFTP |
| 300 | #undef HAVE_TFTP |
| 301 | #endif |
| 302 | |
| 303 | #ifdef NO_DHCP |
| 304 | #undef HAVE_DHCP |
| 305 | #undef HAVE_DHCP6 |
| 306 | #endif |
| 307 | |
| 308 | #if defined(NO_DHCP6) || !defined(HAVE_IPV6) |
| 309 | #undef HAVE_DHCP6 |
| 310 | #endif |
| 311 | |
| 312 | /* DHCP6 needs DHCP too */ |
| 313 | #ifdef HAVE_DHCP6 |
| 314 | #define HAVE_DHCP |
| 315 | #endif |
| 316 | |
| 317 | #if defined(NO_SCRIPT) || !defined(HAVE_DHCP) || defined(NO_FORK) |
| 318 | #undef HAVE_SCRIPT |
| 319 | #undef HAVE_LUASCRIPT |
| 320 | #endif |
| 321 | |
| 322 | /* Must HAVE_SCRIPT to HAVE_LUASCRIPT */ |
| 323 | #ifdef HAVE_LUASCRIPT |
| 324 | #define HAVE_SCRIPT |
| 325 | #endif |
| 326 | |
Simon Kelley | 4820dce | 2012-12-18 18:30:30 +0000 | [diff] [blame] | 327 | #ifdef NO_AUTH |
| 328 | #undef HAVE_AUTH |
| 329 | #endif |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 330 | |
Simon Kelley | 3ddad24 | 2013-03-21 17:56:06 +0000 | [diff] [blame] | 331 | #if defined(NO_IPSET) || !defined(HAVE_LINUX_NETWORK) |
Jason A. Donenfeld | 13d86c7 | 2013-02-22 18:20:53 +0000 | [diff] [blame] | 332 | #undef HAVE_IPSET |
| 333 | #endif |
| 334 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 335 | /* Define a string indicating which options are in use. |
| 336 | DNSMASQP_COMPILE_OPTS is only defined in dnsmasq.c */ |
| 337 | |
| 338 | #ifdef DNSMASQ_COMPILE_OPTS |
| 339 | |
| 340 | static char *compile_opts = |
| 341 | #ifndef HAVE_IPV6 |
| 342 | "no-" |
| 343 | #endif |
| 344 | "IPv6 " |
| 345 | #ifndef HAVE_GETOPT_LONG |
| 346 | "no-" |
| 347 | #endif |
| 348 | "GNU-getopt " |
| 349 | #ifdef HAVE_BROKEN_RTC |
| 350 | "no-RTC " |
| 351 | #endif |
| 352 | #ifdef NO_FORK |
| 353 | "no-MMU " |
| 354 | #endif |
| 355 | #ifndef HAVE_DBUS |
| 356 | "no-" |
| 357 | #endif |
| 358 | "DBus " |
| 359 | #ifndef LOCALEDIR |
| 360 | "no-" |
| 361 | #endif |
| 362 | "i18n " |
| 363 | #if !defined(LOCALEDIR) && !defined(HAVE_IDN) |
| 364 | "no-" |
| 365 | #endif |
| 366 | "IDN " |
| 367 | #ifndef HAVE_DHCP |
| 368 | "no-" |
| 369 | #endif |
| 370 | "DHCP " |
| 371 | #if defined(HAVE_DHCP) |
| 372 | # if !defined (HAVE_DHCP6) |
| 373 | "no-" |
| 374 | # endif |
| 375 | "DHCPv6 " |
| 376 | # if !defined(HAVE_SCRIPT) |
| 377 | "no-scripts " |
| 378 | # else |
| 379 | # if !defined(HAVE_LUASCRIPT) |
| 380 | "no-" |
| 381 | # endif |
| 382 | "Lua " |
| 383 | # endif |
| 384 | #endif |
| 385 | #ifndef HAVE_TFTP |
| 386 | "no-" |
| 387 | #endif |
| 388 | "TFTP " |
| 389 | #ifndef HAVE_CONNTRACK |
| 390 | "no-" |
| 391 | #endif |
Simon Kelley | 4820dce | 2012-12-18 18:30:30 +0000 | [diff] [blame] | 392 | "conntrack " |
Jason A. Donenfeld | 13d86c7 | 2013-02-22 18:20:53 +0000 | [diff] [blame] | 393 | #ifndef HAVE_IPSET |
| 394 | "no-" |
| 395 | #endif |
| 396 | "ipset " |
Simon Kelley | 4820dce | 2012-12-18 18:30:30 +0000 | [diff] [blame] | 397 | #ifndef HAVE_AUTH |
| 398 | "no-" |
| 399 | #endif |
| 400 | "auth"; |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 401 | |
| 402 | #endif |
| 403 | |
| 404 | |
| 405 | |