Annotation of embedaddon/dnsmasq/src/config.h, revision 1.1.1.3

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

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