Commit f60bb4fc authored by Max Lv's avatar Max Lv

update pdnsd

parent 06934b3e
[submodule "src/main/jni/shadowsocks"]
path = src/main/jni/shadowsocks
url = https://github.com/madeye/shadowsocks-libev.git
[submodule "src/main/jni/pdnsd"]
path = src/main/jni/pdnsd
url = https://git.gitorious.org/pdnsd/pdnsd.git
......@@ -80,11 +80,11 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/*.c)
PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/src/*.c)
LOCAL_MODULE := pdnsd
LOCAL_SRC_FILES := $(PDNSD_SOURCES:$(LOCAL_PATH)/%=%)
LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd
LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd/src -I$(LOCAL_PATH)/pdnsd-inc
include $(BUILD_EXECUTABLE)
......
pdnsd @ a8e46ccb
Subproject commit a8e46ccba7b0fa2230d6c42ab6dcd92926f6c21d
......@@ -104,9 +104,11 @@
* default: native; others: gdbm */
#define CACHE_DBM DBM_NATIVE
#define CONFDIR "/data/data/com.github.shadowsocks"
#define CACHEDIR "/data/data/com.github.shadowsocks"
#define TEMPDIR "/tmp";
#define TEMPDIR "/data/data/com.github.shadowsocks/cache";
/* This is for various debugging facilities that produce debug output and
* double-check some values. You can enable debug messages with the -g option.
......@@ -148,13 +150,16 @@
/* #undef SOCKET_LOCKING */
/* Default TCP timeout when receiving queries */
#define TCP_TIMEOUT 30
#define TCP_TIMEOUT 5
/* Allow subsequent TCP queries on one connection? */
/* #undef TCP_SUBSEQ */
/* Default value for parallel query number */
#define PAR_QUERIES 2
#define PAR_QUERIES 4
/* Maximum number of IP addresses used per nameserver obtained from NS records. */
#define MAXNAMESERVIPS 3
/* These are the possible targets. Normally no need to touch these
* definitions. */
......
Most of pdnsd was written by Thomas Moestl (tmoestl@gmx.net).
In the "par" versions large parts of the code have been revised
and several features have been added by Paul Rombouts.
Small parts of this program are based on code that was taken from nmap (IP
checksumming), the isdn4k-utils (ippp interface uptest), glibc 2.1.2 (some
definitions for kernel 2.2.x missing in 2.0 glibcs) and FreeBSD
(SIZEOF_ADDR_IFREQ in netdev.c).
nmap was written by Fyodor. The insd4k-utils were written by Fritz Elfert and
others. The GNU C library (glibc) is copyright by the Free Software
Foundation.
The following people have contributed code:
Andrew M. Bishop contributed support for server labels
Carsten Block contributed 'configure'-able rc scripts
Stephan Boettcher contributed the SCHEME= option.
P.J. Bostley contributed patches to get pdnsd working on
alpha
Frank Elsner contributed rc script fixes
Christian Engstler contributed patches for SuSE compatability
Bjoern Fischer contributed code to make pdnsd leave the case of names
in the cache unchanged
Torben Janssen contributed RedHat rc scripts
Olaf Kirch contributed a security fix for the run_as()
function
Bernd Leibing contributed fixes to the spec file.
Sourav K. Mandal contributed the autoconf/automake code, gdbm
caching facility and many suggestions
Markus Mohr contributed Debian rc scripts
Alexandre Nunes contributed autoconf fixes
Wolfgang Ocker contributed the server_ip option
Soenke J. Peters contributed patches and suggestions for RedHat
compatability
Roman Shterenzon contributed many helpful hints and patches for
FreeBSD compatability.
Andreas Steinmetz contributed the code for the query_port_start and
query_port_end options (which I changed slightly,
so blame any breakage on me ;)
Marko Stolle contributed the contrib/pdnsd_update.pl script that
makes pdnsd usable in a DHCP setup.
Lyonel Vincent extended the serve_aliases option to support an
arbitrary number of aliases
Paul Wagland contributed a patches for bind9-compatability
and for some memory leaks on error paths.
Sverker Wiberg contributed IPv6 build fixes
Michael Wiedmann contributed the pdnsd-ctl.8 man page.
Ron Yorston contributed the dev-uptest for Linux ppp dial-
on-demand devices
Nikita V. Youshchenko contributed extensions to the "if" uptest
Mahesh T. Pai contributed the pdnsd.8 man page.
Nikola Kotur contributed the Slackware start-up script.
Kiyo Kelvin Lee contributed a patch for Cygwin support.
Rodney Brown contributed a patch for Darwin (Apple Mac OS X) support.
Jan-Marek Glogowski contributed a patch implementing the "use_nss" option.
Please look into the THANKS file for people who helped me in various ways on
this project.
If this list is incomplete, pease drop me a mail!
This diff is collapsed.
A small part of the pdnsd source is licensed under the following BSD-style
license:
Copyright (C) 2001 Thomas Moestl
This file is part of the pdnsd package.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This source diff could not be displayed because it is too large. You can view the blob instead.
2000-02-15
Version 0.2. First working alpha with the extended feature set.
2000-02-16
Version 0.3 with many bugfixes, better standard conformity and
some new features.
2000-02-17
Did a lint on the code, implemented soft timeouts, again bugfixes,
drastically reduced cache memory requirements, implemented local
records.
Version 0.4 released.
2000-02-19
Recursive query finally implemented. Version 0.5 out.
2000-02-20
Various bugfixes. The server now always tries to get an AA answer
if possible; this implies recursion. This is to deal better with
caching servers that may return incomplete results on * queries.
This may be a little sub-optimal since it may not take the full
effect of caching, but it is the only real possibility of getting
complete records.
Redid the deps in the makefile for now.
Version is now 0.6.
2000-02-21
Another set of bugfixes. Version is 0.6.1.
2000-02-22
Another set of bugfixes. It should stabilize by now. Answer compression
is there finally. Version is therefore up again, 0.7 by now.
2000-02-23
Minor bugfixes, isdn interface uptest added. The new record types as of
rfc1700 are implemented, but as a compile-time option, since normally
there is no need to waste space for them.
Version is 0.7.1.
2000-02-24
Version 0.7.2 with all rrs up to KX (36). #define DNS_NEW_RRS in
config.h and (re)compile if you want to use them. Delete the cache
file before using a version with this option changed!
NSAP-PTR does NOT WORK (any incoming answer containing it may cause
a format error) because it is ill-designed (see TODO). Never mind, it
is officially deprecated anyway.
The secure DNS extension record types defined in RFC 2065 (KEY, SIG,
NXT) are cached only and therefore useless.
2000-02-26
Version 0.8 with parallel query (and probably new bugs) introduced.
2000-02-27
Version 0.8.1 with minor bugfixes on the new features.
2000-02-27
Version 0.8.5 with authority support and the usual bugifxes. Some issues
with standard conformity were also fixed (wow, two versions a day).
2000-02-28
Implemented caching of non-authoritative records. This allows better
usage of other caching name servers. This may return non-authoritative
records to any non-wildcard query. If a wildcard query arrives, we
always look for authoritative records, so we do if the non-authoritative
answer does not contain at least one answering record to the query.
This fixes the sub-optimal behaviour since 0.6.
Version is therefore up to 0.8.7 (0.8.6 was also released today
containing bugfixes)
2000-02-29
Better thread support, avoiding deadlocks in signal handling. The cost
is unfortunately one more thread.
New option server_port in config file.
Version is 0.8.8.
2000-03-01
Nailed a renitent memory leak bug to the wall (shame, what a trivial
mistake). Also improved handling of error conditions slightly.
Version is 0.8.9.
2000-03-01
Cache code cleanup. The development of the non-parallel query code
is discontinued, although it still works. If you want serial query,
just set PAR_QUERIES to 1.
Additional information finally implemented.
We are up to 0.9.
2000-03-02
Fixed a DoS possibility.
More rfc compatability fixups and a smarter resolver logic.
Version 0.9.1
2000-03-02
Added the source section to the config file handling. This allows to
source your /etc/hosts file. Version 0.9.2.
2000-03-02
Avoiding double additional records now. Version 0.9.3.
2000-03-09
Fixed some REALLY STUPID bugs. Uuummph, thought it was finished.
However, the number of bugs remaining is always n+1...
Anyway, we are up to 0.9.4. Hope that there are no mean bugs left.
2000-03-14
Added another uptest, exec. See README for details. Also grained the
cache size finer (it's now specified in kB). Version 0.9.5
2000-04-07
Fixed some really stupid bugs, what else? Version is 0.9.6
To be more exact: fixed misc bugs, cleaned up hash.c and cache.c
2000-04-20
Again fixed some bugs, version is now 0.9.7.
2000-04-29
Fixed a build problem caused by some missing #defines in glibc2.0 and a
minor bug.
Version is up to 0.9.8
2000-04-30
Fixed some unclean C code and did a general C lint. Thanks to Byrial
Jensen for pointing out some issues. Now using stricter compiler flags.
Also replaced the daemon() call in main.c for improved portability.
Pre-Released 0.9.9p1
2000-05-03
Released 0.9.9p2 with the changes of 0.9.9p1, Documentation updates,
bugfixes, and the Red Hat rc scripts contributed by Torben Janssen.
Also, the meaning of the command line option -v has changed.
There is a new config file option "lean_query" that is on by
default. It is an optimization, so please look in the docs when
updating whether you want it switched on or not.
Removed the long-dead serial query code from the distribution tree.
Some resolvers seem to be broken somehow in a respect that it cares
about order in which the records appear. In particular, it wants
cname to appear before other records. Ok, so it be...
2000-05-04
Save all names in lower case in the rrs.
Tidying up the source tree.
The long-awaited cache structure changes have been started. Please
delete you cache files before using this new release.
2000-05-05
Fixed several bugs in the old and in the new source tree.
Use time_t instead of long for internal time storage for compatibility.
2000-05-06
Version 0.9.10.
This fixes a bug in uptest=if. Red Hat and configuration fixes
suggested by Soeren J. Peters were included.
2000-05-08
Version 0.9.11
This fixes a locally exploitable security problem (pdnsd.cache was
world-writeable). This is actually a one-line fix; for a description of
possible dangers, please refer to the html documentation.
Thanks to Alan Swanson for reporting.
The installation instructions are in doc/html/doc.html and doc/txt/manual.txt.
The system requirements are listed in doc/html/index.html and doc/txt/intro.txt.
I recommend using the html version.
Following are generic installation instructions for autoconf programs.
I strongly recommend to read the Installation section in the docs!
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
This diff is collapsed.
sbin_PROGRAMS = pdnsd
pdnsd_CFLAGS = -DCONFDIR='"$(sysconfdir)"' $(thread_CFLAGS)
pdnsd_SOURCES = conf-parser.c conff.c consts.c debug.c dns.c dns_answer.c \
dns_query.c error.c helpers.c icmp.c list.c main.c netdev.c rr_types.c \
status.c servers.c thread.c cache.c hash.c conf-parser.h \
conf-keywords.h conff.h consts.h debug.h dns.h dns_answer.h \
dns_query.h error.h helpers.h icmp.h ipvers.h list.h netdev.h \
rr_types.h servers.h status.h thread.h cache.h hash.h pdnsd_assert.h \
freebsd_netinet_ip_icmp.h
EXTRA_DIST = make_rr_types_h.pl rr_types.in
## Try to do this last
SUBDIRS = . pdnsd-ctl rc test
$(pdnsd_OBJECTS): rr_types.h
rr_types.h: make_rr_types_h.pl rr_types.in
perl make_rr_types_h.pl rr_types.in > rr_types.h
This diff is collapsed.
This diff is collapsed.
You can find the documentation for pdnsd in the doc/ directory. The html
documentation (which I recommend) is in the doc/html/ subdirectory.
The pure text documentation (which is generated automatically from the
html documentation) is in doc/txt/.
The following documents are available:
index.html / intro.txt Overview, system requirements
doc.html / manual.txt Building, installation and usage instructions
faq.html / faq.txt The FAQ
Share and enjoy!
Thomas <tmoestl@gmx.net>
For news about recent changes in pdnsd the following files may be of
interest to you:
README.par
ChangeLog
NEWS
Last revised: 08 July 2007 by Paul Rombouts
This diff is collapsed.
This diff is collapsed.
This is a (hopefully complete) list of people I have to thank for helping me
develop and improve pdnsd:
David G. Andersen
Andrew M. Bishop
Daniel Black
Carsten Block
Stephan Boettcher
P.J. Bostley
Rodney Brown
Kevin A. Burton
Juliusz Chroboczek
Joachim Dorner
Frank Elsner
Christian Engstler
Stefan Erhardt
Bjoern Fischer
Stefan Frster
Bert Frederiks
Mike Hammer
Jonathan Hudson
Torben Janssen
Byrial Jensen
Olaf Kirch
Nikola Kotur
Kiyo Kelvin Lee
Bernd Leibing
Patrick Loschmidt
James MacLean
Sourav K. Mandal
Fraser McCrossan
Markus Mohr
Michael Mller
Gustavo Niemeyer
Alexandre Nunes
Wolfgang Ocker
Mahesh T. Pai
Bernhard Pelz
Soenke J. Peters
Erich Reitz
Paul A. Rombouts
Brian Schroeder
Roman Shterenzon
Daniel Smolik
Milan P. Stanic
Michael Steiner
Norbert Steinl
Andreas Steinmetz
Marko Stolle
Markus Storm
Michael Strder
Thomas Stromberg
Alan Swanson
Lyonel Vincent
Eelco Vriezekolk
Paul Wagland
Sverker Wiberg
Michael Wiedmann
Ron Yorston
Nikita V. Youshchenko
Jan-Marek Glogowski
Thomas Cort
Pierre Habouzit
Dirk Armbrust
Georg Schwarz
Ashish Shukla
- Implement a reference counter to ensure that newly entered records are not
purged immediately (really needed?)
- Perhaps do a two-step form of recursive query: first query those servers we
have got cached, then (if unsuccessful) look the others up and query again.
The impact of this optimisation may not be very big, because all sane servers
give A records for NS records if possible.
- Test for compatibility on other Unix-like Systems other than the BSDs and
Linux; rewrite the functions in netdev.c and icmp.c for those OSs if
necessary. Also try to get compatibility for other compilers than gcc.
- Write an install rule for the Slackware start-up script.
- Update the FAQ.
- Implement DNSSEC support. Since version 1.2.9, pdnsd is able to cache the RR
types necessary for DNSSEC, but the resolver is not yet security aware.
This diff is collapsed.
This diff is collapsed.
/* conf-keywords.h - Tables used by parser of configuration file.
Based on information previously contained in conf-lex.y and conf-parse.y
Copyright (C) 2004,2005,2006,2007,2008,2009,2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
enum {
ERROR,
GLOBAL,
SERVER,
RR,
NEG,
SOURCE,
INCLUDE_F,
PERM_CACHE,
CACHE_DIR,
SERVER_PORT,
SERVER_IP,
OUTGOING_IP,
SCHEME_FILE,
LINKDOWN_KLUGE,
MAX_TTL,
MIN_TTL,
RUN_AS,
STRICT_SETUID,
USE_NSS,
PARANOID,
IGNORE_CD,
STATUS_CTL,
DAEMON,
C_TCP_SERVER,
PID_FILE,
C_VERBOSITY,
C_QUERY_METHOD,
RUN_IPV4,
IPV4_6_PREFIX,
C_DEBUG,
C_CTL_PERMS,
C_PROC_LIMIT,
C_PROCQ_LIMIT,
TCP_QTIMEOUT,
C_PAR_QUERIES,
C_RAND_RECS,
NEG_TTL,
NEG_RRS_POL,
NEG_DOMAIN_POL,
QUERY_PORT_START,
QUERY_PORT_END,
UDP_BUFSIZE,
DELEGATION_ONLY,
IP,
PORT,
SCHEME,
UPTEST,
TIMEOUT,
PING_TIMEOUT,
PING_IP,
UPTEST_CMD,
QUERY_TEST_NAME,
INTERVAL,
INTERFACE,
DEVICE,
PURGE_CACHE,
CACHING,
LEAN_QUERY,
EDNS_QUERY,
PRESET,
PROXY_ONLY,
ROOT_SERVER,
RANDOMIZE_SERVERS,
INCLUDE,
EXCLUDE,
POLICY,
REJECTLIST,
REJECTPOLICY,
REJECTRECURSIVELY,
LABEL,
A,
PTR,
MX,
SOA,
CNAME,
TXT,
SPF,
NAME,
OWNER,
TTL,
TYPES,
FILET,
SERVE_ALIASES,
AUTHREC,
REVERSE
};
/* Table for looking up section headers. Order alphabetically! */
static const namevalue_t section_headers[]= {
{"global", GLOBAL},
{"include", INCLUDE_F},
{"neg", NEG},
{"rr", RR},
{"server", SERVER},
{"source", SOURCE}
};
/* Table for looking up global options. Order alphabetically! */
static const namevalue_t global_options[]= {
{"cache_dir", CACHE_DIR},
{"ctl_perms", C_CTL_PERMS},
{"daemon", DAEMON},
{"debug", C_DEBUG},
{"delegation_only", DELEGATION_ONLY},
{"ignore_cd", IGNORE_CD},
{"interface", SERVER_IP},
{"ipv4_6_prefix", IPV4_6_PREFIX},
{"linkdown_kluge", LINKDOWN_KLUGE},
{"max_ttl", MAX_TTL},
{"min_ttl", MIN_TTL},
{"neg_domain_pol", NEG_DOMAIN_POL},
{"neg_rrs_pol", NEG_RRS_POL},
{"neg_ttl", NEG_TTL},
{"outgoing_ip", OUTGOING_IP},
{"outside_interface", OUTGOING_IP},
{"par_queries", C_PAR_QUERIES},
{"paranoid", PARANOID},
{"perm_cache", PERM_CACHE},
{"pid_file", PID_FILE},
{"proc_limit", C_PROC_LIMIT},
{"procq_limit", C_PROCQ_LIMIT},
{"query_method", C_QUERY_METHOD},
{"query_port_end", QUERY_PORT_END},
{"query_port_start", QUERY_PORT_START},
{"randomize_recs", C_RAND_RECS},
{"run_as", RUN_AS},
{"run_ipv4", RUN_IPV4},
{"scheme_file", SCHEME_FILE},
{"server_ip", SERVER_IP},
{"server_port", SERVER_PORT},
{"status_ctl", STATUS_CTL},
{"strict_setuid", STRICT_SETUID},
{"tcp_qtimeout", TCP_QTIMEOUT},
{"tcp_server", C_TCP_SERVER},
{"timeout", TIMEOUT},
{"udpbufsize", UDP_BUFSIZE},
{"use_nss", USE_NSS},
{"verbosity", C_VERBOSITY}
};
/* Table for looking up server options. Order alphabetically! */
static const namevalue_t server_options[]= {
{"caching", CACHING},
{"device", DEVICE},
{"edns_query", EDNS_QUERY},
{"exclude", EXCLUDE},
{"file", FILET},
{"include", INCLUDE},
{"interface", INTERFACE},
{"interval", INTERVAL},
{"ip", IP},
{"label", LABEL},
{"lean_query", LEAN_QUERY},
{"ping_ip", PING_IP},
{"ping_timeout", PING_TIMEOUT},
{"policy", POLICY},
{"port", PORT},
{"preset", PRESET},
{"proxy_only", PROXY_ONLY},
{"purge_cache", PURGE_CACHE},
{"query_test_name", QUERY_TEST_NAME},
{"randomize_servers", RANDOMIZE_SERVERS},
{"reject", REJECTLIST},
{"reject_policy", REJECTPOLICY},
{"reject_recursively", REJECTRECURSIVELY},
{"root_server", ROOT_SERVER},
{"scheme", SCHEME},
{"timeout", TIMEOUT},
{"uptest", UPTEST},
{"uptest_cmd", UPTEST_CMD}
};
/* Table for looking up rr options. Order alphabetically! */
static const namevalue_t rr_options[]= {
{"a", A},
{"authrec", AUTHREC},
{"cname", CNAME},
{"mx", MX},
{"name", NAME},
{"ns", OWNER},
{"owner", OWNER},
{"ptr", PTR},
{"reverse", REVERSE},
{"soa", SOA},
{"spf", SPF},
{"ttl", TTL},
{"txt", TXT}
};
/* Table for looking up source options. Order alphabetically! */
static const namevalue_t source_options[]= {
{"authrec", AUTHREC},
{"file", FILET},
{"ns", OWNER},
{"owner", OWNER},
{"serve_aliases", SERVE_ALIASES},
{"ttl", TTL}
};
/* Table for looking up include options. Order alphabetically! */
static const namevalue_t include_options[]= {
{"file", FILET}
};
/* Table for looking up neg options. Order alphabetically! */
static const namevalue_t neg_options[]= {
{"name", NAME},
{"ttl", TTL},
{"types", TYPES}
};
This diff is collapsed.
/* conf-parser.h - definitions for parser of pdnsd config files.
The parser was rewritten in C from scratch and doesn't require (f)lex
or yacc/bison.
Copyright (C) 2004,2008 Paul A. Rombouts.
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef CONF_PARSER_H
#define CONF_PARSER_H
int confparse(FILE* in, char *prestr, globparm_t *global, servparm_array *servers, int includedepth, char **errstr);
#endif /* CONF_PARSER_H */
This diff is collapsed.
/* conff.h - Definitions for configuration management.
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef CONFF_H
#define CONFF_H
/* XXX should use the system defined ones. */
/* #define MAXPATH 1024 */
/* #define MAXIFNAME 31 */
#include <config.h>
#include <stdio.h>
#include <pthread.h>
#include <sys/socket.h>
#include <net/if.h>
#include "ipvers.h"
#include "list.h"
/* From main.c */
#if DEBUG>0
extern short int debug_p;
#else
#define debug_p 0
#endif
extern short int stat_pipe;
extern pthread_t main_thrid;
extern uid_t init_uid;
extern char *conf_file;
/* ----------- */
typedef DYNAMIC_ARRAY(pdnsd_a) *addr_array;
typedef DYNAMIC_ARRAY(pdnsd_a2) *addr2_array;
typedef struct {
time_t i_ts;
char is_up;
pdnsd_a2 a;
} atup_t;
typedef DYNAMIC_ARRAY(atup_t) *atup_array;
typedef struct {
unsigned char *domain;
short exact;
short rule;
} slist_t;
typedef DYNAMIC_ARRAY(slist_t) *slist_array;
typedef struct {
struct in_addr a,mask;
} addr4maskpair_t;
typedef DYNAMIC_ARRAY(addr4maskpair_t) *a4_array;
#if ALLOW_LOCAL_AAAA
typedef struct {
struct in6_addr a,mask;
} addr6maskpair_t;
typedef DYNAMIC_ARRAY(addr6maskpair_t) *a6_array;
#endif
typedef struct {
unsigned short port;
short uptest;
time_t timeout;
time_t interval;
time_t ping_timeout;
char scheme[32];
char *uptest_cmd;
char uptest_usr[21];
char interface[IFNAMSIZ];
char device[IFNAMSIZ];
unsigned char *query_test_name;
char *label;
char purge_cache;
char nocache;
char lean_query;
char edns_query;
char is_proxy;
char rootserver;
char rand_servers;
char preset;
char rejectrecursively;
short rejectpolicy;
short policy;
slist_array alist;
atup_array atup_a;
a4_array reject_a4;
#if ALLOW_LOCAL_AAAA
a6_array reject_a6;
#endif
pdnsd_a ping_a;
} servparm_t;
typedef DYNAMIC_ARRAY(servparm_t) *servparm_array;
typedef unsigned char *zone_t;
typedef DYNAMIC_ARRAY(zone_t) *zone_array;
typedef struct {
long perm_cache;
char *cache_dir;
char *pidfile;
int port;
pdnsd_a a;
pdnsd_a out_a;
#ifdef ENABLE_IPV6
struct in6_addr ipv4_6_prefix;
#endif
time_t max_ttl;
time_t min_ttl;
time_t neg_ttl;
short neg_rrs_pol;
short neg_domain_pol;
short verbosity;
char run_as[21];
char daemon;
char debug;
char stat_pipe;
char notcp;
char strict_suid;
char use_nss;
char paranoid;
char lndown_kluge;
char onquery;
char rnd_recs;
int ctl_perms;
char *scheme_file;
int proc_limit;
int procq_limit;
time_t tcp_qtimeout;
time_t timeout;
int par_queries;
int query_method;
int query_port_start;
int query_port_end;
int udpbufsize;
zone_array deleg_only_zones;
} globparm_t;
typedef struct {
char
#ifdef ENABLE_IPV6
prefix,
#endif
pidfile,
verbosity,
pdnsduser,
daemon,
debug,
stat_pipe,
notcp,
query_method;
} cmdlineflags_t;
extern globparm_t global;
extern cmdlineflags_t cmdline;
extern servparm_t serv_presets;
extern servparm_array servers;
int read_config_file(const char *nm, globparm_t *global, servparm_array *servers, int includedepth, char **errstr);
int reload_config_file(const char *nm, char **errstr);
void free_zone(void *ptr);
void free_slist_domain(void *ptr);
void free_slist_array(slist_array sla);
void free_servparm(servparm_t *serv);
int report_conf_stat(int f);
#endif
/* consts.c - Common config constants & handling
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include "consts.h"
#include "rr_types.h"
/* Order alphabetically!! */
static const namevalue_t const_dic[]={
{"auth", C_AUTH},
{"default", C_DEFAULT},
{"dev", C_DEV},
{"diald", C_DIALD},
{"discover", C_DISCOVER},
{"domain", C_DOMAIN},
{"excluded", C_EXCLUDED},
{"exec", C_EXEC},
{"fail", C_FAIL},
{"false", C_OFF},
{"fqdn_only", C_FQDN_ONLY},
{"if", C_IF},
{"included", C_INCLUDED},
{"negate", C_NEGATE},
{"no", C_OFF},
{"none", C_NONE},
{"off", C_OFF},
{"on", C_ON},
{"onquery", C_ONQUERY},
{"ontimeout", C_ONTIMEOUT},
{"ping", C_PING},
{"query", C_QUERY},
{"simple_only", C_SIMPLE_ONLY},
{"tcp_only", TCP_ONLY},
{"tcp_udp", TCP_UDP},
{"true", C_ON},
{"udp_only", UDP_ONLY},
{"udp_tcp", UDP_TCP},
{"yes", C_ON}
};
/* Added by Paul Rombouts */
static const char *const const_names[]={
"error",
"on",
"off",
"default",
"discover",
"none",
"if",
"exec",
"ping",
"query",
"onquery",
"ontimeout",
"udp_only",
"tcp_only",
"tcp_udp",
"udp_tcp",
"dev",
"diald",
"included",
"excluded",
"simple_only",
"fqdn_only",
"auth",
"domain",
"fail",
"negate"
};
/* compare two strings.
The first one is given as pointer to a char array of length len (which
should not contain any null chars),
the second one as a pointer to a null terminated char array.
*/
inline static int keyncmp(const char *key1, int len, const char *key2)
{
int cmp=strncmp(key1,key2,len);
if(cmp) return cmp;
return -(int)((unsigned char)(key2[len]));
}
int binsearch_keyword(const char *name, int len, const namevalue_t dic[], int range)
{
int i=0,j=range;
while(i<j) {
int k=(i+j)/2;
int cmp=keyncmp(name,len,dic[k].name);
if(cmp<0)
j=k;
else if(cmp>0)
i=k+1;
else
return dic[k].val;
}
return 0;
}
int lookup_const(const char *name, int len)
{
return binsearch_keyword(name,len,const_dic,sizeof(const_dic)/sizeof(namevalue_t));
}
/* Added by Paul Rombouts */
const char *const_name(int c)
{
return (c>=0 && c<sizeof(const_names)/sizeof(char *))? const_names[c] : "ILLEGAL!";
}
/* consts.h - Common config constants & handling
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
pdnsd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef CONSTS_H
#define CONSTS_H
#include <config.h>
#define C_RRTOFFS 64
enum {
C_ERR,
C_ON,
C_OFF,
C_DEFAULT,
C_DISCOVER,
C_NONE,
C_IF,
C_EXEC,
C_PING,
C_QUERY,
C_ONQUERY,
C_ONTIMEOUT,
UDP_ONLY,
TCP_ONLY,
TCP_UDP,
UDP_TCP,
C_DEV,
C_DIALD,
C_INCLUDED,
C_EXCLUDED,
C_SIMPLE_ONLY,
C_FQDN_ONLY,
C_AUTH,
C_DOMAIN,
C_FAIL,
C_NEGATE
};
typedef struct {
const char *name;
int val;
} namevalue_t;
int binsearch_keyword(const char *name, int len, const namevalue_t dic[], int range);
int lookup_const(const char *name, int len);
const char *const_name(int c); /* Added by Paul Rombouts */
#endif
/* debug.c - Various debugging facilities
* Copyright (C) 2001 Thomas Moestl
*
* This file is part of the pdnsd package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include "helpers.h"
#include "error.h"
/*
* This is indeed very primitive (it does not track allocation failures
* and so on). It should be expanded some time.
*/
#ifdef ALLOC_DEBUG
void *DBGcalloc(size_t n, size_t sz, char *file, int line)
{
DEBUG_MSG("+ calloc, %s:%d\n", file, line);
return calloc(n, sz);
}
void *DBGmalloc(size_t sz, char *file, int line)
{
DEBUG_MSG("+ malloc, %s:%d\n", file, line);
return malloc(sz);
}
void *DBGrealloc(void *ptr, size_t sz, char *file, int line)
{
if (ptr == NULL && sz != 0)
DEBUG_MSG("+ realloc, %s:%d\n", file, line);
if (ptr != NULL && sz == 0)
DEBUG_MSG("- realloc(0), %s:%d\n", file, line);
return realloc(ptr, sz);
}
void DBGfree(void *ptr, char *file, int line)
{
DEBUG_MSG("- free, %s:%d\n", file, line);
free(ptr);
}
#endif
/* debug.h - Various debugging facilities
* Copyright (C) 2001 Thomas Moestl
*
* This file is part of the pdnsd package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DEBUG_H
#define DEBUG_H
/*
* A hand-rolled alloc debug factility, because most available libraries have
* problems with at least one thread implementation.
*/
#ifdef ALLOC_DEBUG
void *DBGcalloc(size_t n, size_t sz, char *file, int line);
void *DBGmalloc(size_t sz, char *file, int line);
void *DBGrealloc(void *ptr, size_t sz, char *file, int line);
void DBGfree(void *ptr, char *file, int line);
#define pdnsd_calloc(n,sz) DBGcalloc(n,sz,__FILE__,__LINE__)
#define pdnsd_malloc(sz) DBGmalloc(sz,__FILE__,__LINE__)
#define pdnsd_realloc(ptr,sz) DBGrealloc(ptr,sz,__FILE__,__LINE__)
#define pdnsd_free(ptr) DBGfree(ptr,__FILE__,__LINE__)
#else
#define pdnsd_calloc calloc
#define pdnsd_malloc malloc
#define pdnsd_realloc realloc
#define pdnsd_free free
#endif
#endif /* def DEBUG_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# TODO: write an install rule for the Slackware start-up script.
install-exec-local:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment