File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / dnsmasq / src / config.h
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 16:31:38 2014 UTC (10 years ago) by misho
Branches: elwix, dnsmasq, MAIN
CVS tags: v2_71, HEAD
dnsmasq 2.71

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>