Commit 28866e95 authored by Simon Kelley's avatar Simon Kelley

import of dnsmasq-2.56.tar.gz

parent c52e1897
version 2.56
Add a patch to allow dnsmasq to get interface names right in a
Solaris zone. Thanks to Dj Padzensky for this.
Improve data-type parsing heuristics so that
--dhcp-option=option:domain-search,.
treats the value as a string and not an IP address.
Thanks to Clemens Fischer for spotting that.
Add IPv6 support to the TFTP server. Many thanks to Jan
'RedBully' Seiffert for the patches.
Log DNS queries at level LOG_INFO, rather then
LOG_DEBUG. This makes things consistent with DHCP
logging. Thanks to Adam Pribyl for spotting the problem.
Ensure that dnsmasq terminates cleanly when using
--syslog-async even if it cannot make a connection to the
syslogd.
Add --add-mac option. This is to support currently
experimental DNS filtering facilities. Thanks to Benjamin
Petrin for the orignal patch.
Fix bug which meant that tags were ignored in dhcp-range
configuration specifying PXE-proxy service. Thanks to
Cristiano Cumer for spotting this.
Raise an error if there is extra junk, not part of an
option, on the command line.
Flag a couple of log messages in cache.c as coming from
the DHCP subsystem. Thanks to Olaf Westrik for the patch.
Omit timestamps from logs when a) logging to stderr and
b) --keep-in-forground is set. The logging facility on the
other end of stderr can be assumned to supply them. Thanks
to John Hallam for the patch.
Don't complain about strings longer than 255 characters in
--txt-record, just split the long strings into 255
character chunks instead.
Fix crash on double-free. This bug can only happen when
dhcp-script is in use and then only in rare circumstances
triggered by high DHCP transaction rate and a slow
script. Thanks to Ferenc Wagner for finding the problem.
Only log that a file has been sent by TFTP after the
transfer has completed succesfully.
A good suggestion from Ferenc Wagner: extend
the --domain option to allow this sort of thing:
--domain=thekelleys.org.uk,192.168.0.0/24,local
which automatically creates
--local=/thekelleys.org.uk/
--local=/0.168.192.in-addr.arpa/
Tighten up syntax checking of hex contants in the config
file. Thanks to Fred Damen for spotting this.
Add dnsmasq logo/icon, contributed by Justin Swift. Many
thanks for that.
Never cache DNS replies which have the 'cd' bit set, or
which result from queries forwarded with the 'cd' bit
set. The 'cd' bit instructs a DNSSEC validating server
upstream to ignore signature failures and return replies
anyway. Without this change it's possible to pollute the
dnsmasq cache with bad data by making a query with the
'cd' bit set and subsequent queries would return this data
without its being marked as suspect. Thanks to Anders
Kaseorg for pointing out this problem.
Add --proxy-dnssec flag, for compliance with RFC
4035. Dnsmasq will now clear the 'ad' bit in answers returned
from upstream validating nameservers unless this option is
set.
Allow a filename of "-" for --conf-file to read
stdin. Suggestion from Timothy Redaelli.
Rotate the order of SRV records in replies, to provide
round-robin load balancing when all the priorities are
equal. Thanks to Peter McKinney for the suggestion.
Edit
contrib/MacOSX-launchd/uk.org.thekelleys.dnsmasq.plist
so that it doesn't log all queries to a file by
default. Thanks again to Peter McKinney.
By default, setting an IPv4 address for a domain but not
an IPv6 address causes dnsmasq to return
an NODATA reply for IPv6 (or vice-versa). So
--address=/google.com/1.2.3.4 stops IPv6 queries for
*google.com from being forwarded. Make it possible to
override this behaviour by defining the sematics if the
same domain appears in both --server and --address.
In that case, the --address has priority for the address
family in which is appears, but the --server has priority
of the address family which doesn't appear in --adddress
So:
--address=/google.com/1.2.3.4
--server=/google.com/#
will return 1.2.3.4 for IPv4 queries for *.google.com but
forward IPv6 queries to the normal upstream nameserver.
Similarly when setting an IPv6 address
only this will allow forwarding of IPv4 queries. Thanks to
William for pointing out the need for this.
Allow more than one --dhcp-optsfile and --dhcp-hostsfile
and make them understand directories as arguments in the
same way as --addn-hosts. Suggestion from John Hanks.
Ignore rebinding requests for leases we don't know
about. Rebind is broadcast, so we might get to overhear a
request meant for another DHCP server. NAKing this is
wrong. Thanks to Brad D'Hondt for assistance with this.
Fix cosmetic bug which produced strange output when
dumping cache statistics with some configurations. Thanks
to Fedor Kozhevnikov for spotting this.
version 2.55
Fix crash when /etc/ethers is in use. Thanks to
Gianluigi Tiesi for finding this.
Fix crash when /etc/ethers is in use. Thanks to
Gianluigi Tiesi for finding this.
Fix crash in netlink_multicast(). Thanks to Arno Wald for
finding this one.
Fix crash in netlink_multicast(). Thanks to Arno Wald for
finding this one.
Allow the empty domain "." in dhcp domain-search (119)
options.
Allow the empty domain "." in dhcp domain-search (119)
options.
version 2.54
There is no version 2.54 to avoid confusion with 2.53,
which incorrectly identifies itself as 2.54.
There is no version 2.54 to avoid confusion with 2.53,
which incorrectly identifies itself as 2.54.
version 2.53
......
......@@ -354,7 +354,7 @@ A: Yes, from version-2.21. The support is only available running under
If a physical interface has more than one IP address or aliases
with extra IP addresses, then any dhcp-ranges corresponding to
these addresses can be used for address allocation. So if an
interface has addresses 192.168.1.0/24 and 192.68.2.0/24 and there
interface has addresses 192.168.1.0/24 and 192.168.2.0/24 and there
are DHCP ranges 192.168.1.100-192.168.1.200 and
192.168.2.100-192.168.2.200 then both ranges would be used for host
connected to the physical interface. A more typical use might be to
......@@ -413,10 +413,11 @@ A: Change your kernel configuration: either deselect CONFIG_SECURITY
_or_ select CONFIG_SECURITY_CAPABILITIES. Alternatively, you can
remove the need to set capabilities by running dnsmasq as root.
Q: Where can I get .rpms Suitable for Suse?
A: Dnsmasq is in Suse itself, and the latest releases are also
available at ftp://ftp.suse.com/pub/people/ug/
Q: Where can I get .rpms Suitable for openSUSE/SLES?
A: Dnsmasq is in openSUSE itself, and the latest releases are also
available at http://download.opensuse.org/repositories/network/
Q: Can I run dnsmasq in a Linux vserver?
......
......@@ -8,8 +8,6 @@
<array>
<string>/usr/local/sbin/dnsmasq</string>
<string>--keep-in-foreground</string>
<string>--log-queries</string>
<string>--log-facility=/var/log/dnsmasq.log</string>
</array>
<key>RunAtLoad</key>
<true/>
......
This diff is collapsed.
<HTML>
<HEAD>
<TITLE> Dnsmasq - a DNS forwarder for NAT firewalls.</TITLE>
<link rel="icon"
href="http://www.thekelleys.org.uk/dnsmasq/images/favicon.ico">
</HEAD>
<BODY BGCOLOR="WHITE">
<H1 ALIGN=center>Dnsmasq</H1>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle"><img border="0" src="http://www.thekelleys.org.uk/dnsmasq/images/icon.png" /></td>
<td align="middle" valign="middle"><h1>Dnsmasq</h1></td>
<td align="right" valign="middle"><img border="0" src="http://www.thekelleys.org.uk/dnsmasq/images/icon.png" /></td></tr>
</table>
Dnsmasq is a lightweight, easy to configure DNS forwarder and DHCP
server. It is designed to provide DNS and, optionally, DHCP, to a
small network. It can serve the names of local machines which are
......
Dnsmasq logo, contributed by Justin Clift.
The source format is Inkscape SVG vector format, which is scalable and
easy to export to other formats. For convenience I've included a 56x31
png export and a 16x16 ico suitable for use as a web favicon.
Simon Kelley, 22/10/2010
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="56"
height="31"
viewBox="0 0 56 31"
enable-background="new 0 0 72.833 46.667"
xml:space="preserve"
id="svg2"
inkscape:version="0.47 r22583"
sodipodi:docname="dnsmasq_icon.svg"
inkscape:export-filename="/x/centos_home/jc/workspace/git_repos/libvirt-media/libvirt-media/png/dnsmasq_icon.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><metadata
id="metadata27"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs25"><inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 23.3335 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="72.833 : 23.3335 : 1"
inkscape:persp3d-origin="36.4165 : 15.555667 : 1"
id="perspective4857" />
<filter
id="filter3802"
inkscape:label="filter1"
color-interpolation-filters="sRGB" /><linearGradient
inkscape:collect="always"
xlink:href="#SVGID_3_"
id="linearGradient4929"
gradientUnits="userSpaceOnUse"
x1="30.564501"
y1="-8.8144999"
x2="32.937"
y2="32.715599" />
<linearGradient
inkscape:collect="always"
xlink:href="#SVGID_3_"
id="linearGradient5798"
gradientUnits="userSpaceOnUse"
x1="30.564501"
y1="-8.8144999"
x2="32.937"
y2="32.715599" /><linearGradient
inkscape:collect="always"
xlink:href="#SVGID_3_"
id="linearGradient5812"
gradientUnits="userSpaceOnUse"
x1="30.564501"
y1="-8.8144999"
x2="32.937"
y2="32.715599" /><filter
id="filter6262"
inkscape:label="Drop shadow"
width="1.5"
height="1.5"
x="-0.25"
y="-0.25"
color-interpolation-filters="sRGB"><feGaussianBlur
id="feGaussianBlur6264"
in="SourceAlpha"
stdDeviation="2.500000"
result="blur" /><feColorMatrix
id="feColorMatrix6266"
result="bluralpha"
type="matrix"
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.500000 0 " /><feOffset
id="feOffset6268"
in="bluralpha"
dx="2.700000"
dy="2.600000"
result="offsetBlur" /><feMerge
id="feMerge6270"><feMergeNode
id="feMergeNode6272"
in="offsetBlur" /><feMergeNode
id="feMergeNode6274"
in="SourceGraphic" /></feMerge></filter></defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1568"
inkscape:window-height="1076"
id="namedview23"
showgrid="false"
inkscape:zoom="8"
inkscape:cx="31.966768"
inkscape:cy="21.211869"
inkscape:window-x="567"
inkscape:window-y="328"
inkscape:window-maximized="0"
inkscape:current-layer="layer1"
inkscape:showpageshadow="false"
showborder="true" />
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="dnsmasq"
style="display:inline"
transform="translate(5.2838057,-15.545371)"><g
id="g3790"
transform="matrix(0.8183832,0,0,0.8183832,65.304897,9.8747678)"
style="filter:url(#filter6262)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><g
transform="translate(-91.018462,1.0687099)"
id="g9">
<path
style="fill:#6700ad"
inkscape:connector-curvature="0"
id="path11"
d="M 54.997,12.151 C 50.083,9.132 43.29,7.266 35.791,7.266 c -7.5,0 -14.29,1.866 -19.204,4.885 -4.915,3.016 -7.956,7.184 -7.956,11.789 0,4.604 3.041,8.772 7.956,11.788 4.914,3.02 11.704,-4.271 19.204,-4.271 7.499,0 14.292,7.291 19.206,4.271 4.914,-3.016 7.955,-7.185 7.955,-11.788 0,-4.606 -3.041,-8.773 -7.955,-11.789 z M 24.996,24.318 c -2.698,0 -4.885,-0.922 -4.885,-2.061 0,-1.14 2.187,-2.063 4.885,-2.063 2.697,0 4.885,0.924 4.885,2.063 0,1.139 -2.188,2.061 -4.885,2.061 z m 21.501,0.191 c -2.686,0 -4.861,-0.856 -4.861,-1.912 0,-1.054 2.176,-1.911 4.861,-1.911 2.685,0 4.863,0.857 4.863,1.911 0,1.056 -2.178,1.912 -4.863,1.912 z" />
<path
style="fill:none;stroke:#ffb616;stroke-width:1.85353255"
inkscape:connector-curvature="0"
id="path13"
d="M 54.997,12.151 C 50.083,9.132 43.29,7.266 35.791,7.266 c -7.5,0 -14.29,1.866 -19.204,4.885 -4.915,3.016 -7.956,7.184 -7.956,11.789 0,4.604 3.041,8.772 7.956,11.788 4.914,3.02 11.704,-4.271 19.204,-4.271 7.499,0 14.292,7.291 19.206,4.271 4.914,-3.016 7.955,-7.185 7.955,-11.788 0,-4.606 -3.041,-8.773 -7.955,-11.789 z M 24.996,24.318 c -2.698,0 -4.885,-0.922 -4.885,-2.061 0,-1.14 2.187,-2.063 4.885,-2.063 2.697,0 4.885,0.924 4.885,2.063 0,1.139 -2.188,2.061 -4.885,2.061 z m 21.501,0.191 c -2.686,0 -4.861,-0.856 -4.861,-1.912 0,-1.054 2.176,-1.911 4.861,-1.911 2.685,0 4.863,0.857 4.863,1.911 0,1.056 -2.178,1.912 -4.863,1.912 z" />
</g><g
transform="translate(-91.018462,1.0687099)"
id="Layer_2">
<linearGradient
y2="32.715599"
x2="32.937"
y1="-8.8144999"
x1="30.564501"
gradientUnits="userSpaceOnUse"
id="SVGID_3_">
<stop
id="stop17"
style="stop-color:#FFFFFF;stop-opacity:0.73"
offset="0" />
<stop
id="stop19"
style="stop-color:#FFFFFF;stop-opacity:0"
offset="1" />
</linearGradient>
<path
inkscape:connector-curvature="0"
style="fill:url(#linearGradient5812)"
id="path21"
d="m 54.1,15.361 c -0.924,1.078 -2.782,1.265 -3.857,1.06 C 38,14.083 22.75,12.75 16.027,23.031 14.858,24.819 11.992,25.39 10.293,23.887 8.631,22.417 13.105,15.804 17.646,13.033 22.194,10.252 28.474,8.53 35.41,8.53 c 6.936,0 13.215,1.722 17.756,4.502 0.731,0.442 1.627,1.52 0.934,2.329 z" />
</g></g></g></svg>
\ No newline at end of file
......@@ -23,7 +23,7 @@ options. It includes a secure, read-only,
TFTP server to allow net/PXE boot of DHCP hosts and also supports BOOTP.
.PP
Dnsmasq
supports IPv6 for DNS, but not DHCP.
supports IPv6 for DNS and TFTP, but not DHCP.
.SH OPTIONS
Note that in general missing parameters are allowed and switch off
functions, for instance "--pid-file" disables writing a PID file. On
......@@ -415,7 +415,9 @@ all that match are returned.
.TP
.B \-Y, --txt-record=<name>[[,<text>],<text>]
Return a TXT DNS record. The value of TXT record is a set of strings,
so any number may be included, split by commas.
so any number may be included, delimited by commas; use quotes to put
commas into a string. Note that the maximum length of a single string
is 255 characters, longer strings are split into 255 character chunks.
.TP
.B --ptr-record=<name>[,<target>]
Return a PTR DNS record.
......@@ -442,6 +444,15 @@ the name. More than one name may be associated with an interface
address by repeating the flag; in that case the first instance is used
for the reverse address-to-name mapping.
.TP
.B --add-mac
Add the MAC address of the requestor to DNS queries which are
forwarded upstream. This may be used to DNS filtering by the upstream
server. The MAC address can only be added if the requestor is on the same
subnet as the dnsmasq server. Note that the mechanism used to achieve this (an EDNS0 option)
is not yet standardised, so this should be considered
experimental. Also note that exposing MAC addresses in this way may
have security and privacy implications.
.TP
.B \-c, --cache-size=<cachesize>
Set the size of dnsmasq's cache. The default is 150 names. Setting the cache size to zero disables caching.
.TP
......@@ -456,6 +467,20 @@ 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 --proxy-dnssec
A resolver on a client machine can do DNSSEC validation in two ways: it
can perform the cryptograhic operations on the reply it receives, or
it can rely on the upstream recursive nameserver to do the validation
and set a bit in the reply if it succeeds. Dnsmasq is not a DNSSEC
validator, so it cannot perform the validation role of the recursive nameserver,
but it can pass through the validation results from its own upstream
nameservers. This option enables this behaviour. You should only do
this if you trust all the configured upstream nameservers
.I and the network between you and them.
If you use the first DNSSEC mode, validating resolvers in clients,
this option is not required. Dnsmasq always returns all the data
needed for a client to do validation itself.
.TP
.B \-F, --dhcp-range=[interface:<interface>,][tag:<tag>[,tag:<tag>],][set:<tag],]<start-addr>,<end-addr>[,<netmask>[,<broadcast>]][,<lease time>]
Enable the DHCP server. Addresses will be given out from the range
<start-addr> to <end-addr> and from statically defined addresses given
......@@ -588,15 +613,17 @@ time and there is no way for dnsmasq to enforce this. It is, for instance,
useful to allocate a stable IP address to a laptop which
has both wired and wireless interfaces.
.TP
.B --dhcp-hostsfile=<file>
Read DHCP host information from the specified file. The file contains
.B --dhcp-hostsfile=<path>
Read DHCP host information from the specified file. If a directory
is given, then read all the files contained in that directory. The file contains
information about one host per line. The format of a line is the same
as text to the right of '=' in --dhcp-host. The advantage of storing DHCP host information
in this file is that it can be changed without re-starting dnsmasq:
the file will be re-read when dnsmasq receives SIGHUP.
.TP
.B --dhcp-optsfile=<file>
Read DHCP option information from the specified file. The advantage of
.B --dhcp-optsfile=<path>
Read DHCP option information from the specified file. If a directory
is given, then read all the files contained in that directory. The advantage of
using this option is the same as for --dhcp-hostsfile: the
dhcp-optsfile will be re-read when dnsmasq receives SIGHUP. Note that
it is possible to encode the information in a
......@@ -946,7 +973,8 @@ all of the following variables added.
DNSMASQ_CLIENT_ID if the host provided a client-id.
DNSMASQ_DOMAIN if the fully-qualified domain name of the host is
known, this is set to the domain part.
known, this is set to the domain part. (Note that the hostname passed
to the script as an argument is never fully-qualified.)
If the client provides vendor-class, hostname or user-class,
these are provided in DNSMASQ_VENDOR_CLASS
......@@ -1020,7 +1048,7 @@ as if they had arrived at <interface>. This option is necessary when
using "old style" bridging on BSD platforms, since
packets arrive at tap interfaces which don't have an IP address.
.TP
.B \-s, --domain=<domain>[,<address range>]
.B \-s, --domain=<domain>[,<address range>[,local]]
Specifies DNS domains for the DHCP server. Domains may be be given
unconditionally (without the IP range) or for limited IP ranges. This has two effects;
firstly it causes the DHCP server to return the domain to any hosts
......@@ -1039,11 +1067,22 @@ and have a machine whose DHCP hostname is "laptop". The IP address for that mach
.B dnsmasq
both as "laptop" and "laptop.thekelleys.org.uk". If the domain is
given as "#" then the domain is read from the first "search" directive
in /etc/resolv.conf (or equivalent). The address range can be of the form
in /etc/resolv.conf (or equivalent).
The address range can be of the form
<ip address>,<ip address> or <ip address>/<netmask> or just a single
<ip address>. See
.B --dhcp-fqdn
which can change the behaviour of dnsmasq with domains.
If the address range is given as ip-address/network-size, then a
additional flag "local" may be supplied which has the effect of adding
--local declarations for forward and reverse DNS queries. Eg.
.B --domain=thekelleys.org.uk,192.168.0.0/24,local
is identical to
.B --domain=thekelleys.org.uk,192.168.0.0/24
--local=/thekelleys.org.uk/ --local=/0.168.192.in-addr.arpa/
The network size must be 8, 16 or 24 for this to be legal.
.TP
.B --dhcp-fqdn
In the default mode, dnsmasq inserts the unqualified names of
......@@ -1123,7 +1162,8 @@ of concurrent TFTP connections is limited by the size of the port range.
.TP
.B \-C, --conf-file=<file>
Specify a different configuration file. The conf-file option is also allowed in
configuration files, to include multiple configuration files.
configuration files, to include multiple configuration files. A
filename of "-" causes dnsmasq to read configuration from stdin.
.TP
.B \-7, --conf-dir=<directory>[,<file-extension>......]
Read all the files in the given directory as configuration
......@@ -1445,6 +1485,9 @@ assume that it is the system default.
.IR /usr/local/etc/dnsmasq.conf
.IR /etc/resolv.conf
.IR /var/run/dnsmasq/resolv.conf
.IR /etc/ppp/resolv.conf
.IR /etc/dhcpc/resolv.conf
.IR /etc/hosts
......
......@@ -22,7 +22,7 @@ peut être configuré pour envoyer n'importe quel option DHCP.
Il inclut un serveur TFTP sécurisé en lecture seule permettant le démarrage via
le réseau/PXE de clients DHCP et supporte également le protocole BOOTP.
.PP
Dnsmasq supporte IPv6 pour le DNS mais pas pour le DHCP.
Dnsmasq supporte IPv6 pour le DNS et TFTP mais pas pour le DHCP.
.SH OPTIONS
Notes : Il est possible d'utiliser des options sans leur donner de paramètre.
Dans ce cas, la fonction correspondante sera désactivée. Par exemple
......@@ -491,7 +491,10 @@ retournés dans la réponse.
.B \-Y, --txt-record=<nom>[[,<texte>],<texte>]
Définit un enregistrement DNS de type TXT. La valeur de l'enregistrement TXT est
un ensemble de chaînes de caractères, donc un nombre variable de chaînes de
caractères peuvent être spécifiées, séparées par des virgules.
caractères peuvent être spécifiées, séparées par des virgules. Utilisez des
guillemets pour mettre une virgule dans une chaîne de caractères. Notez que la
longueur maximale pour une chaîne est de 255 caractères, les chaînes plus
longues étant découpées en morceaux de 255 caractères de longs.
.TP
.B --ptr-record=<nom>[,<cible>]
Définit un enregistrement DNS de type PTR.
......@@ -519,6 +522,16 @@ Plus d'un nom peut être associé à une interface donnée en répétant cette o
plusieurs fois; dans ce cas, l'enregistrement inverse pointe vers le nom fourni
dans la première instance de cette option.
.TP
.B --add-mac
Ajoute l'adresse MAC du requêteur aux requêtes DNS transmises aux serveurs
amonts. Cela peut être utilisé dans un but de filtrage DNS par les serveurs
amonts. L'adresse MAC peut uniquement être ajoutée si le requêteur est sur le
même sous-réseau que le serveur dnsmasq. Veuillez noter que le mécanisme
utilisé pour effectuer cela (une option EDNS0) n'est pas encore standardisée,
aussi cette fonctionalité doit être considérée comme expérimentale. Notez
également qu'exposer les adresses MAC de la sorte peut avoir des implications
en termes de sécurité et de vie privée.
.TP
.B \-c, --cache-size=<taille>
Définit la taille du cache de Dnsmasq. La valeur par défaut est de 150 noms.
Définir une valeur de zéro désactive le cache.
......@@ -537,6 +550,21 @@ lorsqu'un serveur web a la résolution de nom activée pour l'enregistrement de
son journal des requêtes, ce qui peut générer un nombre important de requêtes
simultanées.
.TP
.B --proxy-dnssec
Un resolveur sur une machine cliente peut effectuer la validation DNSSEC de
deux façons : il peut effectuer lui-même les opérations de chiffrements sur
la réponse reçue, ou il peut laisser le serveur récursif amont faire la
validation et positionner un drapeau dans la réponse au cas où celle-ci est
correcte. Dnsmasq n'est pas un validateur DNSSEC, aussi il ne peut effectuer
la validation comme un serveur de nom récursif, cependant il peut retransmettre
les résultats de validation de ses serveurs amonts. Cette option permet
l'activation de cette fonctionalité. Vous ne devriez utiliser cela que si vous
faites confiance aux serveurs amonts
.I ainsi que le réseau entre vous et eux.
Si vous utilisez le premier mode DNSSEC, la validation par le resolveur des
clients, cette option n'est pas requise. Dnsmasq retourne toujours toutes les
données nécessaires par un client pour effectuer la validation lui-même.
.TP
.B \-F, --dhcp-range=[interface:<interface>,][tag:<label>[,tag:<label>],][set:<label],]<adresse de début>,<adresse de fin>[,<masque de réseau>[,<broadcast>]][,<durée de bail>]
Active le serveur DHCP. Les adresses seront données dans la plage comprise entre
<adresse de début> et <adresse de fin> et à partir des adresses définies
......@@ -674,20 +702,24 @@ donné et dnsmasq n'a aucun moyen de s'assurer de cela. Cela est utile,
par exemple, pour allouer une adresse IP stable à un laptop qui
aurait à la fois une connexion filaire et sans-fil.
.TP
.B --dhcp-hostsfile=<fichier>
Lis les informations d'hôtes DHCP dans le fichier spécifié. Le fichier contient
des informations à raison d'un hôte par ligne. Le format d'une ligne est la même
que le texte fourni à la droite sur caractère "=" dans l'option
.B --dhcp-hostsfile=<chemin>
Lis les informations d'hôtes DHCP dans le fichier spécifié. Si l'argument est
un chemin vers un répertoire, lis tous les fichiers de ce répertoire. Le
fichier contient des informations à raison d'un hôte par ligne. Le format
d'une ligne est la même que le texte fourni à la droite sur caractère "=" dans
l'option
.B --dhcp-host.
L'avantage de stocker les informations sur les hôtes DHCP dans ce fichier est
que celles-ci peuvent être modifiées sans recharger Dnsmasq; le fichier sera
relu lorsque Dnsmasq reçoit un signal SIGHUP.
.TP
.B --dhcp-optsfile=<fichier>
Lis les informations relatives aux options DHCP dans le fichier spécifié.
L'intérêt d'utiliser cette option est le même que pour --dhcp-hostsfile : le
fichier spécifié sera rechargé à la réception par dnsmasq d'un signal SIGHUP.
Notez qu'il est possible d'encoder l'information via
.B --dhcp-optsfile=<chemin>
Lis les informations relatives aux options DHCP dans le fichier spécifié. Si
l'argument est un chemin vers un répertoire, lis tous les fichiers de ce
répertoire. L'intérêt d'utiliser cette option est le même que pour
--dhcp-hostsfile : le fichier spécifié sera rechargé à la réception par
dnsmasq d'un signal SIGHUP. Notez qu'il est possible d'encoder l'information
via
.B --dhcp-boot
en utilisant les noms optionnels bootfile-name, server-ip-address et
tftp-server. Ceci permet d'inclure ces options dans un fichier "dhcp-optsfile".DNSMASQ_SUPPLIED_HOSTNAME
......@@ -1074,7 +1106,8 @@ auquel se rajoute quelques unes ou toutes les variables décrites ci-dessous :
DNSMASQ_CLIENT_ID, si l'hôte a fourni un identifiant de client.
DNSMASQ_DOMAIN si le nom de domaine pleinement qualifié de l'hôte est connu, la
part relative au domaine y est stockée.
part relative au domaine y est stockée. (Notez que le nom d'hôte transmis comme
argument au script n'est jamais pleinement qualifié).
Si le client fournit une information de classe de vendeur, un nom d'hôte, ou
des classes d'utilisateur, celles-ci sont fournies dans les
......@@ -1151,7 +1184,7 @@ nécessaire lors de l'utilisation de pont ethernet "ancien mode" sur plate-forme
BSD, puisque dans ce cas les paquets arrivent sur des interfaces "tap" n'ont
pas d'adresse IP.
.TP
.B \-s, --domain=<domaine>[,<gamme d'adresses>]
.B \-s, --domain=<domaine>[,<gamme d'adresses>[,local]]
Spécifie le domaine du serveur DHCP. Le domaine peut être donné de manière
inconditionnelle (sans spécifier de gamme d'adresses IP) ou pour des gammes
d'adresses IP limitées. Cela a deux effets; tout d'abord, le
......@@ -1173,11 +1206,23 @@ et avoir une machine dont le nom DHCP serait "laptop". L'adresse IP de cette
machine sera disponible à la fois pour "laptop" et "laptop.thekelleys.org.uk".
Si la valeur fournie pour <domaine> est "#", alors le nom de domaine est
positionné à la première valeur de la directive "search" du fichier
/etc/resolv.conf (ou équivalent). La gamme d'adresses peut être de la forme
/etc/resolv.conf (ou équivalent).
La gamme d'adresses peut être de la forme
<adresse ip>,<adresse ip> ou <adresse ip>/<masque de réseau> voire une simple
<adresse ip>. Voir
.B --dhcp-fqdn
qui peut changer le comportement de dnsmasq relatif aux domaines.
Si la gamme d'adresse est fournie sous la forme
<adresse ip>/<taille de réseau>, alors le drapeau "local" peut-être rajouté
qui a pour effect d'ajouter --local-declarations aux requêtes DNS directes et
inverses. C-à-d
.B --domain=thekelleys.org.uk,192.168.0.0/24,local
est indentique à
.B --domain=thekelleys.org.uk,192.168.0.0/24
--local=/thekelleys.org.uk/ --local=/0.168.192.in-addr.arpa/
La taille de réseau doit-être de 8, 16 ou 24 pour être valide.
.TP
.B --dhcp-fqdn
Dans le mode par défaut, dnsmasq insère les noms non-qualifiés des clients
......@@ -1284,7 +1329,9 @@ est limitée par la taille de la plage de ports ainsi définie.
.B \-C, --conf-file=<fichier>
Spécifie un fichier de configuration différent. L'option "conf-file" est
également autorisée dans des fichiers de configuration, ce qui permet
l'inclusion de multiples fichiers de configuration.
l'inclusion de multiples fichiers de configuration. L'utilisation de "-" comme
nom de fichier permet la lecture par dnsmasq de sa configuration sur l'entrée standard
stdin.
.TP
.B \-7, --conf-dir=<répertoire>[,<extension de fichier>...]
Lis tous les fichiers du répertoire spécifié et les traite comme des fichiers de
......@@ -1621,6 +1668,9 @@ et assume de ce fait qu'il s'agit de la valeur par défaut du système.
.IR /etc/dnsmasq.conf
.IR /usr/local/etc/dnsmasq.conf
.IR /var/run/dnsmasq/resolv.conf
.IR /etc/ppp/resolv.conf
.IR /etc/dhcpc/resolv.conf
.IR /etc/resolv.conf
......
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.
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -28,7 +28,64 @@ static struct iovec ifreq = {
.iov_len = 0
};
int iface_enumerate(void *parm, int (*ipv4_callback)(), int (*ipv6_callback)())
#if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
#include <sys/sysctl.h>
#include <net/route.h>
#include <net/if_dl.h>
#include <netinet/if_ether.h>
int arp_enumerate(void *parm, int (*callback)())
{
int mib[6];
size_t needed;
char *next;
struct rt_msghdr *rtm;
struct sockaddr_inarp *sin2;
struct sockaddr_dl *sdl;
int rc;
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
mib[2] = 0;
mib[3] = AF_INET;
mib[4] = NET_RT_FLAGS;
#ifdef RTF_LLINFO
mib[5] = RTF_LLINFO;
#else
mib[5] = 0;
#endif
if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1 || needed == 0)
return 0;
while (1)
{
if (!expand_buf(&ifconf, needed))
return 0;
if ((rc = sysctl(mib, 6, ifconf.iov_base, &needed, NULL, 0)) == 0 ||
errno != ENOMEM)
break;
needed += needed / 8;
}
if (rc == -1)
return 0;
for (next = ifconf.iov_base ; next < (char *)ifconf.iov_base + needed; next += rtm->rtm_msglen)
{
rtm = (struct rt_msghdr *)next;
sin2 = (struct sockaddr_inarp *)(rtm + 1);
sdl = (struct sockaddr_dl *)((char *)sin2 + SA_SIZE(sin2));
if (!(*callback)(AF_INET, &sin2->sin_addr, LLADDR(sdl), sdl->sdl_alen, parm))
return 0;
}
return 1;
}
#endif
int iface_enumerate(int family, void *parm, int (*callback)())
{
char *ptr;
struct ifreq *ifr;
......@@ -37,6 +94,13 @@ int iface_enumerate(void *parm, int (*ipv4_callback)(), int (*ipv6_callback)())
int lastlen = 0;
size_t len = 0;
if (family == AF_UNSPEC)
#if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
return arp_enumerate(parm, callback);
#else
return 0; /* need code for Solaris and MacOS*/
#endif
if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) == -1)
return 0;
......@@ -83,39 +147,42 @@ int iface_enumerate(void *parm, int (*ipv4_callback)(), int (*ipv6_callback)())
ifr = (struct ifreq *)ifreq.iov_base;
memcpy(ifr, ptr, len);
if (ifr->ifr_addr.sa_family == AF_INET && ipv4_callback)
if (ifr->ifr_addr.sa_family == family)
{
struct in_addr addr, netmask, broadcast;
broadcast.s_addr = 0;
addr = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
if (ioctl(fd, SIOCGIFNETMASK, ifr) == -1)
continue;
netmask = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
if (ioctl(fd, SIOCGIFBRDADDR, ifr) != -1)
broadcast = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
if (!((*ipv4_callback)(addr,
(int)if_nametoindex(ifr->ifr_name),
netmask, broadcast,
parm)))
goto err;
}
if (family == AF_INET)
{
struct in_addr addr, netmask, broadcast;
broadcast.s_addr = 0;
addr = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
if (ioctl(fd, SIOCGIFNETMASK, ifr) == -1)
continue;
netmask = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
if (ioctl(fd, SIOCGIFBRDADDR, ifr) != -1)
broadcast = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
if (!((*callback)(addr,
(int)if_nametoindex(ifr->ifr_name),
netmask, broadcast,
parm)))
goto err;
}
#ifdef HAVE_IPV6
else if (ifr->ifr_addr.sa_family == AF_INET6 && ipv6_callback)
{
struct in6_addr *addr = &((struct sockaddr_in6 *)&ifr->ifr_addr)->sin6_addr;
/* voodoo to clear interface field in address */
if (!(daemon->options & OPT_NOWILD) && IN6_IS_ADDR_LINKLOCAL(addr))
else if (family == AF_INET6)
{
addr->s6_addr[2] = 0;
addr->s6_addr[3] = 0;
struct in6_addr *addr = &((struct sockaddr_in6 *)&ifr->ifr_addr)->sin6_addr;
/* voodoo to clear interface field in address */
if (!option_bool(OPT_NOWILD) && IN6_IS_ADDR_LINKLOCAL(addr))
{
addr->s6_addr[2] = 0;
addr->s6_addr[3] = 0;
}
if (!((*callback)(addr,
(int)((struct sockaddr_in6 *)&ifr->ifr_addr)->sin6_scope_id,
(int)if_nametoindex(ifr->ifr_name),
parm)))
goto err;
}
if (!((*ipv6_callback)(addr,
(int)((struct sockaddr_in6 *)&ifr->ifr_addr)->sin6_scope_id,
(int)if_nametoindex(ifr->ifr_name),
parm)))
goto err;
}
#endif
}
}
ret = 1;
......
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -75,7 +75,7 @@ void cache_init(void)
struct crec *crecp;
int i;
if (daemon->options & OPT_LOG)
if (option_bool(OPT_LOG))
addrbuff = safe_malloc(ADDRSTRLEN);
bignames_left = daemon->cachesize/10;
......@@ -226,7 +226,7 @@ char *cache_get_name(struct crec *crecp)
{
if (crecp->flags & F_BIGNAME)
return crecp->name.bname->name;
else if (crecp->flags & (F_DHCP | F_CONFIG))
else if (crecp->flags & F_NAMEP)
return crecp->name.namep;
return crecp->name.sname;
......@@ -366,9 +366,6 @@ struct crec *cache_insert(char *name, struct all_addr *addr,
log_query(flags | F_UPSTREAM, name, addr, NULL);
/* CONFIG bit means something else when stored in cache entries */
flags &= ~F_CONFIG;
/* if previous insertion failed give up now. */
if (insert_error)
return NULL;
......@@ -503,7 +500,7 @@ struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsi
/* first search, look for relevant entries and push to top of list
also free anything which has expired */
struct crec *next, **up, **insert = NULL, **chainp = &ans;
int ins_flags = 0;
unsigned short ins_flags = 0;
for (up = hash_bucket(name), crecp = *up; crecp; crecp = next)
{
......@@ -695,7 +692,7 @@ static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrl
if (hostname_isequal(cache->name.sname, a->target) &&
(lookup = whine_malloc(sizeof(struct crec))))
{
lookup->flags = F_FORWARD | F_IMMORTAL | F_CONFIG | F_HOSTS | F_CNAME;
lookup->flags = F_FORWARD | F_IMMORTAL | F_NAMEP | F_HOSTS | F_CNAME;
lookup->name.namep = a->alias;
lookup->addr.cname.cache = cache;
lookup->addr.cname.uid = index;
......@@ -832,7 +829,7 @@ static int read_hostsfile(char *filename, int index, int cache_size)
if ((canon = canonicalise(token, &nomem)))
{
/* If set, add a version of the name with a default domain appended */
if ((daemon->options & OPT_EXPAND) && domain_suffix && !fqdn &&
if (option_bool(OPT_EXPAND) && domain_suffix && !fqdn &&
(cache = whine_malloc(sizeof(struct crec) +
strlen(canon)+2+strlen(domain_suffix)-SMALLDNAME)))
{
......@@ -896,107 +893,17 @@ void cache_reload(void)
up = &cache->hash_next;
}
if ((daemon->options & OPT_NO_HOSTS) && !daemon->addn_hosts)
if (option_bool(OPT_NO_HOSTS) && !daemon->addn_hosts)
{
if (daemon->cachesize > 0)
my_syslog(LOG_INFO, _("cleared cache"));
return;
}
if (!(daemon->options & OPT_NO_HOSTS))
if (!option_bool(OPT_NO_HOSTS))
total_size = read_hostsfile(HOSTSFILE, 0, total_size);
for (i = 0, ah = daemon->addn_hosts; ah; ah = ah->next)
{
if (i <= ah->index)
i = ah->index + 1;
if (ah->flags & AH_DIR)
ah->flags |= AH_INACTIVE;
else
ah->flags &= ~AH_INACTIVE;
}
for (ah = daemon->addn_hosts; ah; ah = ah->next)
if (!(ah->flags & AH_INACTIVE))
{
struct stat buf;
if (stat(ah->fname, &buf) != -1 && S_ISDIR(buf.st_mode))
{
DIR *dir_stream;
struct dirent *ent;
/* don't read this as a file */
ah->flags |= AH_INACTIVE;
if (!(dir_stream = opendir(ah->fname)))
my_syslog(LOG_ERR, _("cannot access directory %s: %s"),
ah->fname, strerror(errno));
else
{
while ((ent = readdir(dir_stream)))
{
size_t lendir = strlen(ah->fname);
size_t lenfile = strlen(ent->d_name);
struct hostsfile *ah1;
char *path;
/* ignore emacs backups and dotfiles */
if (lenfile == 0 ||
ent->d_name[lenfile - 1] == '~' ||
(ent->d_name[0] == '#' && ent->d_name[lenfile - 1] == '#') ||
ent->d_name[0] == '.')
continue;
/* see if we have an existing record.
dir is ah->fname
file is ent->d_name
path to match is ah1->fname */
for (ah1 = daemon->addn_hosts; ah1; ah1 = ah1->next)
{
if (lendir < strlen(ah1->fname) &&
strstr(ah1->fname, ah->fname) == ah1->fname &&
ah1->fname[lendir] == '/' &&
strcmp(ah1->fname + lendir + 1, ent->d_name) == 0)
{
ah1->flags &= ~AH_INACTIVE;
break;
}
}
/* make new record */
if (!ah1)
{
if (!(ah1 = whine_malloc(sizeof(struct hostsfile))))
continue;
if (!(path = whine_malloc(lendir + lenfile + 2)))
{
free(ah1);
continue;
}
strcpy(path, ah->fname);
strcat(path, "/");
strcat(path, ent->d_name);
ah1->fname = path;
ah1->index = i++;
ah1->flags = AH_DIR;
ah1->next = daemon->addn_hosts;
daemon->addn_hosts = ah1;
}
/* inactivate record if not regular file */
if ((ah1->flags & AH_DIR) && stat(ah1->fname, &buf) != -1 && !S_ISREG(buf.st_mode))
ah1->flags |= AH_INACTIVE;
}
closedir(dir_stream);
}
}
}
daemon->addn_hosts = expand_filelist(daemon->addn_hosts);
for (ah = daemon->addn_hosts; ah; ah = ah->next)
if (!(ah->flags & AH_INACTIVE))
total_size = read_hostsfile(ah->fname, ah->index, total_size);
......@@ -1036,7 +943,7 @@ void cache_add_dhcp_entry(char *host_name,
struct in_addr *host_address, time_t ttd)
{
struct crec *crec = NULL, *aliasc;
unsigned short flags = F_DHCP | F_FORWARD | F_IPV4 | F_REVERSE;
unsigned short flags = F_NAMEP | F_DHCP | F_FORWARD | F_IPV4 | F_REVERSE;
int in_hosts = 0;
struct cname *a;
......@@ -1049,13 +956,13 @@ void cache_add_dhcp_entry(char *host_name,
in_hosts = 1;
if (crec->flags & F_CNAME)
my_syslog(LOG_WARNING,
my_syslog(MS_DHCP | LOG_WARNING,
_("%s is a CNAME, not giving it to the DHCP lease of %s"),
host_name, inet_ntoa(*host_address));
else if (crec->addr.addr.addr.addr4.s_addr != host_address->s_addr)
{
strcpy(daemon->namebuff, inet_ntoa(crec->addr.addr.addr.addr4));
my_syslog(LOG_WARNING,
my_syslog(MS_DHCP | LOG_WARNING,
_("not giving name %s to the DHCP lease of %s because "
"the name exists in %s with address %s"),
host_name, inet_ntoa(*host_address),
......@@ -1109,7 +1016,7 @@ void cache_add_dhcp_entry(char *host_name,
if (aliasc)
{
aliasc->flags = F_FORWARD | F_CONFIG | F_DHCP | F_CNAME;
aliasc->flags = F_FORWARD | F_NAMEP | F_DHCP | F_CNAME;
if (ttd == 0)
aliasc->flags |= F_IMMORTAL;
else
......@@ -1143,12 +1050,15 @@ void dump_cache(time_t now)
serv->flags &= ~SERV_COUNTED;
for (serv = daemon->servers; serv; serv = serv->next)
if (!(serv->flags & (SERV_NO_ADDR | SERV_LITERAL_ADDRESS | SERV_COUNTED)))
if (!(serv->flags &
(SERV_NO_ADDR | SERV_LITERAL_ADDRESS | SERV_COUNTED | SERV_USE_RESOLV | SERV_NO_REBIND)))
{
int port;
unsigned int queries = 0, failed_queries = 0;
for (serv1 = serv; serv1; serv1 = serv1->next)
if (!(serv1->flags & (SERV_NO_ADDR | SERV_LITERAL_ADDRESS | SERV_COUNTED)) && sockaddr_isequal(&serv->addr, &serv1->addr))
if (!(serv1->flags &
(SERV_NO_ADDR | SERV_LITERAL_ADDRESS | SERV_COUNTED | SERV_USE_RESOLV | SERV_NO_REBIND)) &&
sockaddr_isequal(&serv->addr, &serv1->addr))
{
serv1->flags |= SERV_COUNTED;
queries += serv1->queries;
......@@ -1158,11 +1068,11 @@ void dump_cache(time_t now)
my_syslog(LOG_INFO, _("server %s#%d: queries sent %u, retried or failed %u"), addrbuff, port, queries, failed_queries);
}
if ((daemon->options & (OPT_DEBUG | OPT_LOG)))
if (option_bool(OPT_DEBUG) || option_bool(OPT_LOG))
{
struct crec *cache ;
int i;
my_syslog(LOG_DEBUG, "Host Address Flags Expires");
my_syslog(LOG_INFO, "Host Address Flags Expires");
for (i=0; i<hash_size; i++)
for (cache = hash_table[i]; cache; cache = cache->hash_next)
......@@ -1208,7 +1118,7 @@ void dump_cache(time_t now)
/* ctime includes trailing \n - eat it */
*(p-1) = 0;
#endif
my_syslog(LOG_DEBUG, daemon->namebuff);
my_syslog(LOG_INFO, daemon->namebuff);
}
}
}
......@@ -1237,12 +1147,12 @@ void querystr(char *str, unsigned short type)
sprintf(str,"query[%s]", typestr[i].name);
}
void log_query(unsigned short flags, char *name, struct all_addr *addr, char *arg)
void log_query(unsigned int flags, char *name, struct all_addr *addr, char *arg)
{
char *source, *dest = addrbuff;
char *verb = "is";
if (!(daemon->options & OPT_LOG))
if (!option_bool(OPT_LOG))
return;
if (addr)
......@@ -1283,13 +1193,9 @@ void log_query(unsigned short flags, char *name, struct all_addr *addr, char *ar
}
}
else if (flags & F_CNAME)
{
/* nasty abuse of NXDOMAIN and CNAME flags */
if (flags & F_NXDOMAIN)
dest = arg;
else
dest = "<CNAME>";
}
dest = "<CNAME>";
else if (flags & F_RRNAME)
dest = arg;
if (flags & F_CONFIG)
source = "config";
......@@ -1315,6 +1221,6 @@ void log_query(unsigned short flags, char *name, struct all_addr *addr, char *ar
if (strlen(name) == 0)
name = ".";
my_syslog(LOG_DEBUG, "%s %s %s %s", source, name, verb, dest);
my_syslog(LOG_INFO, "%s %s %s %s", source, name, verb, dest);
}
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -14,7 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define VERSION "2.55"
#define VERSION "2.56"
#define FTABSIZ 150 /* max number of outstanding requests (default) */
#define MAX_PROCS 20 /* max no children for TCP requests */
......@@ -22,7 +22,7 @@
#define EDNS_PKTSZ 4096 /* default max EDNS.0 UDP packet from RFC5625 */
#define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */
#define FORWARD_TEST 50 /* try all servers every 50 queries */
#define FORWARD_TIME 20 /* or 10 seconds */
#define FORWARD_TIME 20 /* or 20 seconds */
#define RANDOM_SOCKS 64 /* max simultaneous random ports */
#define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */
#define CACHESIZ 150 /* default cache size */
......@@ -72,6 +72,7 @@
#define LOG_MAX 5 /* log-queue length */
#define RANDFILE "/dev/urandom"
#define DAD_WAIT 20 /* retry binding IPv6 sockets for this long */
#define EDNS0_OPTION_MAC 5 /* dyndns.org temporary assignment */
/* DBUS interface specifics */
#define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq"
......
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -54,7 +54,7 @@ static int make_fd(int port)
/* When bind-interfaces is set, there might be more than one dnmsasq
instance binding port 67. That's OK if they serve different networks.
Need to set REUSEADDR to make this posible, or REUSEPORT on *BSD. */
if (daemon->options & OPT_NOWILD)
if (option_bool(OPT_NOWILD))
{
#ifdef SO_REUSEPORT
int rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt));
......@@ -96,7 +96,7 @@ void dhcp_init(void)
we drop root. Also, set buffer size small, to avoid wasting
kernel buffers */
if (daemon->options & OPT_NO_PING)
if (option_bool(OPT_NO_PING))
daemon->dhcp_icmp_fd = -1;
else if ((daemon->dhcp_icmp_fd = make_icmp_sock()) == -1 ||
setsockopt(daemon->dhcp_icmp_fd, SOL_SOCKET, SO_RCVBUF, &oneopt, sizeof(oneopt)) == -1 )
......@@ -295,7 +295,7 @@ void dhcp_packet(time_t now, int pxe_fd)
}
}
if (!iface_enumerate(&parm, complete_context, NULL))
if (!iface_enumerate(AF_INET, &parm, complete_context))
return;
lease_prune(NULL, now); /* lose any expired leases */
iov.iov_len = dhcp_reply(parm.current, ifr.ifr_name, iface_index, (size_t)sz,
......@@ -660,7 +660,7 @@ int address_allocate(struct dhcp_context *context,
*addrp = addr;
if (daemon->options & OPT_NO_PING)
if (option_bool(OPT_NO_PING))
return 1;
/* check if we failed to ping addr sometime in the last
......
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -133,10 +133,10 @@ int main (int argc, char **argv)
#elif !(defined(IP_RECVDSTADDR) && \
defined(IP_RECVIF) && \
defined(IP_SENDSRCADDR))
if (!(daemon->options & OPT_NOWILD))
if (!option_bool(OPT_NOWILD))
{
bind_fallback = 1;
daemon->options |= OPT_NOWILD;
set_option_bool(OPT_NOWILD);
}
#endif
......@@ -168,7 +168,7 @@ int main (int argc, char **argv)
if (!enumerate_interfaces())
die(_("failed to find list of interfaces: %s"), NULL, EC_MISC);
if (daemon->options & OPT_NOWILD)
if (option_bool(OPT_NOWILD))
{
daemon->listeners = create_bound_listeners();
......@@ -183,14 +183,13 @@ int main (int argc, char **argv)
die(_("no interface with address %s"), daemon->namebuff, EC_BADNET);
}
}
else if ((daemon->port != 0 || daemon->tftp_interfaces || daemon->tftp_unlimited) &&
!(daemon->listeners = create_wildcard_listeners()))
die(_("failed to create listening socket: %s"), NULL, EC_BADNET);
else
daemon->listeners = create_wildcard_listeners();
if (daemon->port != 0)
cache_init();
if (daemon->options & OPT_DBUS)
if (option_bool(OPT_DBUS))
#ifdef HAVE_DBUS
{
char *err;
......@@ -275,7 +274,7 @@ int main (int argc, char **argv)
err_pipe[1] = -1;
if (!(daemon->options & OPT_DEBUG))
if (!option_bool(OPT_DEBUG))
{
/* The following code "daemonizes" the process.
See Stevens section 12.4 */
......@@ -284,7 +283,7 @@ int main (int argc, char **argv)
die(_("cannot chdir to filesystem root: %s"), NULL, EC_MISC);
#ifndef NO_FORK
if (!(daemon->options & OPT_NO_FORK))
if (!option_bool(OPT_NO_FORK))
{
pid_t pid;
......@@ -345,7 +344,7 @@ int main (int argc, char **argv)
log_err = log_start(ent_pw, err_pipe[1]);
if (!(daemon->options & OPT_DEBUG))
if (!option_bool(OPT_DEBUG))
{
/* open stdout etc to /dev/null */
int nullfd = open("/dev/null", O_RDWR);
......@@ -362,7 +361,7 @@ int main (int argc, char **argv)
daemon->helperfd = create_helper(pipewrite, err_pipe[1], script_uid, script_gid, max_fd);
#endif
if (!(daemon->options & OPT_DEBUG) && getuid() == 0)
if (!option_bool(OPT_DEBUG) && getuid() == 0)
{
int bad_capabilities = 0;
gid_t dummy;
......@@ -440,7 +439,7 @@ int main (int argc, char **argv)
}
#ifdef HAVE_LINUX_NETWORK
if (daemon->options & OPT_DEBUG)
if (option_bool(OPT_DEBUG))
prctl(PR_SET_DUMPABLE, 1);
#endif
......@@ -454,7 +453,7 @@ int main (int argc, char **argv)
my_syslog(LOG_INFO, _("compile time options: %s"), compile_opts);
#ifdef HAVE_DBUS
if (daemon->options & OPT_DBUS)
if (option_bool(OPT_DBUS))
{
if (daemon->dbus)
my_syslog(LOG_INFO, _("DBus support enabled: connected to system bus"));
......@@ -470,12 +469,12 @@ int main (int argc, char **argv)
if (bind_fallback)
my_syslog(LOG_WARNING, _("setting --bind-interfaces option because of OS limitations"));
if (!(daemon->options & OPT_NOWILD))
if (!option_bool(OPT_NOWILD))
for (if_tmp = daemon->if_names; if_tmp; if_tmp = if_tmp->next)
if (if_tmp->name && !if_tmp->used)
my_syslog(LOG_WARNING, _("warning: interface %s does not currently exist"), if_tmp->name);
if (daemon->port != 0 && (daemon->options & OPT_NO_RESOLV))
if (daemon->port != 0 && option_bool(OPT_NO_RESOLV))
{
if (daemon->resolv_files && !daemon->resolv_files->is_default)
my_syslog(LOG_WARNING, _("warning: ignoring resolv-file flag because no-resolv is set"));
......@@ -518,7 +517,7 @@ int main (int argc, char **argv)
my_syslog(MS_TFTP | LOG_INFO, "TFTP %s%s %s",
daemon->tftp_prefix ? _("root is ") : _("enabled"),
daemon->tftp_prefix ? daemon->tftp_prefix: "",
daemon->options & OPT_TFTP_SECURE ? _("secure mode") : "");
option_bool(OPT_TFTP_SECURE) ? _("secure mode") : "");
/* This is a guess, it assumes that for small limits,
disjoint files might be served, but for large limits,
......@@ -580,7 +579,7 @@ int main (int argc, char **argv)
/* Whilst polling for the dbus, or doing a tftp transfer, wake every quarter second */
if (daemon->tftp_trans ||
((daemon->options & OPT_DBUS) && !daemon->dbus))
(option_bool(OPT_DBUS) && !daemon->dbus))
{
t.tv_sec = 0;
t.tv_usec = 250000;
......@@ -664,7 +663,7 @@ int main (int argc, char **argv)
#ifdef HAVE_DBUS
/* if we didn't create a DBus connection, retry now. */
if ((daemon->options & OPT_DBUS) && !daemon->dbus)
if (option_bool(OPT_DBUS) && !daemon->dbus)
{
char *err;
if ((err = dbus_init()))
......@@ -801,7 +800,7 @@ static void async_event(int pipe, time_t now)
{
case EVENT_RELOAD:
clear_cache_and_reload(now);
if (daemon->port != 0 && daemon->resolv_files && (daemon->options & OPT_NO_POLL))
if (daemon->port != 0 && daemon->resolv_files && option_bool(OPT_NO_POLL))
{
reload_servers(daemon->resolv_files->name);
check_servers();
......@@ -908,7 +907,7 @@ void poll_resolv(int force, int do_reload, time_t now)
Go through and find the one which changed _last_.
Warn of any which can't be read. */
if (daemon->port == 0 || (daemon->options & OPT_NO_POLL))
if (daemon->port == 0 || option_bool(OPT_NO_POLL))
return;
for (latest = NULL, res = daemon->resolv_files; res; res = res->next)
......@@ -954,7 +953,7 @@ void poll_resolv(int force, int do_reload, time_t now)
my_syslog(LOG_INFO, _("reading %s"), latest->name);
warned = 0;
check_servers();
if ((daemon->options & OPT_RELOAD) && do_reload)
if (option_bool(OPT_RELOAD) && do_reload)
clear_cache_and_reload(now);
}
else
......@@ -977,7 +976,7 @@ void clear_cache_and_reload(time_t now)
#ifdef HAVE_DHCP
if (daemon->dhcp)
{
if (daemon->options & OPT_ETHERS)
if (option_bool(OPT_ETHERS))
dhcp_read_ethers();
reread_dhcp();
dhcp_update_configs(daemon->dhcp_conf);
......@@ -1094,7 +1093,7 @@ static void check_dns_listeners(fd_set *set, time_t now)
if (confd == -1)
continue;
if (daemon->options & OPT_NOWILD)
if (option_bool(OPT_NOWILD))
iface = listener->iface;
else
{
......@@ -1120,7 +1119,7 @@ static void check_dns_listeners(fd_set *set, time_t now)
close(confd);
}
#ifndef NO_FORK
else if (!(daemon->options & OPT_DEBUG) && (p = fork()) != 0)
else if (!option_bool(OPT_DEBUG) && (p = fork()) != 0)
{
if (p != -1)
{
......@@ -1147,7 +1146,7 @@ static void check_dns_listeners(fd_set *set, time_t now)
#ifndef NO_FORK
/* Arrange for SIGALARM after CHILD_LIFETIME seconds to
terminate the process. */
if (!(daemon->options & OPT_DEBUG))
if (!option_bool(OPT_DEBUG))
alarm(CHILD_LIFETIME);
#endif
......@@ -1179,7 +1178,7 @@ static void check_dns_listeners(fd_set *set, time_t now)
close(s->tcpfd);
}
#ifndef NO_FORK
if (!(daemon->options & OPT_DEBUG))
if (!option_bool(OPT_DEBUG))
{
flush_log();
_exit(0);
......
This diff is collapsed.
This diff is collapsed.
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -79,14 +79,14 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
sigaction(SIGTERM, &sigact, NULL);
sigaction(SIGALRM, &sigact, NULL);
if (!(daemon->options & OPT_DEBUG) && uid != 0)
if (!option_bool(OPT_DEBUG) && uid != 0)
{
gid_t dummy;
if (setgroups(0, &dummy) == -1 ||
setgid(gid) == -1 ||
setuid(uid) == -1)
{
if (daemon->options & OPT_NO_FORK)
if (option_bool(OPT_NO_FORK))
/* send error to daemon process if no-fork */
send_event(event_fd, EVENT_HUSER_ERR, errno);
else
......
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -37,7 +37,7 @@ void lease_init(time_t now)
leases_left = daemon->dhcp_max;
if (daemon->options & OPT_LEASE_RO)
if (option_bool(OPT_LEASE_RO))
{
/* run "<lease_change_script> init" once to get the
initial state of the database. If leasefile-ro is
......@@ -254,7 +254,7 @@ void lease_update_dns(void)
if (lease->fqdn)
cache_add_dhcp_entry(lease->fqdn, &lease->addr, lease->expires);
if (!(daemon->options & OPT_DHCP_FQDN) && lease->hostname)
if (!option_bool(OPT_DHCP_FQDN) && lease->hostname)
cache_add_dhcp_entry(lease->hostname, &lease->addr, lease->expires);
}
......@@ -470,7 +470,7 @@ void lease_set_hostname(struct dhcp_lease *lease, char *name, int auth)
/* Depending on mode, we check either unqualified name or FQDN. */
for (lease_tmp = leases; lease_tmp; lease_tmp = lease_tmp->next)
{
if (daemon->options & OPT_DHCP_FQDN)
if (option_bool(OPT_DHCP_FQDN))
{
if (!new_fqdn || !lease_tmp->fqdn || !hostname_isequal(lease_tmp->fqdn, new_fqdn) )
continue;
......@@ -534,7 +534,7 @@ int do_script_run(time_t now)
#ifdef HAVE_DBUS
/* If we're going to be sending DBus signals, but the connection is not yet up,
delay everything until it is. */
if ((daemon->options & OPT_DBUS) && !daemon->dbus)
if (option_bool(OPT_DBUS) && !daemon->dbus)
return 0;
#endif
......@@ -586,7 +586,7 @@ int do_script_run(time_t now)
for (lease = leases; lease; lease = lease->next)
if (lease->new || lease->changed ||
(lease->aux_changed && (daemon->options & OPT_LEASE_RO)))
(lease->aux_changed && option_bool(OPT_LEASE_RO)))
{
#ifdef HAVE_SCRIPT
queue_script(lease->new ? ACTION_ADD : ACTION_OLD, lease,
......
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -55,12 +55,12 @@ int log_start(struct passwd *ent_pw, int errfd)
{
int ret = 0;
echo_stderr = !!(daemon->options & OPT_DEBUG);
echo_stderr = option_bool(OPT_DEBUG);
if (daemon->log_fac != -1)
log_fac = daemon->log_fac;
#ifdef LOG_LOCAL0
else if (daemon->options & OPT_DEBUG)
else if (option_bool(OPT_DEBUG))
log_fac = LOG_LOCAL0;
#endif
......@@ -327,7 +327,11 @@ void my_syslog(int priority, const char *format, ...)
if (!log_to_file)
p += sprintf(p, "<%d>", priority | log_fac);
p += sprintf(p, "%.15s dnsmasq%s[%d]: ", ctime(&time_now) + 4, func, (int)pid);
/* Omit timestamp for default daemontools situation */
if (!log_stderr || !option_bool(OPT_NO_FORK))
p += sprintf(p, "%.15s ", ctime(&time_now) + 4);
p += sprintf(p, "dnsmasq%s[%d]: ", func, (int)pid);
len = p - entry->payload;
va_start(ap, format);
......@@ -398,12 +402,13 @@ void check_log_writer(fd_set *set)
void flush_log(void)
{
/* write until queue empty */
/* write until queue empty, but don't loop forever if there's
no connection to the syslog in existance */
while (log_fd != -1)
{
struct timespec waiter;
log_write();
if (!entries)
if (!entries || !connection_good)
{
close(log_fd);
break;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* dnsmasq is Copyright (c) 2000-2010 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2011 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
......@@ -365,7 +365,8 @@ void prettyprint_time(char *buf, unsigned int t)
}
/* in may equal out, when maxlen may be -1 (No max len). */
/* in may equal out, when maxlen may be -1 (No max len).
Return -1 for extraneous no-hex chars found. */
int parse_hex(char *in, unsigned char *out, int maxlen,
unsigned int *wildcard_mask, int *mac_type)
{
......@@ -377,7 +378,10 @@ int parse_hex(char *in, unsigned char *out, int maxlen,
while (maxlen == -1 || i < maxlen)
{
for (r = in; *r != 0 && *r != ':' && *r != '-'; r++);
for (r = in; *r != 0 && *r != ':' && *r != '-'; r++)
if (!isxdigit((int)*r))
return -1;
if (*r == 0)
maxlen = i;
......
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