diff --git a/CHANGELOG b/CHANGELOG index 89209d5..d857065 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,107 @@ +version 2.52 + Work around a Linux kernel bug which insists that the + length of the option passed to setsockopt must be at least + sizeof(int) bytes, even if we're calling SO_BINDTODEVICE + and the device name is "lo". Note that this is fixed + in kernel 2.6.31, but the workaround is harmless and + allows earlier kernels to be used. Also fix dnsmasq + bug which reported the wrong address when this failed. + Thanks to Fedor for finding this. + + The API for IPv6 PKTINFO changed around Linux kernel + 2.6.14. Workaround the case where dnsmasq is compiled + against newer headers, but then run on an old kernel: + necessary for some *WRT distros. + + Re-read the set of network interfaces when re-loading + /etc/resolv.conf if --bind-interfaces is not set. This + handles the case that loopback interfaces do not exist + when dnsmasq is first started. + + Tweak the PXE code to support port 4011. This should + reduce broadcasts and make things more reliable when other + servers are around. It also improves inter-operability + with certain clients. + + Make a pxe-service configuration with no filename or boot + service type legal: this does a local boot. eg. + pxe-service=x86PC, "Local boot" + + Be more conservative in detecting "A for A" + queries. Dnsmasq checks if the name in a type=A query looks + like a dotted-quad IP address and answers the query itself + if so, rather than forwarding it. Previously dnsmasq + relied in the library function inet_addr() to convert + addresses, and that will accept some things which are + confusing in this context, like 1.2.3 or even just + 1234. Now we only do A for A processing for four decimal + numbers delimited by dots. + + A couple of tweaks to fix compilation on Solaris. Thanks + to Joel Macklow for help with this. + + Another Solaris compilation tweak, needed for Solaris + 2009.06. Thanks to Lee Essen for that. + + Added extract packaging stuff from Lee Essen to + contrib/Solaris10. + + Increased the default limit on number of leases to 1000 + (from 150). This is mainly a defence against DoS attacks, + and for the average "one for two class C networks" + installation, IP address exhaustion does that just as + well. Making the limit greater than the number of IP + addresses available in such an installation removes a + surprise which otherwise can catch people out. + + Removed extraneous trailing space in the value of the + DNSMASQ_TIME_REMAINING DNSMASQ_LEASE_LENGTH and + DNSMASQ_LEASE_EXPIRES environment variables. Thanks to + Gildas Le Nadan for spotting this. + + Provide the network-id tags for a DHCP transaction to + the lease-change script in the environment variable + DNSMASQ_TAGS. A good suggestion from Gildas Le Nadan. + + Add support for RFC3925 "Vendor-Identifying Vendor + Options". The syntax looks like this: + --dhcp-option=vi-encap:, ......... + + Add support to --dhcp-match to allow matching against + RFC3925 "Vendor-Identifying Vendor Classes". The syntax + looks like this: + --dhcp-match=tag,vi-encap, + + Add some application specific code to assist in + implementing the Broadband forum TR069 CPE-WAN + specification. The details are in contrib/CPE-WAN/README + + Increase the default DNS packet size limit to 4096, as + recommended by RFC5625 section 4.4.3. This can be + reconfigured using --edns-packet-max if needed. Thanks to + Francis Dupont for pointing this out. + + Rewrite query-ids even for DNSSEC signed packets, since + this is allowed by RFC5625 section 4.5. + + Use getopt_long by default on OS X. It has been supported + since version 10.3.0. Thanks to Arek Dreyer for spotting + this. + + Added up-to-date startup configuration for MacOSX/launchd + in contrib/MacOSX-launchd. Thanks to Arek Dreyer for + providing this. + + Fix link error when including Dbus but excluding DHCP. + Thanks to Oschtan for the bug report. + + Updated French translation. Thanks to Gildas Le Nadan. + + Updated Polish translation. Thanks to Jan Psota. + + Updated Spanish translation. Thanks to Chris Chatham. + + version 2.51 Add support for internationalised DNS. Non-ASCII characters in domain names found in /etc/hosts, /etc/ethers and diff --git a/Makefile b/Makefile index 3d07c24..49acbc3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# dnsmasq is Copyright (c) 2000-2009 Simon Kelley +# dnsmasq is Copyright (c) 2000-2010 Simon Kelley # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,29 +18,33 @@ BINDIR = ${PREFIX}/sbin MANDIR = ${PREFIX}/share/man LOCALEDIR = ${PREFIX}/share/locale -SRC = src -PO = po -MAN = man - PKG_CONFIG = pkg-config INSTALL = install MSGMERGE = msgmerge MSGFMT = msgfmt XGETTEXT = xgettext +CFLAGS = -Wall -W -O2 + ################################################################# +SRC = src +PO = po +MAN = man + DNSMASQ_CFLAGS=`echo $(COPTS) | ../bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1` DNSMASQ_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1` SUNOS_LIBS= `if uname | grep SunOS 2>&1 >/dev/null; then echo -lsocket -lnsl -lposix4; fi` -all : dnsmasq +OBJS = cache.o rfc1035.o util.o option.o forward.o network.o \ + dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \ + helper.o tftp.o log.o -dnsmasq : +all : @cd $(SRC) && $(MAKE) \ - DNSMASQ_CFLAGS="$(DNSMASQ_CFLAGS)" \ - DNSMASQ_LIBS="$(DNSMASQ_LIBS) $(SUNOS_LIBS)" \ - -f ../bld/Makefile dnsmasq + BUILD_CFLAGS="$(DNSMASQ_CFLAGS)" \ + BUILD_LIBS="$(DNSMASQ_LIBS) $(SUNOS_LIBS)" \ + -f ../Makefile dnsmasq clean : rm -f *~ $(SRC)/*.mo contrib/*/*~ */*~ $(SRC)/*.pot @@ -56,13 +60,12 @@ install-common : all-i18n : @cd $(SRC) && $(MAKE) \ I18N=-DLOCALEDIR='\"$(LOCALEDIR)\"' \ - DNSMASQ_CFLAGS="$(DNSMASQ_CFLAGS) `$(PKG_CONFIG) --cflags libidn`" \ - DNSMASQ_LIBS="$(DNSMASQ_LIBS) $(SUNOS_LIBS) `$(PKG_CONFIG) --libs libidn`" \ - -f ../bld/Makefile dnsmasq + BUILD_CFLAGS="$(DNSMASQ_CFLAGS) `$(PKG_CONFIG) --cflags libidn`" \ + BUILD_LIBS="$(DNSMASQ_LIBS) $(SUNOS_LIBS) `$(PKG_CONFIG) --libs libidn`" \ + -f ../Makefile dnsmasq @cd $(PO); for f in *.po; do \ cd ../$(SRC) && $(MAKE) \ - MSGMERGE=$(MSGMERGE) MSGFMT=$(MSGFMT) XGETTEXT=$(XGETTEXT) \ - -f ../bld/Makefile $${f%.po}.mo; \ + -f ../Makefile $${f%.po}.mo; \ done install-i18n : all-i18n install-common @@ -70,9 +73,25 @@ install-i18n : all-i18n install-common cd $(MAN); ../bld/install-man $(DESTDIR)$(MANDIR) $(INSTALL) merge : - @cd $(SRC) && $(MAKE) XGETTEXT=$(XGETTEXT) -f ../bld/Makefile dnsmasq.pot + @cd $(SRC) && $(MAKE) -f ../Makefile dnsmasq.pot @cd $(PO); for f in *.po; do \ echo -n msgmerge $$f && $(MSGMERGE) --no-wrap -U $$f ../$(SRC)/dnsmasq.pot; \ done +# rules below are targets in recusive makes with cwd=$(SRC) + +.c.o: + $(CC) $(CFLAGS) $(COPTS) $(I18N) $(BUILD_CFLAGS) $(RPM_OPT_FLAGS) -c $< + +dnsmasq : $(OBJS) + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(BUILD_LIBS) $(LIBS) + +dnsmasq.pot : $(OBJS:.o=.c) dnsmasq.h config.h + $(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(OBJS:.o=.c) + +%.mo : ../po/%.po dnsmasq.pot + $(MSGMERGE) -o - ../po/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo - + + +.PHONY : all clean install install-common all-i18n install-i18n merge diff --git a/bld/Makefile b/bld/Makefile deleted file mode 100644 index 53dab34..0000000 --- a/bld/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CFLAGS = -Wall -W -O2 - -OBJS = cache.o rfc1035.o util.o option.o forward.o network.o \ - dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \ - helper.o tftp.o log.o - -.c.o: - $(CC) $(CFLAGS) $(COPTS) $(I18N) $(DNSMASQ_CFLAGS) $(RPM_OPT_FLAGS) -c $< - -dnsmasq : $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(DNSMASQ_LIBS) $(LIBS) - -dnsmasq.pot : $(OBJS:.o=.c) dnsmasq.h config.h - $(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(OBJS:.o=.c) - -%.mo : ../po/%.po dnsmasq.pot - $(MSGMERGE) -o - ../po/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo - diff --git a/contrib/CPE-WAN/README b/contrib/CPE-WAN/README new file mode 100644 index 0000000..4d56347 --- /dev/null +++ b/contrib/CPE-WAN/README @@ -0,0 +1,36 @@ +Dnsmasq from version 2.52 has a couple of rather application-specific +features designed to allow for implementation of the DHCP part of CPE +WAN management protocol. + +http://www.broadband-forum.org/technical/download/TR-069_Amendment-2.pdf +http://en.wikipedia.org/wiki/TR-069 + +The relevant sections are F.2.1 "Gateway Requirements" and F.2.5 "DHCP +Vendor Options". + +First, dnsmasq checks for DHCP requests which contain an option-125 +vendor-class option which in turn holds a vendor section for IANA +enterprise number 3561 which contains sub-options codes 1 and 2. If +this is present then the network-tag "cpewan-id" is set. +This allows dnsmasq to be configured to reply with the correct +GatewayManufacturerOUI, GatewaySerialNumber and GatewayProductClass like this: + +dhcp-option=cpewan-id,vi-encap:3561,4,"" +dhcp-option=cpewan-id,vi-encap:3561,5,"" +dhcp-option=cpewan-id,vi-encap:3561,6,"" + +Second, the received sub-options 1, 2, and 3 are passed to the DHCP +lease-change script as the environment variables DNSMASQ_CPEWAN_OUI, +DNSMASQ_CPEWAN_SERIAL, and DNSMASQ_CPEWAN_CLASS respectively. This allows +the script to be used to maintain a ManageableDevice table as +specified in F.2.1. Note that this data is not retained in dnsmasq's +internal DHCP lease database, so it is not available on every call to +the script (this is the same as some other data such as vendor and +user classes). It will however be available for at least the "add" +call, and should be stored then against the IP address as primary +key for future use. + + +This feature was added to dnsmasq under sponsorship from Ericsson. + + diff --git a/contrib/MacOSX-launchd/launchd-README.txt b/contrib/MacOSX-launchd/launchd-README.txt new file mode 100644 index 0000000..4783221 --- /dev/null +++ b/contrib/MacOSX-launchd/launchd-README.txt @@ -0,0 +1,38 @@ +This is a launchd item for Mac OS X and Mac OS X Server. +For more information about launchd, the +"System wide and per-user daemon/agent manager", see the launchd +man page, or the wikipedia page: http://en.wikipedia.org/wiki/Launchd + +This launchd item uses the following flags: +--keep-in-foreground - this is crucial for use with launchd +--log-queries - this is optional and you can remove it +--log-facility=/var/log/dnsmasq.log - again optional instead of system.log + +To use this launchd item for dnsmasq: + +If you don't already have a folder /Library/LaunchDaemons, then create one: +sudo mkdir /Library/LaunchDaemons +sudo chown root:admin /Library/LaunchDaemons +sudo chmod 775 /Library/LaunchDaemons + +Copy uk.org.thekelleys.dnsmasq.plist there and then set ownership/permissions: +sudo cp uk.org.thekelleys.dnsmasq.plist /Library/LaunchDaemons/ +sudo chown root:admin /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist +sudo chmod 644 /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist + +Optionally, edit your dnsmasq configuration file to your liking. + +To start the launchd job, which starts dnsmaq, reboot or use the command: +sudo launchctl load /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist + +To stop the launchd job, which stops dnsmasq, use the command: +sudo launchctl unload /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist + +If you want to permanently stop the launchd job, so it doesn't start the job even after a reboot, use the following command: +sudo launchctl unload -w /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist + +If you make a change to the configuration file, you should relaunch dnsmasq; +to do this unload and then load again: + +sudo launchctl unload /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist +sudo launchctl load /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist diff --git a/contrib/MacOSX-launchd/uk.org.thekelleys.dnsmasq.plist b/contrib/MacOSX-launchd/uk.org.thekelleys.dnsmasq.plist new file mode 100644 index 0000000..fa99176 --- /dev/null +++ b/contrib/MacOSX-launchd/uk.org.thekelleys.dnsmasq.plist @@ -0,0 +1,17 @@ + + + + + Label + uk.org.thekelleys.dnsmasq + ProgramArguments + + /usr/local/sbin/dnsmasq + --keep-in-foreground + --log-queries + --log-facility=/var/log/dnsmasq.log + + RunAtLoad + + + diff --git a/contrib/Solaris10/README.create_package b/contrib/Solaris10/README.create_package new file mode 100644 index 0000000..676899a --- /dev/null +++ b/contrib/Solaris10/README.create_package @@ -0,0 +1,25 @@ +Ok, script attached ... seems to be working ok for me, +tried to install and remove a few times. It does the +right thing with the smf when installing, you can then +simply enable the service. Upon removal it cleans up the +files but won't clean up the services (I think until +a reboot) ... I've only started looking at the new +packages stuff in the last day or two, so I could be +missing something, but I can't find any way to force + a proper cleanup. + +It requires that you have a writable repository setup +as per the docs on the opensolaris website and it will +create a dnsmasq package (package name is a variable +in the script). The script takes a version number for +the package and assumes that it's in the contrib/Solaris10 +directory, it then works out the base tree directory +from $0. + +i.e. $ contrib/Solaris10/create_package 2.52-1 +or $ cd contrib/Solaris10; ./create_package 2.52-1 + +It's a bit more complex than it could be because I +prefer putting the daemon in /usr/sbin and the config +in /etc, so the script will actually create a new +version of the existing contrib dnsmasq.xml. diff --git a/contrib/Solaris10/create_package b/contrib/Solaris10/create_package new file mode 100644 index 0000000..fd3fc84 --- /dev/null +++ b/contrib/Solaris10/create_package @@ -0,0 +1,87 @@ +#!/bin/sh + +# +# For our package, and for the SMF script, we need to define where we +# want things to go... +# +BIN_DIR="/usr/sbin" +CONF_DIR="/etc" +MAN_DIR="/usr/man/man8" + +PACKAGE_NAME="dnsmasq" + +# +# Since we know we are in the contrib directory we can work out where +# the rest of the tree is... +# +BASEDIR="`dirname $0`/../.." + +# +# We need a version number to use for the package creation... +# +if [ $# != 1 ]; then + echo "Usage: $0 " >&2 + exit 1 +fi +VERSION="$1" + +# +# First thing we do is fix-up the smf file to use the paths we prefer... +# +if [ ! -f "${BASEDIR}/contrib/Solaris10/dnsmasq.xml" ]; then + echo "$0: unable to find contrib/Solaris10/dnsmasq.xml" >&2 + exit 1 +fi + +echo "Fixing up smf file ... \c" +cat "${BASEDIR}/contrib/Solaris10/dnsmasq.xml" | \ + sed -e "s%/usr/local/etc%${CONF_DIR}%" \ + -e "s%/usr/local/sbin%${BIN_DIR}%" \ + -e "s%/usr/local/man%${MAN_DIR}%" > ${BASEDIR}/contrib/Solaris10/dnsmasq-pkg.xml +echo "done." + +echo "Creating packaging file ... \c" +cat <${BASEDIR}/contrib/Solaris10/dnsmasq_package.inc +# +# header +# +set name=pkg.name value="dnsmasq" +set name=pkg.description value="dnsmasq daemon - dns, dhcp, tftp etc" +set name=pkg.detailed_url value="http://www.thekelleys.org.uk/dnsmasq/doc.html" +set name=info.maintainer value="TBD (tbd@tbd.com)" +set name=info.upstream value="dnsmasq-discuss@lists.thekelleys.org.uk" +set name=info.upstream_url value="http://www.thekelleys.org.uk/dnsmasq/doc.html" +# +# dependencies ... none? +# + +# +# directories +# +dir mode=0755 owner=root group=bin path=${BIN_DIR}/ +dir mode=0755 owner=root group=sys path=${CONF_DIR}/ +dir mode=0755 owner=root group=sys path=${MAN_DIR}/ +dir mode=0755 owner=root group=sys path=/var/ +dir mode=0755 owner=root group=sys path=/var/svc +dir mode=0755 owner=root group=sys path=/var/svc/manifest +dir mode=0755 owner=root group=sys path=/var/svc/manifest/network + +# +# files +# +file ${BASEDIR}/src/dnsmasq mode=0555 owner=root group=bin path=${BIN_DIR}/dnsmasq +file ${BASEDIR}/man/dnsmasq.8 mode=0555 owner=root group=bin path=${MAN_DIR}/dnsmasq.8 +file ${BASEDIR}/dnsmasq.conf.example mode=0644 owner=root group=sys path=${CONF_DIR}/dnsmasq.conf preserve=strawberry +file ${BASEDIR}/contrib/Solaris10/dnsmasq-pkg.xml mode=0644 owner=root group=sys path=/var/svc/manifest/network/dnsmasq.xml restart_fmri=svc:/system/manifest-import:default + +EOF +echo "done." + +echo "Creating package..." +eval `pkgsend open ${PACKAGE_NAME}@${VERSION}` +pkgsend include ${BASEDIR}/contrib/Solaris10/dnsmasq_package.inc +if [ "$?" = 0 ]; then + pkgsend close +else + echo "Errors" +fi diff --git a/contrib/dnsmasq_MacOSX/DNSmasq b/contrib/dnsmasq_MacOSX-pre10.4/DNSmasq similarity index 100% rename from contrib/dnsmasq_MacOSX/DNSmasq rename to contrib/dnsmasq_MacOSX-pre10.4/DNSmasq diff --git a/contrib/dnsmasq_MacOSX/README.rtf b/contrib/dnsmasq_MacOSX-pre10.4/README.rtf similarity index 100% rename from contrib/dnsmasq_MacOSX/README.rtf rename to contrib/dnsmasq_MacOSX-pre10.4/README.rtf diff --git a/contrib/dnsmasq_MacOSX/StartupParameters.plist b/contrib/dnsmasq_MacOSX-pre10.4/StartupParameters.plist similarity index 100% rename from contrib/dnsmasq_MacOSX/StartupParameters.plist rename to contrib/dnsmasq_MacOSX-pre10.4/StartupParameters.plist diff --git a/dnsmasq.conf.example b/dnsmasq.conf.example index ac9ef7a..9540560 100644 --- a/dnsmasq.conf.example +++ b/dnsmasq.conf.example @@ -365,7 +365,7 @@ #pxe-prompt="Press F8 for menu.", 60 # Available boot services. for PXE. -#pxe-service=x86PC, "Boot from local disk", 0 +#pxe-service=x86PC, "Boot from local disk" # Loads /pxelinux.0 from dnsmasq TFTP server. #pxe-service=x86PC, "Install Linux", pxelinux diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 index a5eac63..6ed8a0d 100644 --- a/man/dnsmasq.8 +++ b/man/dnsmasq.8 @@ -123,8 +123,7 @@ to zero completely disables DNS function, leaving only DHCP and/or TFTP. .TP .B \-P, --edns-packet-max= Specify the largest EDNS.0 UDP packet which is supported by the DNS -forwarder. Defaults to 1280, which is the RFC2671-recommended maximum -for ethernet. +forwarder. Defaults to 4096, which is the RFC5625-recommended size. .TP .B \-Q, --query-port= Send outbound DNS queries from, and listen for their replies on, the @@ -427,7 +426,7 @@ Set the maximum number of concurrent DNS queries. The default value is where this needs to be increased is when using web-server log file resolvers, which can generate large numbers of concurrent queries. .TP -.B \-F, --dhcp-range=[[net:]network-id,],[[,],][,] +.B \-F, --dhcp-range=[[net:]network-id,],[,[,]][,] Enable the DHCP server. Addresses will be given out from the range to and from statically defined addresses given in @@ -564,7 +563,7 @@ have exactly the same effect as options containing the same information. /etc/ethers is re-read when dnsmasq receives SIGHUP. .TP -.B \-O, --dhcp-option=[,[,]][encap:,][vendor:[],][|option:],[[,]] +.B \-O, --dhcp-option=[,[,]][encap:,][vi-encap:,][vendor:[],][|option:],[[,]] Specify different or extra options to DHCP clients. By default, dnsmasq sends some standard options to DHCP clients, the netmask and broadcast address are set to the same as the host running dnsmasq, and @@ -632,10 +631,16 @@ options are given which are encapsulated with the same option number then they will be correctly combined into one encapsulated option. encap: and vendor: are may not both be set in the same dhcp-option. +The final variant on encapsulated options is "Vendor-Identifying +Vendor Options" as specified by RFC3925. These are denoted like this: +.B --dhcp-option=vi-encap:2, 10, "text" +The number in the vi-encap: section is the IANA enterprise number +used to identify this option. + The address 0.0.0.0 is not treated specially in encapsulated options. .TP -.B --dhcp-option-force=[,[,]][encap:,][vendor:[],],[[,]] +.B --dhcp-option-force=[,[,]][encap:,][vi-encap:,][vendor:[],],[[,]] This works in exactly the same way as .B --dhcp-option except that the option will always be sent, even if the client does @@ -687,7 +692,7 @@ agent ID and one provided by a relay agent, the network-id tag is set. .B --dhcp-subscrid=, Map from RFC3993 subscriber-id relay agent options to network-id tags. .TP -.B --dhcp-match=,