From 832af0bafb81e7427b062f73d0e7ece21c77a530 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Sun, 21 Jan 2007 20:01:28 +0000 Subject: [PATCH] import of dnsmasq-2.36.tar.gz --- CHANGELOG | 49 ++ FAQ | 24 +- bld/Makefile | 2 +- contrib/try-all-ns/README | 19 + .../try-all-ns/dnsmasq-2.35-try-all-ns.patch | 61 ++ dnsmasq.conf.example | 40 +- doc.html | 4 +- man/dnsmasq.8 | 80 +- po/de.po | 602 ++++++++------ po/es.po | 500 +++++++----- po/fi.po | 602 ++++++++------ po/fr.po | 500 +++++++----- po/id.po | 515 +++++++----- po/it.po | 602 ++++++++------ po/no.po | 500 +++++++----- po/pl.po | 500 +++++++----- po/pt_BR.po | 602 ++++++++------ po/ro.po | 500 +++++++----- src/cache.c | 26 +- src/config.h | 26 +- src/dhcp.c | 28 +- src/dnsmasq.c | 306 +++++--- src/dnsmasq.h | 111 ++- src/forward.c | 222 +++--- src/netlink.c | 8 + src/network.c | 102 ++- src/option.c | 742 +++++++++++------- src/rfc1035.c | 108 ++- src/rfc2131.c | 34 +- src/tftp.c | 495 ++++++++++++ src/util.c | 5 +- 31 files changed, 5064 insertions(+), 2851 deletions(-) create mode 100644 contrib/try-all-ns/README create mode 100644 contrib/try-all-ns/dnsmasq-2.35-try-all-ns.patch create mode 100644 src/tftp.c diff --git a/CHANGELOG b/CHANGELOG index 62f99f0..5a86279 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2036,5 +2036,54 @@ version 2.35 performance should be better. Thanks to "koko" for pointing out the problem. +version 2.36 + Added --dhcp-ignore-names flag which tells dnsmasq not to + use names provided by DHCP clients. Suggestion from + Thomas M Steenholdt. + Send netmask and broadcast address DHCP options always, + even if the client doesn't request them. This makes a few + odd clients work better. + + Added simple TFTP function, optimised for net-boot. It is + now possible to net boot hosts using only dnsmasq. The + TFTP server is read-only, binary-mode only, and designed to be + secure; it adds about 4K to the dnsmasq binary. + Support DHCP option 120, SIP servers, (RFC 3361). Both + encodings are supported, so both --dhcp-option=120,192.168.2.3 + and --dhcp-option=120,sip.example.net will work. Brian + Candler pointed out the need for this. + + Allow spaces in domain names, to support DNS-SD. + + Add --ptr-record flag, again for DNS-SD. Thanks to Stephan + Sokolow for the suggestion. + + Tolerate leading space on lines in the config file. Thanks + to Luigi Rizzo for pointing this out. + + Fixed netlink.c to cope with headers from the Linux 2.6.19 + kernel. Thanks to Philip Wall for the bug report. + + Added --dhcp-bridge option, but only to the FreeBSD + build. This fixes an oddity with a a particular bridged + network configuration on FreeBSD. Thanks to Luigi Rizzo + for the patch. + + Added FAQ entry about running dnsmasq in a Linux + vserver. Thanks to Gildas le Nadan for the information. + + Fixed problem with option parsing which interpreted "/" as + an address and not a string. Thanks to Luigi Rizzo + for the patch. + + Ignore the --domain-needed flag when forwarding NS + and SOA queries, since NS queries of TLDs are always legit. + Marcus Better pointed out this problem. + + Take care to forward signed DNS requests bit-perfect, so + as not to affect the validity of the signature. This + should allow DDNS updates to be forwarded. + + diff --git a/FAQ b/FAQ index 063d6fa..279b6e8 100644 --- a/FAQ +++ b/FAQ @@ -311,7 +311,7 @@ A: Because when a Gentoo box shuts down, it releases its lease with Q: My laptop has two network interfaces, a wired one and a wireless one. I never use both interfaces at the same time, and I'd like the - same IP and configuration to be used irrespcetive of which + same IP and configuration to be used irrespective of which interface is in use. How can I do that? A: By default, the identity of a machine is determined by using the @@ -393,6 +393,28 @@ A: Dnsmasq is in Suse itself, and the latest releases are also available at ftp://ftp.suse.com/pub/people/ug/ +Q: Can I run dnsmasq in a Linux vserver? + +A: Yes, as a DNS server, dnsmasq will just work in a vserver. + To use dnsmasq's DHCP function you need to give the vserver + extra system capabilities. Please note that doing so will lesser + the overall security of your system. The capabilities + required are NET_ADMIN and NET_RAW. NET_ADMIN is essential, NET_RAW + is required to do an ICMP "ping" check on newly allocated + addresses. If you don't need this check, you can disable it with + --no-ping and omit the NET_RAW capability. + Adding the capabilities is done by adding them, one per line, to + either /etc/vservers//ccapabilities for a 2.4 kernel or + /etc/vservers//bcapabilities for a 2.6 kernel (please + refer to the vserver documentation for more information). + + + + + + + + diff --git a/bld/Makefile b/bld/Makefile index 6cf3a9d..3843716 100644 --- a/bld/Makefile +++ b/bld/Makefile @@ -3,7 +3,7 @@ PKG_CONFIG ?= pkg-config OBJS = cache.o rfc1035.o util.o option.o forward.o isc.o network.o \ - dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o helper.o + dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o helper.o tftp.o .c.o: $(CC) $(CFLAGS) $(COPTS) $(I18N) `echo $(COPTS) | ../bld/pkg-wrapper $(PKG_CONFIG) --cflags dbus-1` $(RPM_OPT_FLAGS) -Wall -W -c $< diff --git a/contrib/try-all-ns/README b/contrib/try-all-ns/README new file mode 100644 index 0000000..224d554 --- /dev/null +++ b/contrib/try-all-ns/README @@ -0,0 +1,19 @@ +Date: Thu, 07 Dec 2006 00:41:43 -0500 +From: Bob Carroll +Subject: dnsmasq suggestion +To: simon@thekelleys.org.uk + + +Hello, + +I recently needed a feature in dnsmasq for a very bizarre situation. I +placed a list of name servers in a special resolve file and told dnsmasq +to use that. But I wanted it to try requests in order and treat NXDOMAIN +requests as a failed tcp connection. I wrote the feature into dnsmasq +and it seems to work. I prepared a patch in the event that others might +find it useful as well. + +Thanks and keep up the good work. + +--Bob + diff --git a/contrib/try-all-ns/dnsmasq-2.35-try-all-ns.patch b/contrib/try-all-ns/dnsmasq-2.35-try-all-ns.patch new file mode 100644 index 0000000..ec3f3e0 --- /dev/null +++ b/contrib/try-all-ns/dnsmasq-2.35-try-all-ns.patch @@ -0,0 +1,61 @@ +diff -Nau dnsmasq-2.35/src/dnsmasq.h dnsmasq/src/dnsmasq.h +--- dnsmasq-2.35/src/dnsmasq.h 2006-10-18 16:24:50.000000000 -0400 ++++ dnsmasq/src/dnsmasq.h 2006-11-16 22:06:31.000000000 -0500 +@@ -112,6 +112,7 @@ + #define OPT_NO_PING 2097152 + #define OPT_LEASE_RO 4194304 + #define OPT_RELOAD 8388608 ++#define OPT_TRY_ALL_NS 16777216 + + struct all_addr { + union { +diff -Nau dnsmasq-2.35/src/forward.c dnsmasq/src/forward.c +--- dnsmasq-2.35/src/forward.c 2006-10-18 16:24:50.000000000 -0400 ++++ dnsmasq/src/forward.c 2006-11-16 22:08:19.000000000 -0500 +@@ -445,6 +445,10 @@ + { + struct server *server = forward->sentto; + ++ // If strict-order and try-all-ns are set, treat NXDOMAIN as a failed request ++ if( (daemon->options & OPT_ORDER) && (daemon->options && OPT_TRY_ALL_NS) ++ && header->rcode == NXDOMAIN ) header->rcode = SERVFAIL; ++ + if ((header->rcode == SERVFAIL || header->rcode == REFUSED) && forward->forwardall == 0) + /* for broken servers, attempt to send to another one. */ + { +diff -Nau dnsmasq-2.35/src/option.c dnsmasq/src/option.c +--- dnsmasq-2.35/src/option.c 2006-10-18 16:24:50.000000000 -0400 ++++ dnsmasq/src/option.c 2006-11-16 22:10:36.000000000 -0500 +@@ -28,7 +28,7 @@ + + /* options which don't have a one-char version */ + #define LOPT_RELOAD 256 +- ++#define LOPT_TRY_ALL_NS 257 + + #ifdef HAVE_GETOPT_LONG + static const struct option opts[] = +@@ -102,6 +102,7 @@ + {"leasefile-ro", 0, 0, '9'}, + {"dns-forward-max", 1, 0, '0'}, + {"clear-on-reload", 0, 0, LOPT_RELOAD }, ++ {"try-all-ns", 0, 0, LOPT_TRY_ALL_NS }, + { NULL, 0, 0, 0 } + }; + +@@ -134,6 +135,7 @@ + { '5', OPT_NO_PING }, + { '9', OPT_LEASE_RO }, + { LOPT_RELOAD, OPT_RELOAD }, ++ { LOPT_TRY_ALL_NS,OPT_TRY_ALL_NS }, + { 'v', 0}, + { 'w', 0}, + { 0, 0 } +@@ -208,6 +210,7 @@ + { "-9, --leasefile-ro", gettext_noop("Read leases at startup, but never write the lease file."), NULL }, + { "-0, --dns-forward-max=", gettext_noop("Maximum number of concurrent DNS queries. (defaults to %s)"), "!" }, + { " --clear-on-reload", gettext_noop("Clear DNS cache when reloading %s."), RESOLVFILE }, ++ { " --try-all-ns", gettext_noop("Try all name servers in tandem on NXDOMAIN replies (use with strict-order)."), NULL }, + { NULL, NULL, NULL } + }; + diff --git a/dnsmasq.conf.example b/dnsmasq.conf.example index 59d6dfa..adad609 100644 --- a/dnsmasq.conf.example +++ b/dnsmasq.conf.example @@ -37,7 +37,7 @@ # If you don't want dnsmasq to read /etc/resolv.conf or any other # file, getting its servers from this file instead (see below), then -# uncomment this +# uncomment this. #no-resolv # If you don't want dnsmasq to poll /etc/resolv.conf or other resolv @@ -206,12 +206,19 @@ # subnet mask - 1 # default router - 3 # DNS server - 6 +# hostname - 12 # broadcast address - 28 # Override the default route supplied by dnsmasq, which assumes the # router is the same machine as the one running dnsmasq. #dhcp-option=3,1.2.3.4 +# Override the default route supplied by dnsmasq and send no default +# route at all. Note that this only works for the options sent by +# default (1, 3, 6, 12, 28) the same line will send a zero-length option +# for all other option numbers. +#dhcp-option=3 + # Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5 #dhcp-option=42,192.168.0.4,10.10.0.5 @@ -262,9 +269,27 @@ # mtftp address to 0.0.0.0 for PXEClients #dhcp-option=vendor:PXEClient,1,0.0.0.0 -# Set the boot filename and tftpd server name and address -# for BOOTP. You will only need this is you want to -# boot machines over the network. +# Set the boot filename for BOOTP. You will only need +# this is you want to boot machines over the network and you will need +# a TFTP server; either dnsmasq's built in TFTP server or an +# external one. (See below for how to enable the TFTP server.) +#dhcp-boot=pxelinux.0 + +# Enable dnsmasq's built-in TFTP server +#enable-tftp + +# Set the root directory for files availble via FTP. +#tftp-root=/var/ftpd + +# Make the TFTP server more secure: with this set, only files owned by +# the user dnsmasq is running as will be send over the net. +#tftp-secure + +# Set the boot file name only when the "red" tag is set. +#dhcp-boot=net:red,pxelinux.red-net + +# An example of dhcp-boot with an external server: the name and IP +# address of the server are given after the filename. #dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3 # Set the limit on DHCP leases, the default is 150 @@ -363,6 +388,11 @@ # example.com #srv-host=_ldap._tcp.example.com +# The following line shows how to make dnsmasq serve an arbitrary PTR +# record. This is useful for DNS-SD. (Note that the +# domain-name expansion done for SRV records _does_not +# occur for PTR records.) +#ptr-record=_http._tcp.dns-sd-services,"New Employee Page._http._tcp.dns-sd-services" # Change the following lines to enable dnsmasq to serve TXT records. # These are used for things like SPF and zeroconf. (Note that the @@ -370,7 +400,7 @@ # occur for TXT records.) #Example SPF. -#txt-record=example.com,v=spf1 a -all +#txt-record=example.com,"v=spf1 a -all" #Example zeroconf #txt-record=_http._tcp.example.com,name=value,paper=A4 diff --git a/doc.html b/doc.html index 1536209..4d9c3c6 100644 --- a/doc.html +++ b/doc.html @@ -11,7 +11,7 @@ Dnsmasq is a lightweight, easy to configure DNS forwarder and DHCP server and allows machines with DHCP-allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic - DHCP leases and BOOTP for network booting of diskless machines. + DHCP leases and BOOTP/TFTP for network booting of diskless machines.

Dnsmasq is targeted at home networks using NAT and connected to the internet via a modem, cable-modem or ADSL @@ -83,7 +83,7 @@ for any or all local machines. Download dnsmasq here. The tarball includes this documentation, source, and manpage. -There is also a CHANGELOG. +There is also a CHANGELOG and a FAQ. Dnsmasq is part of the Debian distribution, it can be downloaded from here or installed using apt. diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 index 4841e25..d5ded1f 100644 --- a/man/dnsmasq.8 +++ b/man/dnsmasq.8 @@ -24,7 +24,7 @@ Dnsmasq supports IPv6. .SH OPTIONS Note that in general missing parameters are allowed and switch off -functions, for instance "--pid-file=" disables writing a PID file. On +functions, for instance "--pid-file" disables writing a PID file. On BSD, unless the GNU getopt library is linked, the long form of the options does not work on the command line; it is still recognised in the configuration file. @@ -37,6 +37,10 @@ Additional hosts file. Read the specified file as well as /etc/hosts. If -h is g only the specified file. This option may be repeated for more than one additional hosts file. .TP +.B \-E, --expand-hosts +Add the domain to simple names (without a period) in /etc/hosts +in the same way as for DHCP-derived names. +.TP .B \-T, --local-ttl=