mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-04 13:48:30 +00:00
Compare commits
74
Commits
v2.80test2
...
v2.80
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91421cb757 | ||
|
|
53792c934c | ||
|
|
df071825f2 | ||
|
|
e1791f36ea | ||
|
|
0fdf3c1f61 | ||
|
|
ee1df06aab | ||
|
|
1e87eba424 | ||
|
|
08933475ab | ||
|
|
7cbf497da4 | ||
|
|
3a610a007f | ||
|
|
48b090cb5c | ||
|
|
4139298d28 | ||
|
|
51cc10fa54 | ||
|
|
ea6cc33804 | ||
|
|
ad03967ee4 | ||
|
|
f4fd07d303 | ||
|
|
e3c08a34a7 | ||
|
|
118011fe2b | ||
|
|
af3bd07355 | ||
|
|
d68209978a | ||
|
|
47b45b2967 | ||
|
|
2b38e3823b | ||
|
|
282eab7952 | ||
|
|
c346f61535 | ||
|
|
03212e533b | ||
|
|
da8b6517de | ||
|
|
c5db8f93ec | ||
|
|
974a6d087a | ||
|
|
b758b67c37 | ||
|
|
9bafdc62b7 | ||
|
|
97f876b64c | ||
|
|
cbfbd173c4 | ||
|
|
b6f926fbef | ||
|
|
c822620967 | ||
|
|
397c0502e2 | ||
|
|
1682d15a74 | ||
|
|
dd33e98da0 | ||
|
|
c16d966ad3 | ||
|
|
1dfed16071 | ||
|
|
6f835ed6c8 | ||
|
|
9d6fd1727e | ||
|
|
8c1b6a5fd7 | ||
|
|
8dcdb33be9 | ||
|
|
aba8bbb6e3 | ||
|
|
caf4d571e6 | ||
|
|
3b6eb197a8 | ||
|
|
f3e57877ed | ||
|
|
c851c695db | ||
|
|
a3bd7e73d3 | ||
|
|
ab5ceaf74a | ||
|
|
1f2f69d4f6 | ||
|
|
f361b39dea | ||
|
|
eb1fe15ca8 | ||
|
|
45d8a2435e | ||
|
|
706d84fd10 | ||
|
|
a997ca0da0 | ||
|
|
9268b5d677 | ||
|
|
51e4eeeb04 | ||
|
|
05ff659a3c | ||
|
|
db0f488ea8 | ||
|
|
7dcca6c622 | ||
|
|
090856c7e6 | ||
|
|
cc5cc8f1e0 | ||
|
|
c488b68e75 | ||
|
|
1f1873aadd | ||
|
|
0a496f059c | ||
|
|
e27825b0ef | ||
|
|
1f60a18ea1 | ||
|
|
a0088e8364 | ||
|
|
34e26e14c5 | ||
|
|
6b17335209 | ||
|
|
07ed585c38 | ||
|
|
0669ee7a69 | ||
|
|
f84e674d8a |
No files matched your search
@@ -14,9 +14,61 @@ version 2.80
|
|||||||
when the upstream namesevers do not support DNSSEC, and in this
|
when the upstream namesevers do not support DNSSEC, and in this
|
||||||
case no DNSSEC validation at all is occuring.
|
case no DNSSEC validation at all is occuring.
|
||||||
|
|
||||||
|
Fix DHCP broken-ness when --no-ping AND --dhcp-sequential-ip
|
||||||
|
are set. Thanks to Daniel Miess for help with this.
|
||||||
|
|
||||||
|
Add a facilty to store DNS packets sent/recieved in a
|
||||||
|
pcap-format file for later debugging. The file location
|
||||||
|
is given by the --dumpfile option, and a bitmap controlling
|
||||||
|
which packets should be dumped is given by the --dumpmask
|
||||||
|
option.
|
||||||
|
|
||||||
|
Handle the case of both standard and constructed dhcp-ranges on the
|
||||||
|
same interface better. We don't now contruct a dhcp-range if there's
|
||||||
|
already one specified. This allows the specified interface to
|
||||||
|
have different parameters and avoids advertising the same
|
||||||
|
prefix twice. Thanks to Luis Marsano for spotting this case.
|
||||||
|
|
||||||
|
Allow zone transfer in authoritative mode if auth-peer is specified,
|
||||||
|
even if auth-sec-servers is not. Thanks to Raphaël Halimi for
|
||||||
|
the suggestion.
|
||||||
|
|
||||||
|
Fix bug which sometimes caused dnsmasq to wrongly return answers
|
||||||
|
without DNSSEC RRs to queries with the do-bit set, but only when
|
||||||
|
DNSSEC validation was not enabled.
|
||||||
|
Thanks to Petr Menšík for spotting this.
|
||||||
|
|
||||||
|
Fix missing fatal errors with some malformed options
|
||||||
|
(server, local, address, rebind-domain-ok, ipset, alias).
|
||||||
|
Thanks to Eugene Lozovoy for spotting the problem.
|
||||||
|
|
||||||
|
Fix crash on startup with a --synth-domain which has no prefix.
|
||||||
|
Introduced in 2.79. Thanks to Andreas Engel for the bug report.
|
||||||
|
|
||||||
|
Fix missing EDNS0 section in some replies generated by local
|
||||||
|
DNS configuration which confused systemd-resolvd. Thanks to
|
||||||
|
Steve Dodd for characterising the problem.
|
||||||
|
|
||||||
|
Add --dhcp-name-match config option.
|
||||||
|
|
||||||
|
Add --caa-record config option.
|
||||||
|
|
||||||
|
Implement --address=/example.com/# as (more efficient) syntactic
|
||||||
|
sugar for --address=/example.com/0.0.0.0 and
|
||||||
|
--address=/example.com/::
|
||||||
|
Returning null addresses is a useful technique for ad-blocking.
|
||||||
|
Thanks to Peter Russell for the suggestion.
|
||||||
|
|
||||||
|
Change anti cache-snooping behaviour with queries with the
|
||||||
|
recursion-desired bit unset. Instead to returning SERVFAIL, we
|
||||||
|
now always forward, and never answer from the cache. This
|
||||||
|
allows "dig +trace" command to work.
|
||||||
|
|
||||||
|
Include in the example config file a formulation which
|
||||||
|
stops DHCP clients from claiming the DNS name "wpad".
|
||||||
|
This is a fix for the CERT Vulnerability VU#598349.
|
||||||
|
|
||||||
|
|
||||||
version 2.79
|
version 2.79
|
||||||
Fix parsing of CNAME arguments, which are confused by extra spaces.
|
Fix parsing of CNAME arguments, which are confused by extra spaces.
|
||||||
Thanks to Diego Aguirre for spotting the bug.
|
Thanks to Diego Aguirre for spotting the bug.
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ top?=$(CURDIR)
|
|||||||
|
|
||||||
dbus_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1`
|
dbus_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1`
|
||||||
dbus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1`
|
dbus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1`
|
||||||
|
ubus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_UBUS $(PKG_CONFIG) --copy -lubox -lubus`
|
||||||
idn_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn`
|
idn_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn`
|
||||||
idn_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn`
|
idn_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn`
|
||||||
idn2_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --cflags libidn2`
|
idn2_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --cflags libidn2`
|
||||||
@@ -76,16 +77,16 @@ objs = cache.o rfc1035.o util.o option.o forward.o network.o \
|
|||||||
helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o \
|
helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o \
|
||||||
dhcp-common.o outpacket.o radv.o slaac.o auth.o ipset.o \
|
dhcp-common.o outpacket.o radv.o slaac.o auth.o ipset.o \
|
||||||
domain.o dnssec.o blockdata.o tables.o loop.o inotify.o \
|
domain.o dnssec.o blockdata.o tables.o loop.o inotify.o \
|
||||||
poll.o rrfilter.o edns0.o arp.o crypto.o
|
poll.o rrfilter.o edns0.o arp.o crypto.o dump.o ubus.o metrics.o
|
||||||
|
|
||||||
hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
|
hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
|
||||||
dns-protocol.h radv-protocol.h ip6addr.h
|
dns-protocol.h radv-protocol.h ip6addr.h metrics.h
|
||||||
|
|
||||||
all : $(BUILDDIR)
|
all : $(BUILDDIR)
|
||||||
@cd $(BUILDDIR) && $(MAKE) \
|
@cd $(BUILDDIR) && $(MAKE) \
|
||||||
top="$(top)" \
|
top="$(top)" \
|
||||||
build_cflags="$(version) $(dbus_cflags) $(idn2_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags)" \
|
build_cflags="$(version) $(dbus_cflags) $(idn2_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags)" \
|
||||||
build_libs="$(dbus_libs) $(idn2_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs)" \
|
build_libs="$(dbus_libs) $(idn2_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs) $(ubus_libs)" \
|
||||||
-f $(top)/Makefile dnsmasq
|
-f $(top)/Makefile dnsmasq
|
||||||
|
|
||||||
mostly_clean :
|
mostly_clean :
|
||||||
|
|||||||
+2
-1
@@ -10,7 +10,8 @@ LOCAL_SRC_FILES := bpf.c cache.c dbus.c dhcp.c dnsmasq.c \
|
|||||||
dhcp6.c rfc3315.c dhcp-common.c outpacket.c \
|
dhcp6.c rfc3315.c dhcp-common.c outpacket.c \
|
||||||
radv.c slaac.c auth.c ipset.c domain.c \
|
radv.c slaac.c auth.c ipset.c domain.c \
|
||||||
dnssec.c dnssec-openssl.c blockdata.c tables.c \
|
dnssec.c dnssec-openssl.c blockdata.c tables.c \
|
||||||
loop.c inotify.c poll.c rrfilter.c edns0.c arp.c crypto.c
|
loop.c inotify.c poll.c rrfilter.c edns0.c arp.c \
|
||||||
|
crypto.c dump.c ubus.c
|
||||||
|
|
||||||
LOCAL_MODULE := dnsmasq
|
LOCAL_MODULE := dnsmasq
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ static unsigned char *option_find1(unsigned char *p, unsigned char *end, int opt
|
|||||||
if (p >= end - 2)
|
if (p >= end - 2)
|
||||||
return NULL; /* malformed packet */
|
return NULL; /* malformed packet */
|
||||||
opt_len = option_len(p);
|
opt_len = option_len(p);
|
||||||
if (p >= end - (2 + opt_len))
|
if (end - p >= (2 + opt_len))
|
||||||
return NULL; /* malformed packet */
|
return NULL; /* malformed packet */
|
||||||
if (*p == opt && opt_len >= minsize)
|
if (*p == opt && opt_len >= minsize)
|
||||||
return p;
|
return p;
|
||||||
|
|||||||
@@ -270,7 +270,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* This voodoo fakes up a packet coming from the correct interface, which really matters for
|
/* This voodoo fakes up a packet coming from the correct interface, which really matters for
|
||||||
a DHCP server */
|
a DHCP server */
|
||||||
strcpy(ifr.ifr_name, argv[1]);
|
strncpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name)-1);
|
||||||
|
ifr.ifr_name[sizeof(ifr.ifr_name)-1] = '\0';
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) == -1)
|
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) == -1)
|
||||||
{
|
{
|
||||||
perror("cannot setup interface");
|
perror("cannot setup interface");
|
||||||
|
|||||||
@@ -376,9 +376,12 @@ int send_release_packet(const char* iface, struct dhcp6_packet* packet)
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(sock);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(sock);
|
||||||
fprintf(stderr, "Response timed out\n");
|
fprintf(stderr, "Response timed out\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,6 +243,10 @@ IPv4 or IPv6 address of the lease to remove.
|
|||||||
Note that this function will trigger the DhcpLeaseRemoved signal and the
|
Note that this function will trigger the DhcpLeaseRemoved signal and the
|
||||||
configured DHCP lease script will be run with the "del" action.
|
configured DHCP lease script will be run with the "del" action.
|
||||||
|
|
||||||
|
GetMetrics
|
||||||
|
----------
|
||||||
|
|
||||||
|
Returns an array with various metrics for DNS and DHCP.
|
||||||
|
|
||||||
|
|
||||||
2. SIGNALS
|
2. SIGNALS
|
||||||
|
|||||||
Vendored
+9
@@ -1,3 +1,12 @@
|
|||||||
|
dnsmasq (2.80-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* New upstream. (closes: #837602) (closes: #794640) (closes: #794636)
|
||||||
|
* Close old bugs, long agp fixed. (closes: #802845) (closes: #754299)
|
||||||
|
* Provide usr/lib/tmpfiles.d/dnsmasq.conf. (closes: #872396)
|
||||||
|
* Run restorecon on /run/dnsmasq for SE Linux. (closes: #872397)
|
||||||
|
|
||||||
|
-- Simon Kelley <simon@thekelleys.org.uk> Mon, 17 Sep 2018 23:11:25 +0000
|
||||||
|
|
||||||
dnsmasq (2.79-1) unstable; urgency=low
|
dnsmasq (2.79-1) unstable; urgency=low
|
||||||
|
|
||||||
* New upstream. (closes: #888200)
|
* New upstream. (closes: #888200)
|
||||||
|
|||||||
Vendored
+2
-1
@@ -127,7 +127,8 @@ start()
|
|||||||
mkdir /run/dnsmasq || return 2
|
mkdir /run/dnsmasq || return 2
|
||||||
chown dnsmasq:nogroup /run/dnsmasq || return 2
|
chown dnsmasq:nogroup /run/dnsmasq || return 2
|
||||||
fi
|
fi
|
||||||
|
[ -x /sbin/restorecon ] && /sbin/restorecon /run/dnsmasq
|
||||||
|
|
||||||
start-stop-daemon --start --quiet --pidfile /run/dnsmasq/$NAME.pid --exec $DAEMON --test > /dev/null || return 1
|
start-stop-daemon --start --quiet --pidfile /run/dnsmasq/$NAME.pid --exec $DAEMON --test > /dev/null || return 1
|
||||||
start-stop-daemon --start --quiet --pidfile /run/dnsmasq/$NAME.pid --exec $DAEMON -- \
|
start-stop-daemon --start --quiet --pidfile /run/dnsmasq/$NAME.pid --exec $DAEMON -- \
|
||||||
-x /run/dnsmasq/$NAME.pid \
|
-x /run/dnsmasq/$NAME.pid \
|
||||||
|
|||||||
Vendored
+2
@@ -169,6 +169,7 @@ binary-indep: checkroot
|
|||||||
-d debian/trees/daemon/usr/share/dnsmasq \
|
-d debian/trees/daemon/usr/share/dnsmasq \
|
||||||
-d debian/trees/daemon/etc/default \
|
-d debian/trees/daemon/etc/default \
|
||||||
-d debian/trees/daemon/lib/systemd/system \
|
-d debian/trees/daemon/lib/systemd/system \
|
||||||
|
-d debian/trees/daemon/usr/lib/tmpfiles.d \
|
||||||
-d debian/trees/daemon/etc/insserv.conf.d
|
-d debian/trees/daemon/etc/insserv.conf.d
|
||||||
install -m 644 debian/conffiles debian/trees/daemon/DEBIAN
|
install -m 644 debian/conffiles debian/trees/daemon/DEBIAN
|
||||||
install -m 755 debian/postinst debian/postrm debian/prerm debian/trees/daemon/DEBIAN
|
install -m 755 debian/postinst debian/postrm debian/prerm debian/trees/daemon/DEBIAN
|
||||||
@@ -180,6 +181,7 @@ binary-indep: checkroot
|
|||||||
install -m 644 dnsmasq.conf.example debian/trees/daemon/etc/dnsmasq.conf
|
install -m 644 dnsmasq.conf.example debian/trees/daemon/etc/dnsmasq.conf
|
||||||
install -m 644 debian/readme.dnsmasq.d debian/trees/daemon/etc/dnsmasq.d/README
|
install -m 644 debian/readme.dnsmasq.d debian/trees/daemon/etc/dnsmasq.d/README
|
||||||
install -m 644 debian/systemd.service debian/trees/daemon/lib/systemd/system/dnsmasq.service
|
install -m 644 debian/systemd.service debian/trees/daemon/lib/systemd/system/dnsmasq.service
|
||||||
|
install -m 644 debian/tmpfiles.conf debian/trees/daemon/usr/lib/tmpfiles.d/dnsmasq.conf
|
||||||
install -m 644 debian/insserv debian/trees/daemon/etc/insserv.conf.d/dnsmasq
|
install -m 644 debian/insserv debian/trees/daemon/etc/insserv.conf.d/dnsmasq
|
||||||
ln -s $(package) debian/trees/daemon/usr/share/doc/dnsmasq
|
ln -s $(package) debian/trees/daemon/usr/share/doc/dnsmasq
|
||||||
cd debian/trees/daemon && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
|
cd debian/trees/daemon && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
|
||||||
|
|||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
d /run/dnsmasq 755 dnsmasq nogroup
|
||||||
@@ -672,3 +672,8 @@
|
|||||||
|
|
||||||
# Include all files in a directory which end in .conf
|
# Include all files in a directory which end in .conf
|
||||||
#conf-dir=/etc/dnsmasq.d/,*.conf
|
#conf-dir=/etc/dnsmasq.d/,*.conf
|
||||||
|
|
||||||
|
# If a DHCP client claims that its name is "wpad", ignore that.
|
||||||
|
# This fixes a security hole. see CERT Vulnerability VU#598349
|
||||||
|
#dhcp-name-match=set:wpad-ignore,wpad
|
||||||
|
#dhcp-ignore-names=tag:wpad-ignore
|
||||||
+172
-148
@@ -27,7 +27,7 @@ TFTP server to allow net/PXE boot of DHCP hosts and also supports BOOTP. The PXE
|
|||||||
.PP
|
.PP
|
||||||
The dnsmasq DHCPv6 server provides the same set of features as the
|
The dnsmasq DHCPv6 server provides the same set of features as the
|
||||||
DHCPv4 server, and in addition, it includes router advertisements and
|
DHCPv4 server, and in addition, it includes router advertisements and
|
||||||
a neat feature which allows nameing for clients which use DHCPv4 and
|
a neat feature which allows naming for clients which use DHCPv4 and
|
||||||
stateless autoconfiguration only for IPv6 configuration. There is support for doing address allocation (both DHCPv6 and RA) from subnets which are dynamically delegated via DHCPv6 prefix delegation.
|
stateless autoconfiguration only for IPv6 configuration. There is support for doing address allocation (both DHCPv6 and RA) from subnets which are dynamically delegated via DHCPv6 prefix delegation.
|
||||||
.PP
|
.PP
|
||||||
Dnsmasq is coded with small embedded systems in mind. It aims for the smallest possible memory footprint compatible with the supported functions, and allows unneeded functions to be omitted from the compiled binary.
|
Dnsmasq is coded with small embedded systems in mind. It aims for the smallest possible memory footprint compatible with the supported functions, and allows unneeded functions to be omitted from the compiled binary.
|
||||||
@@ -53,13 +53,13 @@ will display DHCPv6 options.
|
|||||||
Don't read the hostnames in /etc/hosts.
|
Don't read the hostnames in /etc/hosts.
|
||||||
.TP
|
.TP
|
||||||
.B \-H, --addn-hosts=<file>
|
.B \-H, --addn-hosts=<file>
|
||||||
Additional hosts file. Read the specified file as well as /etc/hosts. If -h is given, read
|
Additional hosts file. Read the specified file as well as /etc/hosts. If \fB--no-hosts\fP is given, read
|
||||||
only the specified file. This option may be repeated for more than one
|
only the specified file. This option may be repeated for more than one
|
||||||
additional hosts file. If a directory is given, then read all the files contained in that directory.
|
additional hosts file. If a directory is given, then read all the files contained in that directory.
|
||||||
.TP
|
.TP
|
||||||
.B --hostsdir=<path>
|
.B --hostsdir=<path>
|
||||||
Read all the hosts files contained in the directory. New or changed files
|
Read all the hosts files contained in the directory. New or changed files
|
||||||
are read automatically. See --dhcp-hostsdir for details.
|
are read automatically. See \fB--dhcp-hostsdir\fP for details.
|
||||||
.TP
|
.TP
|
||||||
.B \-E, --expand-hosts
|
.B \-E, --expand-hosts
|
||||||
Add the domain to simple names (without a period) in /etc/hosts
|
Add the domain to simple names (without a period) in /etc/hosts
|
||||||
@@ -76,7 +76,7 @@ reduce the load on the server at the expense of clients using stale
|
|||||||
data under some circumstances.
|
data under some circumstances.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-ttl=<time>
|
.B --dhcp-ttl=<time>
|
||||||
As for --local-ttl, but affects only replies with information from DHCP leases. If both are given, --dhcp-ttl applies for DHCP information, and --local-ttl for others. Setting this to zero eliminates the effect of --local-ttl for DHCP.
|
As for \fB--local-ttl\fP, but affects only replies with information from DHCP leases. If both are given, \fB--dhcp-ttl\fP applies for DHCP information, and \fB--local-ttl\fP for others. Setting this to zero eliminates the effect of \fB--local-ttl\fP for DHCP.
|
||||||
.TP
|
.TP
|
||||||
.B --neg-ttl=<time>
|
.B --neg-ttl=<time>
|
||||||
Negative replies from upstream servers normally contain time-to-live
|
Negative replies from upstream servers normally contain time-to-live
|
||||||
@@ -115,7 +115,7 @@ don't change user id, generate a complete cache dump on receipt on
|
|||||||
SIGUSR1, log to stderr as well as syslog, don't fork new processes
|
SIGUSR1, log to stderr as well as syslog, don't fork new processes
|
||||||
to handle TCP queries. Note that this option is for use in debugging
|
to handle TCP queries. Note that this option is for use in debugging
|
||||||
only, to stop dnsmasq daemonising in production, use
|
only, to stop dnsmasq daemonising in production, use
|
||||||
.B -k.
|
.B --keep-in-foreground.
|
||||||
.TP
|
.TP
|
||||||
.B \-q, --log-queries
|
.B \-q, --log-queries
|
||||||
Log the results of DNS queries handled by dnsmasq. Enable a full cache dump on receipt of SIGUSR1. If the argument "extra" is supplied, ie
|
Log the results of DNS queries handled by dnsmasq. Enable a full cache dump on receipt of SIGUSR1. If the argument "extra" is supplied, ie
|
||||||
@@ -156,7 +156,7 @@ can be over-ridden with this switch.
|
|||||||
.TP
|
.TP
|
||||||
.B \-g, --group=<groupname>
|
.B \-g, --group=<groupname>
|
||||||
Specify the group which dnsmasq will run
|
Specify the group which dnsmasq will run
|
||||||
as. The defaults to "dip", if available, to facilitate access to
|
as. The default is "dip", if available, to facilitate access to
|
||||||
/etc/ppp/resolv.conf which is not normally world readable.
|
/etc/ppp/resolv.conf which is not normally world readable.
|
||||||
.TP
|
.TP
|
||||||
.B \-v, --version
|
.B \-v, --version
|
||||||
@@ -191,7 +191,6 @@ Dnsmasq picks random ports as source for outbound queries:
|
|||||||
when this option is given, the ports used will always be lower
|
when this option is given, the ports used will always be lower
|
||||||
than that specified. Useful for systems behind firewalls.
|
than that specified. Useful for systems behind firewalls.
|
||||||
.TP
|
.TP
|
||||||
|
|
||||||
.B \-i, --interface=<interface name>
|
.B \-i, --interface=<interface name>
|
||||||
Listen only on the specified interface(s). Dnsmasq automatically adds
|
Listen only on the specified interface(s). Dnsmasq automatically adds
|
||||||
the loopback (local) interface to the list of interfaces to use when
|
the loopback (local) interface to the list of interfaces to use when
|
||||||
@@ -232,7 +231,7 @@ options always override the others. The comments about interface labels for
|
|||||||
.B --listen-address
|
.B --listen-address
|
||||||
apply here.
|
apply here.
|
||||||
.TP
|
.TP
|
||||||
.B --auth-server=<domain>,<interface>|<ip-address>
|
.B --auth-server=<domain>,[<interface>|<ip-address>...]
|
||||||
Enable DNS authoritative mode for queries arriving at an interface or address. Note that the interface or address
|
Enable DNS authoritative mode for queries arriving at an interface or address. Note that the interface or address
|
||||||
need not be mentioned in
|
need not be mentioned in
|
||||||
.B --interface
|
.B --interface
|
||||||
@@ -245,13 +244,13 @@ specified interface. The <domain> is the "glue record". It should
|
|||||||
resolve in the global DNS to an A and/or AAAA record which points to
|
resolve in the global DNS to an A and/or AAAA record which points to
|
||||||
the address dnsmasq is listening on. When an interface is specified,
|
the address dnsmasq is listening on. When an interface is specified,
|
||||||
it may be qualified with "/4" or "/6" to specify only the IPv4 or IPv6
|
it may be qualified with "/4" or "/6" to specify only the IPv4 or IPv6
|
||||||
addresses associated with the interface.
|
addresses associated with the interface. Since any defined authoritative zones are also available as part of the normal recusive DNS service supplied by dnsmasq, it can make sense to have an --auth-server declaration with no interfaces or address, but simply specifying the glue record.
|
||||||
.TP
|
.TP
|
||||||
.B --local-service
|
.B --local-service
|
||||||
Accept DNS queries only from hosts whose address is on a local subnet,
|
Accept DNS queries only from hosts whose address is on a local subnet,
|
||||||
ie a subnet for which an interface exists on the server. This option
|
ie a subnet for which an interface exists on the server. This option
|
||||||
only has effect if there are no --interface --except-interface,
|
only has effect if there are no \fB--interface\fP, \fB--except-interface\fP,
|
||||||
--listen-address or --auth-server options. It is intended to be set as
|
\fB--listen-address\fP or \fB--auth-server\fP options. It is intended to be set as
|
||||||
a default on installation, to allow unconfigured installations to be
|
a default on installation, to allow unconfigured installations to be
|
||||||
useful but also safe from being used for DNS amplification attacks.
|
useful but also safe from being used for DNS amplification attacks.
|
||||||
.TP
|
.TP
|
||||||
@@ -294,10 +293,10 @@ addresses appear, it automatically listens on those (subject to any
|
|||||||
access-control configuration). This makes dynamically created
|
access-control configuration). This makes dynamically created
|
||||||
interfaces work in the same way as the default. Implementing this
|
interfaces work in the same way as the default. Implementing this
|
||||||
option requires non-standard networking APIs and it is only available
|
option requires non-standard networking APIs and it is only available
|
||||||
under Linux. On other platforms it falls-back to --bind-interfaces mode.
|
under Linux. On other platforms it falls-back to \fB--bind-interfaces\fP mode.
|
||||||
.TP
|
.TP
|
||||||
.B \-y, --localise-queries
|
.B \-y, --localise-queries
|
||||||
Return answers to DNS queries from /etc/hosts and --interface-name which depend on the interface over which the query was
|
Return answers to DNS queries from /etc/hosts and \fB--interface-name\fP which depend on the interface over which the query was
|
||||||
received. If a name has more than one address associated with
|
received. If a name has more than one address associated with
|
||||||
it, and at least one of those addresses is on the same subnet as the
|
it, and at least one of those addresses is on the same subnet as the
|
||||||
interface to which the query was sent, then return only the
|
interface to which the query was sent, then return only the
|
||||||
@@ -367,6 +366,11 @@ been built with DBus support. If the service name is given, dnsmasq
|
|||||||
provides service at that name, rather than the default which is
|
provides service at that name, rather than the default which is
|
||||||
.B uk.org.thekelleys.dnsmasq
|
.B uk.org.thekelleys.dnsmasq
|
||||||
.TP
|
.TP
|
||||||
|
.B --enable-ubus
|
||||||
|
Enable dnsmasq UBus interface. It sends notifications via UBus on
|
||||||
|
DHCPACK and DHCPRELEASE events. Furthermore it offers metrics.
|
||||||
|
Requires that dnsmasq has been built with UBus support.
|
||||||
|
.TP
|
||||||
.B \-o, --strict-order
|
.B \-o, --strict-order
|
||||||
By default, dnsmasq will send queries to any of the upstream servers
|
By default, dnsmasq will send queries to any of the upstream servers
|
||||||
it knows about and tries to favour servers that are known to
|
it knows about and tries to favour servers that are known to
|
||||||
@@ -402,7 +406,7 @@ these services.
|
|||||||
.B --rebind-domain-ok=[<domain>]|[[/<domain>/[<domain>/]
|
.B --rebind-domain-ok=[<domain>]|[[/<domain>/[<domain>/]
|
||||||
Do not detect and block dns-rebind on queries to these domains. The
|
Do not detect and block dns-rebind on queries to these domains. The
|
||||||
argument may be either a single domain, or multiple domains surrounded
|
argument may be either a single domain, or multiple domains surrounded
|
||||||
by '/', like the --server syntax, eg.
|
by '/', like the \fB--server\fP syntax, eg.
|
||||||
.B --rebind-domain-ok=/domain1/domain2/domain3/
|
.B --rebind-domain-ok=/domain1/domain2/domain3/
|
||||||
.TP
|
.TP
|
||||||
.B \-n, --no-poll
|
.B \-n, --no-poll
|
||||||
@@ -421,14 +425,13 @@ from /etc/hosts or DHCP then a "not found" answer is returned.
|
|||||||
.TP
|
.TP
|
||||||
.B \-S, --local, --server=[/[<domain>]/[domain/]][<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]
|
.B \-S, --local, --server=[/[<domain>]/[domain/]][<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]
|
||||||
Specify IP address of upstream servers directly. Setting this flag does
|
Specify IP address of upstream servers directly. Setting this flag does
|
||||||
not suppress reading of /etc/resolv.conf, use -R to do that. If one or
|
not suppress reading of /etc/resolv.conf, use \fB--no-resolv\fP to do that. If one or more
|
||||||
more
|
|
||||||
optional domains are given, that server is used only for those domains
|
optional domains are given, that server is used only for those domains
|
||||||
and they are queried only using the specified server. This is
|
and they are queried only using the specified server. This is
|
||||||
intended for private nameservers: if you have a nameserver on your
|
intended for private nameservers: if you have a nameserver on your
|
||||||
network which deals with names of the form
|
network which deals with names of the form
|
||||||
xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag
|
xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag
|
||||||
.B -S /internal.thekelleys.org.uk/192.168.1.1
|
.B --server=/internal.thekelleys.org.uk/192.168.1.1
|
||||||
will send all queries for
|
will send all queries for
|
||||||
internal machines to that nameserver, everything else will go to the
|
internal machines to that nameserver, everything else will go to the
|
||||||
servers in /etc/resolv.conf. DNSSEC validation is turned off for such
|
servers in /etc/resolv.conf. DNSSEC validation is turned off for such
|
||||||
@@ -440,7 +443,7 @@ has the special meaning of "unqualified names only" ie names without any
|
|||||||
dots in them. A non-standard port may be specified as
|
dots in them. A non-standard port may be specified as
|
||||||
part of the IP
|
part of the IP
|
||||||
address using a # character.
|
address using a # character.
|
||||||
More than one -S flag is allowed, with
|
More than one \fB--server\fP flag is allowed, with
|
||||||
repeated domain or ipaddr parts as required.
|
repeated domain or ipaddr parts as required.
|
||||||
|
|
||||||
More specific domains take precedence over less specific domains, so:
|
More specific domains take precedence over less specific domains, so:
|
||||||
@@ -460,9 +463,9 @@ flag which gives a domain but no IP address; this tells dnsmasq that
|
|||||||
a domain is local and it may answer queries from /etc/hosts or DHCP
|
a domain is local and it may answer queries from /etc/hosts or DHCP
|
||||||
but should never forward queries on that domain to any upstream
|
but should never forward queries on that domain to any upstream
|
||||||
servers.
|
servers.
|
||||||
.B local
|
.B --local
|
||||||
is a synonym for
|
is a synonym for
|
||||||
.B server
|
.B --server
|
||||||
to make configuration files clearer in this case.
|
to make configuration files clearer in this case.
|
||||||
|
|
||||||
IPv6 addresses may include an %interface scope-id, eg
|
IPv6 addresses may include an %interface scope-id, eg
|
||||||
@@ -493,7 +496,7 @@ is exactly equivalent to
|
|||||||
Specify an IP address to return for any host in the given domains.
|
Specify an IP address to return for any host in the given domains.
|
||||||
Queries in the domains are never forwarded and always replied to
|
Queries in the domains are never forwarded and always replied to
|
||||||
with the specified IP address which may be IPv4 or IPv6. To give
|
with the specified IP address which may be IPv4 or IPv6. To give
|
||||||
both IPv4 and IPv6 addresses for a domain, use repeated \fB-A\fP flags.
|
both IPv4 and IPv6 addresses for a domain, use repeated \fB--address\fP flags.
|
||||||
To include multiple IP addresses for a single query, use
|
To include multiple IP addresses for a single query, use
|
||||||
\fB--addn-hosts=<path>\fP instead.
|
\fB--addn-hosts=<path>\fP instead.
|
||||||
Note that /etc/hosts and DHCP leases override this for individual
|
Note that /etc/hosts and DHCP leases override this for individual
|
||||||
@@ -507,7 +510,12 @@ upstream nameserver by a more specific \fB--server\fP directive. As for
|
|||||||
\fB--server\fP, one or more domains with no address returns a
|
\fB--server\fP, one or more domains with no address returns a
|
||||||
no-such-domain answer, so \fB--address=/example.com/\fP is equivalent to
|
no-such-domain answer, so \fB--address=/example.com/\fP is equivalent to
|
||||||
\fB--server=/example.com/\fP and returns NXDOMAIN for example.com and
|
\fB--server=/example.com/\fP and returns NXDOMAIN for example.com and
|
||||||
all its subdomains.
|
all its subdomains. An address specified as '#' translates to the NULL
|
||||||
|
address of 0.0.0.0 and its IPv6 equivalent of :: so
|
||||||
|
\fB--address=/example.com/#\fP will return NULL addresses for example.com and
|
||||||
|
its subdomains. This is partly syntactic sugar for \fB--address=/example.com/0.0.0.0\fP
|
||||||
|
and \fB--address=/example.com/::\fP but is also more efficient than including both
|
||||||
|
as seperate configuration lines. Note that NULL addresses normally work in the same way as localhost, so beware that clients looking up these names are likely to end up talking to themselves.
|
||||||
.TP
|
.TP
|
||||||
.B --ipset=/<domain>[/<domain>...]/<ipset>[,<ipset>...]
|
.B --ipset=/<domain>[/<domain>...]/<ipset>[,<ipset>...]
|
||||||
Places the resolved IP addresses of queries for one or more domains in
|
Places the resolved IP addresses of queries for one or more domains in
|
||||||
@@ -523,7 +531,7 @@ for more details.
|
|||||||
.B \-m, --mx-host=<mx name>[[,<hostname>],<preference>]
|
.B \-m, --mx-host=<mx name>[[,<hostname>],<preference>]
|
||||||
Return an MX record named <mx name> pointing to the given hostname (if
|
Return an MX record named <mx name> pointing to the given hostname (if
|
||||||
given), or
|
given), or
|
||||||
the host specified in the --mx-target switch
|
the host specified in the \fB--mx-target\fP switch
|
||||||
or, if that switch is not given, the host on which dnsmasq
|
or, if that switch is not given, the host on which dnsmasq
|
||||||
is running. The default is useful for directing mail from systems on a LAN
|
is running. The default is useful for directing mail from systems on a LAN
|
||||||
to a central server. The preference value is optional, and defaults to
|
to a central server. The preference value is optional, and defaults to
|
||||||
@@ -531,7 +539,7 @@ to a central server. The preference value is optional, and defaults to
|
|||||||
.TP
|
.TP
|
||||||
.B \-t, --mx-target=<hostname>
|
.B \-t, --mx-target=<hostname>
|
||||||
Specify the default target for the MX record returned by dnsmasq. See
|
Specify the default target for the MX record returned by dnsmasq. See
|
||||||
--mx-host. If --mx-target is given, but not --mx-host, then dnsmasq
|
\fB--mx-host\fP. If \fB--mx-target\fP is given, but not \fB--mx-host\fP, then dnsmasq
|
||||||
returns a MX record containing the MX target for MX queries on the
|
returns a MX record containing the MX target for MX queries on the
|
||||||
hostname of the machine on which dnsmasq is running.
|
hostname of the machine on which dnsmasq is running.
|
||||||
.TP
|
.TP
|
||||||
@@ -540,7 +548,7 @@ Return an MX record pointing to itself for each local
|
|||||||
machine. Local machines are those in /etc/hosts or with DHCP leases.
|
machine. Local machines are those in /etc/hosts or with DHCP leases.
|
||||||
.TP
|
.TP
|
||||||
.B \-L, --localmx
|
.B \-L, --localmx
|
||||||
Return an MX record pointing to the host given by mx-target (or the
|
Return an MX record pointing to the host given by \fB--mx-target\fP (or the
|
||||||
machine on which dnsmasq is running) for each
|
machine on which dnsmasq is running) for each
|
||||||
local machine. Local machines are those in /etc/hosts or with DHCP
|
local machine. Local machines are those in /etc/hosts or with DHCP
|
||||||
leases.
|
leases.
|
||||||
@@ -560,22 +568,22 @@ all that match are returned.
|
|||||||
Add A, AAAA and PTR records to the DNS. This adds one or more names to
|
Add A, AAAA and PTR records to the DNS. This adds one or more names to
|
||||||
the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may
|
the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may
|
||||||
appear in more than one
|
appear in more than one
|
||||||
.B host-record
|
.B --host-record
|
||||||
and therefore be assigned more than one address. Only the first
|
and therefore be assigned more than one address. Only the first
|
||||||
address creates a PTR record linking the address to the name. This is
|
address creates a PTR record linking the address to the name. This is
|
||||||
the same rule as is used reading hosts-files.
|
the same rule as is used reading hosts-files.
|
||||||
.B host-record
|
.B --host-record
|
||||||
options are considered to be read before host-files, so a name
|
options are considered to be read before host-files, so a name
|
||||||
appearing there inhibits PTR-record creation if it appears in
|
appearing there inhibits PTR-record creation if it appears in
|
||||||
hosts-file also. Unlike hosts-files, names are not expanded, even when
|
hosts-file also. Unlike hosts-files, names are not expanded, even when
|
||||||
.B expand-hosts
|
.B --expand-hosts
|
||||||
is in effect. Short and long names may appear in the same
|
is in effect. Short and long names may appear in the same
|
||||||
.B host-record,
|
.B --host-record,
|
||||||
eg.
|
eg.
|
||||||
.B --host-record=laptop,laptop.thekelleys.org,192.168.0.1,1234::100
|
.B --host-record=laptop,laptop.thekelleys.org,192.168.0.1,1234::100
|
||||||
|
|
||||||
If the time-to-live is given, it overrides the default, which is zero
|
If the time-to-live is given, it overrides the default, which is zero
|
||||||
or the value of --local-ttl. The value is a positive integer and gives
|
or the value of \fB--local-ttl\fP. The value is a positive integer and gives
|
||||||
the time-to-live in seconds.
|
the time-to-live in seconds.
|
||||||
.TP
|
.TP
|
||||||
.B \-Y, --txt-record=<name>[[,<text>],<text>]
|
.B \-Y, --txt-record=<name>[[,<text>],<text>]
|
||||||
@@ -590,11 +598,14 @@ Return a PTR DNS record.
|
|||||||
.B --naptr-record=<name>,<order>,<preference>,<flags>,<service>,<regexp>[,<replacement>]
|
.B --naptr-record=<name>,<order>,<preference>,<flags>,<service>,<regexp>[,<replacement>]
|
||||||
Return an NAPTR DNS record, as specified in RFC3403.
|
Return an NAPTR DNS record, as specified in RFC3403.
|
||||||
.TP
|
.TP
|
||||||
|
.B --caa-record=<name>,<flags>,<tag>,<value>
|
||||||
|
Return a CAA DNS record, as specified in RFC6844.
|
||||||
|
.TP
|
||||||
.B --cname=<cname>,[<cname>,]<target>[,<TTL>]
|
.B --cname=<cname>,[<cname>,]<target>[,<TTL>]
|
||||||
Return a CNAME record which indicates that <cname> is really
|
Return a CNAME record which indicates that <cname> is really
|
||||||
<target>. There are significant limitations on the target; it must be a
|
<target>. There are significant limitations on the target; it must be a
|
||||||
DNS name which is known to dnsmasq from /etc/hosts (or additional
|
DNS name which is known to dnsmasq from /etc/hosts (or additional
|
||||||
hosts files), from DHCP, from --interface-name or from another
|
hosts files), from DHCP, from \fB--interface-name\fP or from another
|
||||||
.B --cname.
|
.B --cname.
|
||||||
If the target does not satisfy this
|
If the target does not satisfy this
|
||||||
criteria, the whole cname is ignored. The cname must be unique, but it
|
criteria, the whole cname is ignored. The cname must be unique, but it
|
||||||
@@ -603,7 +614,7 @@ it's possible to declare multiple cnames to a target in a single line, like so:
|
|||||||
.B --cname=cname1,cname2,target
|
.B --cname=cname1,cname2,target
|
||||||
|
|
||||||
If the time-to-live is given, it overrides the default, which is zero
|
If the time-to-live is given, it overrides the default, which is zero
|
||||||
or the value of -local-ttl. The value is a positive integer and gives
|
or the value of \fB--local-ttl\fP. The value is a positive integer and gives
|
||||||
the time-to-live in seconds.
|
the time-to-live in seconds.
|
||||||
.TP
|
.TP
|
||||||
.B --dns-rr=<name>,<RR-number>,[<hex data>]
|
.B --dns-rr=<name>,<RR-number>,[<hex data>]
|
||||||
@@ -624,7 +635,7 @@ matching PTR record is also created, mapping the interface address to
|
|||||||
the name. More than one name may be associated with an interface
|
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
|
address by repeating the flag; in that case the first instance is used
|
||||||
for the reverse address-to-name mapping. Note that a name used in
|
for the reverse address-to-name mapping. Note that a name used in
|
||||||
--interface-name may not appear in /etc/hosts.
|
\fB--interface-name\fP may not appear in /etc/hosts.
|
||||||
.TP
|
.TP
|
||||||
.B --synth-domain=<domain>,<address range>[,<prefix>[*]]
|
.B --synth-domain=<domain>,<address range>[,<prefix>[*]]
|
||||||
Create artificial A/AAAA and PTR records for an address range. The
|
Create artificial A/AAAA and PTR records for an address range. The
|
||||||
@@ -647,6 +658,13 @@ V4 mapped IPv6 addresses, which have a representation like ::ffff:1.2.3.4 are ha
|
|||||||
The address range can be of the form
|
The address range can be of the form
|
||||||
<ip address>,<ip address> or <ip address>/<netmask> in both forms of the option.
|
<ip address>,<ip address> or <ip address>/<netmask> in both forms of the option.
|
||||||
.TP
|
.TP
|
||||||
|
.B --dumpfile=<path/to/file>
|
||||||
|
Specify the location of a pcap-format file which dnsmasq uses to dump copies of network packets for debugging purposes. If the file exists when dnsmasq starts, it is not deleted; new packets are added to the end.
|
||||||
|
.TP
|
||||||
|
.B --dumpmask=<mask>
|
||||||
|
Specify which types of packets should be added to the dumpfile. The argument should be the OR of the bitmasks for each type of packet to be dumped: it can be specified in hex by preceding the number with 0x in the normal way. Each time a packet is written to the dumpfile, dnsmasq logs the packet sequence and the mask
|
||||||
|
representing its type. The current types are: 0x0001 - DNS queries from clients 0x0002 DNS replies to clients 0x0004 - DNS queries to upstream 0x0008 - DNS replies from upstream 0x0010 - queries send upstream for DNSSEC validation 0x0020 - replies to queries for DNSSEC validation 0x0040 - replies to client queries which fail DNSSEC validation 0x0080 replies to queries for DNSSEC validation which fail validation.
|
||||||
|
.TP
|
||||||
.B --add-mac[=base64|text]
|
.B --add-mac[=base64|text]
|
||||||
Add the MAC address of the requestor to DNS queries which are
|
Add the MAC address of the requestor to DNS queries which are
|
||||||
forwarded upstream. This may be used to DNS filtering by the upstream
|
forwarded upstream. This may be used to DNS filtering by the upstream
|
||||||
@@ -655,7 +673,7 @@ subnet as the dnsmasq server. Note that the mechanism used to achieve this (an E
|
|||||||
is not yet standardised, so this should be considered
|
is not yet standardised, so this should be considered
|
||||||
experimental. Also note that exposing MAC addresses in this way may
|
experimental. Also note that exposing MAC addresses in this way may
|
||||||
have security and privacy implications. The warning about caching
|
have security and privacy implications. The warning about caching
|
||||||
given for --add-subnet applies to --add-mac too. An alternative encoding of the
|
given for \fB--add-subnet\fP applies to \fB--add-mac\fP too. An alternative encoding of the
|
||||||
MAC, as base64, is enabled by adding the "base64" parameter and a human-readable encoding of hex-and-colons is enabled by added the "text" parameter.
|
MAC, as base64, is enabled by adding the "base64" parameter and a human-readable encoding of hex-and-colons is enabled by added the "text" parameter.
|
||||||
.TP
|
.TP
|
||||||
.B --add-cpe-id=<string>
|
.B --add-cpe-id=<string>
|
||||||
@@ -685,7 +703,7 @@ will add 1.2.3.0/24 for both IPv4 and IPv6 requestors.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-c, --cache-size=<cachesize>
|
.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.
|
Set the size of dnsmasq's cache. The default is 150 names. Setting the cache size to zero disables caching. Note: huge cache size impacts performance.
|
||||||
.TP
|
.TP
|
||||||
.B \-N, --no-negcache
|
.B \-N, --no-negcache
|
||||||
Disable negative caching. Negative caching allows dnsmasq to remember
|
Disable negative caching. Negative caching allows dnsmasq to remember
|
||||||
@@ -746,10 +764,10 @@ which have not been thoroughly checked.
|
|||||||
|
|
||||||
Earlier versions of dnsmasq overloaded SIGHUP (which re-reads much configuration) to also enable time validation.
|
Earlier versions of dnsmasq overloaded SIGHUP (which re-reads much configuration) to also enable time validation.
|
||||||
|
|
||||||
If dnsmasq is run in debug mode (-d flag) then SIGINT retains its usual meaning of terminating the dnsmasq process.
|
If dnsmasq is run in debug mode (\fB--no-daemon\fP flag) then SIGINT retains its usual meaning of terminating the dnsmasq process.
|
||||||
.TP
|
.TP
|
||||||
.B --dnssec-timestamp=<path>
|
.B --dnssec-timestamp=<path>
|
||||||
Enables an alternative way of checking the validity of the system time for DNSSEC (see --dnssec-no-timecheck). In this case, the
|
Enables an alternative way of checking the validity of the system time for DNSSEC (see \fB--dnssec-no-timecheck\fP). In this case, the
|
||||||
system time is considered to be valid once it becomes later than the timestamp on the specified file. The file is created and
|
system time is considered to be valid once it becomes later than the timestamp on the specified file. The file is created and
|
||||||
its timestamp set automatically by dnsmasq. The file must be stored on a persistent filesystem, so that it and its mtime are carried
|
its timestamp set automatically by dnsmasq. The file must be stored on a persistent filesystem, so that it and its mtime are carried
|
||||||
over system restarts. The timestamp file is created after dnsmasq has dropped root, so it must be in a location writable by the
|
over system restarts. The timestamp file is created after dnsmasq has dropped root, so it must be in a location writable by the
|
||||||
@@ -782,7 +800,7 @@ interface addresses may be confined to only IPv6 addresses using
|
|||||||
an interface has dynamically determined global IPv6 addresses which should
|
an interface has dynamically determined global IPv6 addresses which should
|
||||||
appear in the zone, but RFC1918 IPv4 addresses which should not.
|
appear in the zone, but RFC1918 IPv4 addresses which should not.
|
||||||
Interface-name and address-literal subnet specifications may be used
|
Interface-name and address-literal subnet specifications may be used
|
||||||
freely in the same --auth-zone declaration.
|
freely in the same \fB--auth-zone\fP declaration.
|
||||||
|
|
||||||
It's possible to exclude certain IP addresses from responses. It can be
|
It's possible to exclude certain IP addresses from responses. It can be
|
||||||
used, to make sure that answers contain only global routeable IP
|
used, to make sure that answers contain only global routeable IP
|
||||||
@@ -809,8 +827,13 @@ authoritative zones as dnsmasq.
|
|||||||
.B --auth-peer=<ip-address>[,<ip-address>[,<ip-address>...]]
|
.B --auth-peer=<ip-address>[,<ip-address>[,<ip-address>...]]
|
||||||
Specify the addresses of secondary servers which are allowed to
|
Specify the addresses of secondary servers which are allowed to
|
||||||
initiate zone transfer (AXFR) requests for zones for which dnsmasq is
|
initiate zone transfer (AXFR) requests for zones for which dnsmasq is
|
||||||
authoritative. If this option is not given, then AXFR requests will be
|
authoritative. If this option is not given but --auth-sec-servers is,
|
||||||
accepted from any secondary.
|
then AXFR requests will be
|
||||||
|
accepted from any secondary. Specifying
|
||||||
|
.B --auth-peer
|
||||||
|
without
|
||||||
|
.B --auth-sec-servers
|
||||||
|
enables zone transfer but does not advertise the secondary in NS records returned by dnsmasq.
|
||||||
.TP
|
.TP
|
||||||
.B --conntrack
|
.B --conntrack
|
||||||
Read the Linux connection track mark associated with incoming DNS
|
Read the Linux connection track mark associated with incoming DNS
|
||||||
@@ -820,7 +843,7 @@ associated with the queries which cause it, useful for bandwidth
|
|||||||
accounting and firewalling. Dnsmasq must have conntrack support
|
accounting and firewalling. Dnsmasq must have conntrack support
|
||||||
compiled in and the kernel must have conntrack support
|
compiled in and the kernel must have conntrack support
|
||||||
included and configured. This option cannot be combined with
|
included and configured. This option cannot be combined with
|
||||||
--query-port.
|
.B --query-port.
|
||||||
.TP
|
.TP
|
||||||
.B \-F, --dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-addr>[,<end-addr>|<mode>][,<netmask>[,<broadcast>]][,<lease time>]
|
.B \-F, --dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-addr>[,<end-addr>|<mode>][,<netmask>[,<broadcast>]][,<lease time>]
|
||||||
.TP
|
.TP
|
||||||
@@ -829,7 +852,7 @@ included and configured. This option cannot be combined with
|
|||||||
Enable the DHCP server. Addresses will be given out from the range
|
Enable the DHCP server. Addresses will be given out from the range
|
||||||
<start-addr> to <end-addr> and from statically defined addresses given
|
<start-addr> to <end-addr> and from statically defined addresses given
|
||||||
in
|
in
|
||||||
.B dhcp-host
|
.B --dhcp-host
|
||||||
options. If the lease time is given, then leases
|
options. If the lease time is given, then leases
|
||||||
will be given for that length of time. The lease time is in seconds,
|
will be given for that length of time. The lease time is in seconds,
|
||||||
or minutes (eg 45m) or hours (eg 1h) or "infinite". If not given,
|
or minutes (eg 45m) or hours (eg 1h) or "infinite". If not given,
|
||||||
@@ -848,7 +871,7 @@ agent, dnsmasq cannot determine the netmask itself, so it should be
|
|||||||
specified, otherwise dnsmasq will have to guess, based on the class (A, B or
|
specified, otherwise dnsmasq will have to guess, based on the class (A, B or
|
||||||
C) of the network address. The broadcast address is
|
C) of the network address. The broadcast address is
|
||||||
always optional. It is always
|
always optional. It is always
|
||||||
allowed to have more than one dhcp-range in a single subnet.
|
allowed to have more than one \fB--dhcp-range\fP in a single subnet.
|
||||||
|
|
||||||
For IPv6, the parameters are slightly different: instead of netmask
|
For IPv6, the parameters are slightly different: instead of netmask
|
||||||
and broadcast address, there is an optional prefix length which must
|
and broadcast address, there is an optional prefix length which must
|
||||||
@@ -872,7 +895,7 @@ then deleted. The interface name may have a final "*" wildcard. Note
|
|||||||
that just any address on eth0 will not do: it must not be an
|
that just any address on eth0 will not do: it must not be an
|
||||||
autoconfigured or privacy address, or be deprecated.
|
autoconfigured or privacy address, or be deprecated.
|
||||||
|
|
||||||
If a dhcp-range is only being used for stateless DHCP and/or SLAAC,
|
If a \fB--dhcp-range\fP is only being used for stateless DHCP and/or SLAAC,
|
||||||
then the address can be simply ::
|
then the address can be simply ::
|
||||||
|
|
||||||
.B --dhcp-range=::,constructor:eth0
|
.B --dhcp-range=::,constructor:eth0
|
||||||
@@ -891,7 +914,7 @@ The optional <mode> keyword may be
|
|||||||
which tells dnsmasq to enable DHCP for the network specified, but not
|
which tells dnsmasq to enable DHCP for the network specified, but not
|
||||||
to dynamically allocate IP addresses: only hosts which have static
|
to dynamically allocate IP addresses: only hosts which have static
|
||||||
addresses given via
|
addresses given via
|
||||||
.B dhcp-host
|
.B --dhcp-host
|
||||||
or from /etc/ethers will be served. A static-only subnet with address
|
or from /etc/ethers will be served. A static-only subnet with address
|
||||||
all zeros may be used as a "catch-all" address to enable replies to all
|
all zeros may be used as a "catch-all" address to enable replies to all
|
||||||
Information-request packets on a subnet which is provided with
|
Information-request packets on a subnet which is provided with
|
||||||
@@ -902,9 +925,9 @@ For IPv4, the <mode> may be
|
|||||||
.B proxy
|
.B proxy
|
||||||
in which case dnsmasq will provide proxy-DHCP on the specified
|
in which case dnsmasq will provide proxy-DHCP on the specified
|
||||||
subnet. (See
|
subnet. (See
|
||||||
.B pxe-prompt
|
.B --pxe-prompt
|
||||||
and
|
and
|
||||||
.B pxe-service
|
.B --pxe-service
|
||||||
for details.)
|
for details.)
|
||||||
|
|
||||||
For IPv6, the mode may be some combination of
|
For IPv6, the mode may be some combination of
|
||||||
@@ -970,10 +993,10 @@ dnsmasq to always allocate the machine lap the IP address
|
|||||||
192.168.0.199.
|
192.168.0.199.
|
||||||
|
|
||||||
Addresses allocated like this are not constrained to be
|
Addresses allocated like this are not constrained to be
|
||||||
in the range given by the --dhcp-range option, but they must be in
|
in the range given by the \fB--dhcp-range\fP option, but they must be in
|
||||||
the same subnet as some valid dhcp-range. For
|
the same subnet as some valid dhcp-range. For
|
||||||
subnets which don't need a pool of dynamically allocated addresses,
|
subnets which don't need a pool of dynamically allocated addresses,
|
||||||
use the "static" keyword in the dhcp-range declaration.
|
use the "static" keyword in the \fB--dhcp-range\fP declaration.
|
||||||
|
|
||||||
It is allowed to use client identifiers (called client
|
It is allowed to use client identifiers (called client
|
||||||
DUID in IPv6-land) rather than
|
DUID in IPv6-land) rather than
|
||||||
@@ -984,7 +1007,7 @@ allowed to specify the client ID as text, like this:
|
|||||||
.B --dhcp-host=id:clientidastext,.....
|
.B --dhcp-host=id:clientidastext,.....
|
||||||
|
|
||||||
A single
|
A single
|
||||||
.B dhcp-host
|
.B --dhcp-host
|
||||||
may contain an IPv4 address or an IPv6 address, or both. IPv6 addresses must be bracketed by square brackets thus:
|
may contain an IPv4 address or an IPv6 address, or both. IPv6 addresses must be bracketed by square brackets thus:
|
||||||
.B --dhcp-host=laptop,[1234::56]
|
.B --dhcp-host=laptop,[1234::56]
|
||||||
IPv6 addresses may contain only the host-identifier part:
|
IPv6 addresses may contain only the host-identifier part:
|
||||||
@@ -1005,7 +1028,7 @@ allocated to a DHCP lease, but only if a
|
|||||||
.B --dhcp-host
|
.B --dhcp-host
|
||||||
option specifying the name also exists. Only one hostname can be
|
option specifying the name also exists. Only one hostname can be
|
||||||
given in a
|
given in a
|
||||||
.B dhcp-host
|
.B --dhcp-host
|
||||||
option, but aliases are possible by using CNAMEs. (See
|
option, but aliases are possible by using CNAMEs. (See
|
||||||
.B --cname
|
.B --cname
|
||||||
).
|
).
|
||||||
@@ -1020,15 +1043,15 @@ useful when there is another DHCP server on the network which should
|
|||||||
be used by some machines.
|
be used by some machines.
|
||||||
|
|
||||||
The set:<tag> construct sets the tag
|
The set:<tag> construct sets the tag
|
||||||
whenever this dhcp-host directive is in use. This can be used to
|
whenever this \fB--dhcp-host\fP directive is in use. This can be used to
|
||||||
selectively send DHCP options just for this host. More than one tag
|
selectively send DHCP options just for this host. More than one tag
|
||||||
can be set in a dhcp-host directive (but not in other places where
|
can be set in a \fB--dhcp-host\fP directive (but not in other places where
|
||||||
"set:<tag>" is allowed). When a host matches any
|
"set:<tag>" is allowed). When a host matches any
|
||||||
dhcp-host directive (or one implied by /etc/ethers) then the special
|
\fB--dhcp-host\fP directive (or one implied by /etc/ethers) then the special
|
||||||
tag "known" is set. This allows dnsmasq to be configured to
|
tag "known" is set. This allows dnsmasq to be configured to
|
||||||
ignore requests from unknown machines using
|
ignore requests from unknown machines using
|
||||||
.B --dhcp-ignore=tag:!known
|
.B --dhcp-ignore=tag:!known
|
||||||
If the host matches only a dhcp-host directive which cannot
|
If the host matches only a \fB--dhcp-host\fP directive which cannot
|
||||||
be used because it specifies an address on different subnet, the tag "known-othernet" is set.
|
be used because it specifies an address on different subnet, the tag "known-othernet" is set.
|
||||||
Ethernet addresses (but not client-ids) may have
|
Ethernet addresses (but not client-ids) may have
|
||||||
wildcard bytes, so for example
|
wildcard bytes, so for example
|
||||||
@@ -1061,23 +1084,23 @@ has both wired and wireless interfaces.
|
|||||||
Read DHCP host information from the specified file. If a directory
|
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
|
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
|
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
|
as text to the right of '=' in \fB--dhcp-host\fP. The advantage of storing DHCP host information
|
||||||
in this file is that it can be changed without re-starting dnsmasq:
|
in this file is that it can be changed without re-starting dnsmasq:
|
||||||
the file will be re-read when dnsmasq receives SIGHUP.
|
the file will be re-read when dnsmasq receives SIGHUP.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-optsfile=<path>
|
.B --dhcp-optsfile=<path>
|
||||||
Read DHCP option information from the specified file. If a directory
|
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
|
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
|
using this option is the same as for \fB--dhcp-hostsfile\fP: the
|
||||||
dhcp-optsfile will be re-read when dnsmasq receives SIGHUP. Note that
|
\fB--dhcp-optsfile\fP will be re-read when dnsmasq receives SIGHUP. Note that
|
||||||
it is possible to encode the information in a
|
it is possible to encode the information in a
|
||||||
.B --dhcp-boot
|
.B --dhcp-boot
|
||||||
flag as DHCP options, using the options names bootfile-name,
|
flag as DHCP options, using the options names bootfile-name,
|
||||||
server-ip-address and tftp-server. This allows these to be included
|
server-ip-address and tftp-server. This allows these to be included
|
||||||
in a dhcp-optsfile.
|
in a \fB--dhcp-optsfile\fP.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-hostsdir=<path>
|
.B --dhcp-hostsdir=<path>
|
||||||
This is equivalent to dhcp-hostsfile, except for the following. The path MUST be a
|
This is equivalent to \fB--dhcp-hostsfile\fP, except for the following. The path MUST be a
|
||||||
directory, and not an individual file. Changed or new files within
|
directory, and not an individual file. Changed or new files within
|
||||||
the directory are read automatically, without the need to send SIGHUP.
|
the directory are read automatically, without the need to send SIGHUP.
|
||||||
If a file is deleted or changed after it has been read by dnsmasq, then the
|
If a file is deleted or changed after it has been read by dnsmasq, then the
|
||||||
@@ -1085,7 +1108,7 @@ host record it contained will remain until dnsmasq receives a SIGHUP, or
|
|||||||
is restarted; ie host records are only added dynamically.
|
is restarted; ie host records are only added dynamically.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-optsdir=<path>
|
.B --dhcp-optsdir=<path>
|
||||||
This is equivalent to dhcp-optsfile, with the differences noted for --dhcp-hostsdir.
|
This is equivalent to \fB--dhcp-optsfile\fP, with the differences noted for \fB--dhcp-hostsdir\fP.
|
||||||
.TP
|
.TP
|
||||||
.B \-Z, --read-ethers
|
.B \-Z, --read-ethers
|
||||||
Read /etc/ethers for information about hosts for the DHCP server. The
|
Read /etc/ethers for information about hosts for the DHCP server. The
|
||||||
@@ -1156,12 +1179,12 @@ a literal IP address as TFTP server name, it is necessary to do
|
|||||||
.B --dhcp-option=66,"1.2.3.4"
|
.B --dhcp-option=66,"1.2.3.4"
|
||||||
|
|
||||||
Encapsulated Vendor-class options may also be specified (IPv4 only) using
|
Encapsulated Vendor-class options may also be specified (IPv4 only) using
|
||||||
--dhcp-option: for instance
|
\fB--dhcp-option\fP: for instance
|
||||||
.B --dhcp-option=vendor:PXEClient,1,0.0.0.0
|
.B --dhcp-option=vendor:PXEClient,1,0.0.0.0
|
||||||
sends the encapsulated vendor
|
sends the encapsulated vendor
|
||||||
class-specific option "mftp-address=0.0.0.0" to any client whose
|
class-specific option "mftp-address=0.0.0.0" to any client whose
|
||||||
vendor-class matches "PXEClient". The vendor-class matching is
|
vendor-class matches "PXEClient". The vendor-class matching is
|
||||||
substring based (see --dhcp-vendorclass for details). If a
|
substring based (see \fB--dhcp-vendorclass\fP for details). If a
|
||||||
vendor-class option (number 60) is sent by dnsmasq, then that is used
|
vendor-class option (number 60) is sent by dnsmasq, then that is used
|
||||||
for selecting encapsulated options in preference to any sent by the
|
for selecting encapsulated options in preference to any sent by the
|
||||||
client. It is
|
client. It is
|
||||||
@@ -1174,7 +1197,7 @@ Options may be encapsulated (IPv4 only) within other options: for instance
|
|||||||
will send option 175, within which is the option 190. If multiple
|
will send option 175, within which is the option 190. If multiple
|
||||||
options are given which are encapsulated with the same option number
|
options are given which are encapsulated with the same option number
|
||||||
then they will be correctly combined into one encapsulated option.
|
then they will be correctly combined into one encapsulated option.
|
||||||
encap: and vendor: are may not both be set in the same dhcp-option.
|
encap: and vendor: are may not both be set in the same \fB--dhcp-option\fP.
|
||||||
|
|
||||||
The final variant on encapsulated options is "Vendor-Identifying
|
The final variant on encapsulated options is "Vendor-Identifying
|
||||||
Vendor Options" as specified by RFC3925. These are denoted like this:
|
Vendor Options" as specified by RFC3925. These are denoted like this:
|
||||||
@@ -1196,7 +1219,7 @@ needed, for example when sending options to PXELinux.
|
|||||||
.B --dhcp-no-override
|
.B --dhcp-no-override
|
||||||
(IPv4 only) Disable re-use of the DHCP servername and filename fields as extra
|
(IPv4 only) Disable re-use of the DHCP servername and filename fields as extra
|
||||||
option space. If it can, dnsmasq moves the boot server and filename
|
option space. If it can, dnsmasq moves the boot server and filename
|
||||||
information (from dhcp-boot) out of their dedicated fields into
|
information (from \fB--dhcp-boot\fP) out of their dedicated fields into
|
||||||
DHCP options. This make extra space available in the DHCP packet for
|
DHCP options. This make extra space available in the DHCP packet for
|
||||||
options but can, rarely, confuse old or broken clients. This flag
|
options but can, rarely, confuse old or broken clients. This flag
|
||||||
forces "simple and safe" behaviour to avoid problems in such a case.
|
forces "simple and safe" behaviour to avoid problems in such a case.
|
||||||
@@ -1206,7 +1229,7 @@ Configure dnsmasq to do DHCP relay. The local address is an address
|
|||||||
allocated to an interface on the host running dnsmasq. All DHCP
|
allocated to an interface on the host running dnsmasq. All DHCP
|
||||||
requests arriving on that interface will we relayed to a remote DHCP
|
requests arriving on that interface will we relayed to a remote DHCP
|
||||||
server at the server address. It is possible to relay from a single local
|
server at the server address. It is possible to relay from a single local
|
||||||
address to multiple remote servers by using multiple dhcp-relay
|
address to multiple remote servers by using multiple \fB--dhcp-relay\fP
|
||||||
configs with the same local address and different server
|
configs with the same local address and different server
|
||||||
addresses. A server address must be an IP literal address, not a
|
addresses. A server address must be an IP literal address, not a
|
||||||
domain name. In the case of DHCPv6, the server address may be the
|
domain name. In the case of DHCPv6, the server address may be the
|
||||||
@@ -1215,8 +1238,8 @@ must be given, not be wildcard, and is used to direct the multicast to the
|
|||||||
correct interface to reach the DHCP server.
|
correct interface to reach the DHCP server.
|
||||||
|
|
||||||
Access control for DHCP clients has the same rules as for the DHCP
|
Access control for DHCP clients has the same rules as for the DHCP
|
||||||
server, see --interface, --except-interface, etc. The optional
|
server, see \fB--interface\fP, \fB--except-interface\fP, etc. The optional
|
||||||
interface name in the dhcp-relay config has a different function: it
|
interface name in the \fB--dhcp-relay\fP config has a different function: it
|
||||||
controls on which interface DHCP replies from the server will be
|
controls on which interface DHCP replies from the server will be
|
||||||
accepted. This is intended for configurations which have three
|
accepted. This is intended for configurations which have three
|
||||||
interfaces: one being relayed from, a second connecting the DHCP
|
interfaces: one being relayed from, a second connecting the DHCP
|
||||||
@@ -1238,7 +1261,7 @@ Map from a vendor-class string to a tag. Most DHCP clients provide a
|
|||||||
"vendor class" which represents, in some sense, the type of host. This option
|
"vendor class" which represents, in some sense, the type of host. This option
|
||||||
maps vendor classes to tags, so that DHCP options may be selectively delivered
|
maps vendor classes to tags, so that DHCP options may be selectively delivered
|
||||||
to different classes of hosts. For example
|
to different classes of hosts. For example
|
||||||
.B dhcp-vendorclass=set:printers,Hewlett-Packard JetDirect
|
.B --dhcp-vendorclass=set:printers,Hewlett-Packard JetDirect
|
||||||
will allow options to be set only for HP printers like so:
|
will allow options to be set only for HP printers like so:
|
||||||
.B --dhcp-option=tag:printers,3,192.168.4.4
|
.B --dhcp-option=tag:printers,3,192.168.4.4
|
||||||
The vendor-class string is
|
The vendor-class string is
|
||||||
@@ -1273,8 +1296,8 @@ normally given as colon-separated hex, but is also allowed to be a
|
|||||||
simple string. If an exact match is achieved between the circuit or
|
simple string. If an exact match is achieved between the circuit or
|
||||||
agent ID and one provided by a relay agent, the tag is set.
|
agent ID and one provided by a relay agent, the tag is set.
|
||||||
|
|
||||||
.B dhcp-remoteid
|
.B --dhcp-remoteid
|
||||||
(but not dhcp-circuitid) is supported in IPv6.
|
(but not \fB--dhcp-circuitid\fP) is supported in IPv6.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-subscrid=set:<tag>,<subscriber-id>
|
.B --dhcp-subscrid=set:<tag>,<subscriber-id>
|
||||||
(IPv4 and IPv6) Map from RFC3993 subscriber-id relay agent options to tags.
|
(IPv4 and IPv6) Map from RFC3993 subscriber-id relay agent options to tags.
|
||||||
@@ -1285,9 +1308,9 @@ a DHCP interaction to the DHCP server. Once a client is configured, it
|
|||||||
communicates directly with the server. This is undesirable if the
|
communicates directly with the server. This is undesirable if the
|
||||||
relay agent is adding extra information to the DHCP packets, such as
|
relay agent is adding extra information to the DHCP packets, such as
|
||||||
that used by
|
that used by
|
||||||
.B dhcp-circuitid
|
.B --dhcp-circuitid
|
||||||
and
|
and
|
||||||
.B dhcp-remoteid.
|
.B --dhcp-remoteid.
|
||||||
A full relay implementation can use the RFC 5107 serverid-override
|
A full relay implementation can use the RFC 5107 serverid-override
|
||||||
option to force the DHCP server to use the relay as a full proxy, with all
|
option to force the DHCP server to use the relay as a full proxy, with all
|
||||||
packets passing through it. This flag provides an alternative method
|
packets passing through it. This flag provides an alternative method
|
||||||
@@ -1303,12 +1326,10 @@ the option is sent and matches the value. The value may be of the form
|
|||||||
"01:ff:*:02" in which case the value must match (apart from wildcards)
|
"01:ff:*:02" in which case the value must match (apart from wildcards)
|
||||||
but the option sent may have unmatched data past the end of the
|
but the option sent may have unmatched data past the end of the
|
||||||
value. The value may also be of the same form as in
|
value. The value may also be of the same form as in
|
||||||
.B dhcp-option
|
.B --dhcp-option
|
||||||
in which case the option sent is treated as an array, and one element
|
in which case the option sent is treated as an array, and one element
|
||||||
must match, so
|
must match, so
|
||||||
|
.B --dhcp-match=set:efi-ia32,option:client-arch,6
|
||||||
--dhcp-match=set:efi-ia32,option:client-arch,6
|
|
||||||
|
|
||||||
will set the tag "efi-ia32" if the the number 6 appears in the list of
|
will set the tag "efi-ia32" if the the number 6 appears in the list of
|
||||||
architectures sent by the client in option 93. (See RFC 4578 for
|
architectures sent by the client in option 93. (See RFC 4578 for
|
||||||
details.) If the value is a string, substring matching is used.
|
details.) If the value is a string, substring matching is used.
|
||||||
@@ -1317,14 +1338,17 @@ The special form with vi-encap:<enterprise number> matches against
|
|||||||
vendor-identifying vendor classes for the specified enterprise. Please
|
vendor-identifying vendor classes for the specified enterprise. Please
|
||||||
see RFC 3925 for more details of these rare and interesting beasts.
|
see RFC 3925 for more details of these rare and interesting beasts.
|
||||||
.TP
|
.TP
|
||||||
|
.B --dhcp-name-match=set:<tag>,<name>[*]
|
||||||
|
Set the tag if the given name is supplied by a dhcp client. There may be a single trailing wildcard *, which has the usual meaning. Combined with dhcp-ignore or dhcp-ignore-names this gives the ability to ignore certain clients by name, or disallow certain hostnames from being claimed by a client.
|
||||||
|
.TP
|
||||||
.B --tag-if=set:<tag>[,set:<tag>[,tag:<tag>[,tag:<tag>]]]
|
.B --tag-if=set:<tag>[,set:<tag>[,tag:<tag>[,tag:<tag>]]]
|
||||||
Perform boolean operations on tags. Any tag appearing as set:<tag> is set if
|
Perform boolean operations on tags. Any tag appearing as set:<tag> is set if
|
||||||
all the tags which appear as tag:<tag> are set, (or unset when tag:!<tag> is used)
|
all the tags which appear as tag:<tag> are set, (or unset when tag:!<tag> is used)
|
||||||
If no tag:<tag> appears set:<tag> tags are set unconditionally.
|
If no tag:<tag> appears set:<tag> tags are set unconditionally.
|
||||||
Any number of set: and tag: forms may appear, in any order.
|
Any number of set: and tag: forms may appear, in any order.
|
||||||
Tag-if lines are executed in order, so if the tag in tag:<tag> is a
|
\fB--tag-if\fP lines are executed in order, so if the tag in tag:<tag> is a
|
||||||
tag set by another
|
tag set by another
|
||||||
.B tag-if,
|
.B --tag-if,
|
||||||
the line which sets the tag must precede the one which tests it.
|
the line which sets the tag must precede the one which tests it.
|
||||||
.TP
|
.TP
|
||||||
.B \-J, --dhcp-ignore=tag:<tag>[,tag:<tag>]
|
.B \-J, --dhcp-ignore=tag:<tag>[,tag:<tag>]
|
||||||
@@ -1333,10 +1357,10 @@ not allocate it a DHCP lease.
|
|||||||
.TP
|
.TP
|
||||||
.B --dhcp-ignore-names[=tag:<tag>[,tag:<tag>]]
|
.B --dhcp-ignore-names[=tag:<tag>[,tag:<tag>]]
|
||||||
When all the given tags appear in the tag set, ignore any hostname
|
When all the given tags appear in the tag set, ignore any hostname
|
||||||
provided by the host. Note that, unlike dhcp-ignore, it is permissible
|
provided by the host. Note that, unlike \fB--dhcp-ignore\fP, it is permissible
|
||||||
to supply no tags, in which case DHCP-client supplied hostnames
|
to supply no tags, in which case DHCP-client supplied hostnames
|
||||||
are always ignored, and DHCP hosts are added to the DNS using only
|
are always ignored, and DHCP hosts are added to the DNS using only
|
||||||
dhcp-host configuration in dnsmasq and the contents of /etc/hosts and
|
\fB--dhcp-host\fP configuration in dnsmasq and the contents of /etc/hosts and
|
||||||
/etc/ethers.
|
/etc/ethers.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-generate-names=tag:<tag>[,tag:<tag>]
|
.B --dhcp-generate-names=tag:<tag>[,tag:<tag>]
|
||||||
@@ -1384,7 +1408,7 @@ likely to move IP address; for this reason it should not be generally used.
|
|||||||
.B --pxe-service=[tag:<tag>,]<CSA>,<menu text>[,<basename>|<bootservicetype>][,<server address>|<server_name>]
|
.B --pxe-service=[tag:<tag>,]<CSA>,<menu text>[,<basename>|<bootservicetype>][,<server address>|<server_name>]
|
||||||
Most uses of PXE boot-ROMS simply allow the PXE
|
Most uses of PXE boot-ROMS simply allow the PXE
|
||||||
system to obtain an IP address and then download the file specified by
|
system to obtain an IP address and then download the file specified by
|
||||||
.B dhcp-boot
|
.B --dhcp-boot
|
||||||
and execute it. However the PXE system is capable of more complex
|
and execute it. However the PXE system is capable of more complex
|
||||||
functions when supported by a suitable DHCP server.
|
functions when supported by a suitable DHCP server.
|
||||||
|
|
||||||
@@ -1396,7 +1420,7 @@ integer may be used for other types. The
|
|||||||
parameter after the menu text may be a file name, in which case dnsmasq acts as a
|
parameter after the menu text may be a file name, in which case dnsmasq acts as a
|
||||||
boot server and directs the PXE client to download the file by TFTP,
|
boot server and directs the PXE client to download the file by TFTP,
|
||||||
either from itself (
|
either from itself (
|
||||||
.B enable-tftp
|
.B --enable-tftp
|
||||||
must be set for this to work) or another TFTP server if the final server
|
must be set for this to work) or another TFTP server if the final server
|
||||||
address/name is given.
|
address/name is given.
|
||||||
Note that the "layer"
|
Note that the "layer"
|
||||||
@@ -1418,23 +1442,23 @@ timeout is given then after the
|
|||||||
timeout has elapsed with no keyboard input, the first available menu
|
timeout has elapsed with no keyboard input, the first available menu
|
||||||
option will be automatically executed. If the timeout is zero then the first available menu
|
option will be automatically executed. If the timeout is zero then the first available menu
|
||||||
item will be executed immediately. If
|
item will be executed immediately. If
|
||||||
.B pxe-prompt
|
.B --pxe-prompt
|
||||||
is omitted the system will wait for user input if there are multiple
|
is omitted the system will wait for user input if there are multiple
|
||||||
items in the menu, but boot immediately if
|
items in the menu, but boot immediately if
|
||||||
there is only one. See
|
there is only one. See
|
||||||
.B pxe-service
|
.B --pxe-service
|
||||||
for details of menu items.
|
for details of menu items.
|
||||||
|
|
||||||
Dnsmasq supports PXE "proxy-DHCP", in this case another DHCP server on
|
Dnsmasq supports PXE "proxy-DHCP", in this case another DHCP server on
|
||||||
the network is responsible for allocating IP addresses, and dnsmasq
|
the network is responsible for allocating IP addresses, and dnsmasq
|
||||||
simply provides the information given in
|
simply provides the information given in
|
||||||
.B pxe-prompt
|
.B --pxe-prompt
|
||||||
and
|
and
|
||||||
.B pxe-service
|
.B --pxe-service
|
||||||
to allow netbooting. This mode is enabled using the
|
to allow netbooting. This mode is enabled using the
|
||||||
.B proxy
|
.B proxy
|
||||||
keyword in
|
keyword in
|
||||||
.B dhcp-range.
|
.B --dhcp-range.
|
||||||
.TP
|
.TP
|
||||||
.B \-X, --dhcp-lease-max=<number>
|
.B \-X, --dhcp-lease-max=<number>
|
||||||
Limits dnsmasq to the specified maximum number of DHCP leases. The
|
Limits dnsmasq to the specified maximum number of DHCP leases. The
|
||||||
@@ -1487,8 +1511,8 @@ the tags used to determine them.
|
|||||||
.TP
|
.TP
|
||||||
.B --quiet-dhcp, --quiet-dhcp6, --quiet-ra
|
.B --quiet-dhcp, --quiet-dhcp6, --quiet-ra
|
||||||
Suppress logging of the routine operation of these protocols. Errors and
|
Suppress logging of the routine operation of these protocols. Errors and
|
||||||
problems will still be logged. --quiet-dhcp and quiet-dhcp6 are
|
problems will still be logged. \fB--quiet-dhcp\fP and quiet-dhcp6 are
|
||||||
over-ridden by --log-dhcp.
|
over-ridden by \fB--log-dhcp\fP.
|
||||||
.TP
|
.TP
|
||||||
.B \-l, --dhcp-leasefile=<path>
|
.B \-l, --dhcp-leasefile=<path>
|
||||||
Use the specified file to store DHCP lease information.
|
Use the specified file to store DHCP lease information.
|
||||||
@@ -1514,7 +1538,7 @@ address of the host (or DUID for IPv6) , the IP address, and the hostname,
|
|||||||
if known. "add" means a lease has been created, "del" means it has
|
if known. "add" means a lease has been created, "del" means it has
|
||||||
been destroyed, "old" is a notification of an existing lease when
|
been destroyed, "old" is a notification of an existing lease when
|
||||||
dnsmasq starts or a change to MAC address or hostname of an existing
|
dnsmasq starts or a change to MAC address or hostname of an existing
|
||||||
lease (also, lease length or expiry and client-id, if leasefile-ro is set).
|
lease (also, lease length or expiry and client-id, if \fB--leasefile-ro\fP is set).
|
||||||
If the MAC address is from a network type other than ethernet,
|
If the MAC address is from a network type other than ethernet,
|
||||||
it will have the network type prepended, eg "06-01:23:45:67:89:ab" for
|
it will have the network type prepended, eg "06-01:23:45:67:89:ab" for
|
||||||
token ring. The process is run as root (assuming that dnsmasq was originally run as
|
token ring. The process is run as root (assuming that dnsmasq was originally run as
|
||||||
@@ -1688,7 +1712,7 @@ and
|
|||||||
Specify the user as which to run the lease-change script or Lua script. This defaults to root, but can be changed to another user using this flag.
|
Specify the user as which to run the lease-change script or Lua script. This defaults to root, but can be changed to another user using this flag.
|
||||||
.TP
|
.TP
|
||||||
.B --script-arp
|
.B --script-arp
|
||||||
Enable the "arp" and "arp-old" functions in the dhcp-script and dhcp-luascript.
|
Enable the "arp" and "arp-old" functions in the \fB--dhcp-script\fP and \fB--dhcp-luascript\fP.
|
||||||
.TP
|
.TP
|
||||||
.B \-9, --leasefile-ro
|
.B \-9, --leasefile-ro
|
||||||
Completely suppress use of the lease database file. The file will not
|
Completely suppress use of the lease database file. The file will not
|
||||||
@@ -1713,9 +1737,9 @@ OpenStack compute host where each such interface is a TAP interface to
|
|||||||
a VM, or as in "old style bridging" on BSD platforms. A trailing '*'
|
a VM, or as in "old style bridging" on BSD platforms. A trailing '*'
|
||||||
wildcard can be used in each <alias>.
|
wildcard can be used in each <alias>.
|
||||||
|
|
||||||
It is permissible to add more than one alias using more than one --bridge-interface option since
|
It is permissible to add more than one alias using more than one \fB--bridge-interface\fP option since
|
||||||
--bridge-interface=int1,alias1,alias2 is exactly equivalent to
|
\fB--bridge-interface=int1,alias1,alias2\fP is exactly equivalent to
|
||||||
--bridge-interface=int1,alias1 --bridge-interface=int1,alias2
|
\fB--bridge-interface=int1,alias1 --bridge-interface=int1,alias2\fP
|
||||||
.TP
|
.TP
|
||||||
.B \-s, --domain=<domain>[,<address range>[,local]]
|
.B \-s, --domain=<domain>[,<address range>[,local]]
|
||||||
Specifies DNS domains for the DHCP server. Domains may be be given
|
Specifies DNS domains for the DHCP server. Domains may be be given
|
||||||
@@ -1746,11 +1770,11 @@ which can change the behaviour of dnsmasq with domains.
|
|||||||
|
|
||||||
If the address range is given as ip-address/network-size, then a
|
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
|
additional flag "local" may be supplied which has the effect of adding
|
||||||
--local declarations for forward and reverse DNS queries. Eg.
|
\fB--local\fP declarations for forward and reverse DNS queries. Eg.
|
||||||
.B --domain=thekelleys.org.uk,192.168.0.0/24,local
|
.B --domain=thekelleys.org.uk,192.168.0.0/24,local
|
||||||
is identical to
|
is identical to
|
||||||
.B --domain=thekelleys.org.uk,192.168.0.0/24
|
.B --domain=thekelleys.org.uk,192.168.0.0/24
|
||||||
--local=/thekelleys.org.uk/ --local=/0.168.192.in-addr.arpa/
|
.B --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.
|
The network size must be 8, 16 or 24 for this to be legal.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-fqdn
|
.B --dhcp-fqdn
|
||||||
@@ -1785,7 +1809,7 @@ discovery and (possibly) prefix discovery for autonomous address
|
|||||||
creation are handled by a different protocol. When DHCP is in use,
|
creation are handled by a different protocol. When DHCP is in use,
|
||||||
only a subset of this is needed, and dnsmasq can handle it, using
|
only a subset of this is needed, and dnsmasq can handle it, using
|
||||||
existing DHCP configuration to provide most data. When RA is enabled,
|
existing DHCP configuration to provide most data. When RA is enabled,
|
||||||
dnsmasq will advertise a prefix for each dhcp-range, with default
|
dnsmasq will advertise a prefix for each \fB--dhcp-range\fP, with default
|
||||||
router as the relevant link-local address on
|
router as the relevant link-local address on
|
||||||
the machine running dnsmasq. By default, the "managed address" bits are set, and
|
the machine running dnsmasq. By default, the "managed address" bits are set, and
|
||||||
the "use SLAAC" bit is reset. This can be changed for individual
|
the "use SLAAC" bit is reset. This can be changed for individual
|
||||||
@@ -1840,9 +1864,9 @@ Do not abort startup if specified tftp root directories are inaccessible.
|
|||||||
.TP
|
.TP
|
||||||
.B --tftp-unique-root[=ip|mac]
|
.B --tftp-unique-root[=ip|mac]
|
||||||
Add the IP or hardware address of the TFTP client as a path component on the end
|
Add the IP or hardware address of the TFTP client as a path component on the end
|
||||||
of the TFTP-root. Only valid if a tftp-root is set and the directory exists.
|
of the TFTP-root. Only valid if a \fB--tftp-root\fP is set and the directory exists.
|
||||||
Defaults to adding IP address (in standard dotted-quad format).
|
Defaults to adding IP address (in standard dotted-quad format).
|
||||||
For instance, if tftp-root is "/tftp" and client 1.2.3.4 requests file "myfile"
|
For instance, if \fB--tftp-root\fP is "/tftp" and client 1.2.3.4 requests file "myfile"
|
||||||
then the effective path will be "/tftp/1.2.3.4/myfile" if /tftp/1.2.3.4 exists or /tftp/myfile otherwise.
|
then the effective path will be "/tftp/1.2.3.4/myfile" if /tftp/1.2.3.4 exists or /tftp/myfile otherwise.
|
||||||
When "=mac" is specified it will append the MAC address instead, using lowercase zero padded digits
|
When "=mac" is specified it will append the MAC address instead, using lowercase zero padded digits
|
||||||
separated by dashes, e.g.: 01-02-03-04-aa-bb
|
separated by dashes, e.g.: 01-02-03-04-aa-bb
|
||||||
@@ -1852,12 +1876,12 @@ a DHCP lease from us.
|
|||||||
.B --tftp-secure
|
.B --tftp-secure
|
||||||
Enable TFTP secure mode: without this, any file which is readable by
|
Enable TFTP secure mode: without this, any file which is readable by
|
||||||
the dnsmasq process under normal unix access-control rules is
|
the dnsmasq process under normal unix access-control rules is
|
||||||
available via TFTP. When the --tftp-secure flag is given, only files
|
available via TFTP. When the \fB--tftp-secure\fP flag is given, only files
|
||||||
owned by the user running the dnsmasq process are accessible. If
|
owned by the user running the dnsmasq process are accessible. If
|
||||||
dnsmasq is being run as root, different rules apply: --tftp-secure
|
dnsmasq is being run as root, different rules apply: \fB--tftp-secure\fP
|
||||||
has no effect, but only files which have the world-readable bit set
|
has no effect, but only files which have the world-readable bit set
|
||||||
are accessible. It is not recommended to run dnsmasq as root with TFTP
|
are accessible. It is not recommended to run dnsmasq as root with TFTP
|
||||||
enabled, and certainly not without specifying --tftp-root. Doing so
|
enabled, and certainly not without specifying \fB--tftp-root\fP. Doing so
|
||||||
can expose any world-readable file on the server to any host on the net.
|
can expose any world-readable file on the server to any host on the net.
|
||||||
.TP
|
.TP
|
||||||
.B --tftp-lowercase
|
.B --tftp-lowercase
|
||||||
@@ -1897,7 +1921,7 @@ cannot be lower than 1025 unless dnsmasq is running as root. The number
|
|||||||
of concurrent TFTP connections is limited by the size of the port range.
|
of concurrent TFTP connections is limited by the size of the port range.
|
||||||
.TP
|
.TP
|
||||||
.B \-C, --conf-file=<file>
|
.B \-C, --conf-file=<file>
|
||||||
Specify a different configuration file. The conf-file option is also allowed in
|
Specify a different configuration file. The \fB--conf-file\fP option is also allowed in
|
||||||
configuration files, to include multiple configuration files. A
|
configuration files, to include multiple configuration files. A
|
||||||
filename of "-" causes dnsmasq to read configuration from stdin.
|
filename of "-" causes dnsmasq to read configuration from stdin.
|
||||||
.TP
|
.TP
|
||||||
@@ -1915,7 +1939,7 @@ escape * characters.
|
|||||||
.B --servers-file=<file>
|
.B --servers-file=<file>
|
||||||
A special case of
|
A special case of
|
||||||
.B --conf-file
|
.B --conf-file
|
||||||
which differs in two respects. Firstly, only --server and --rev-server are allowed
|
which differs in two respects. Firstly, only \fB--server\fP and \fB--rev-server\fP are allowed
|
||||||
in the configuration file included. Secondly, the file is re-read and the configuration
|
in the configuration file included. Secondly, the file is re-read and the configuration
|
||||||
therein is updated when dnsmasq receives SIGHUP.
|
therein is updated when dnsmasq receives SIGHUP.
|
||||||
.SH CONFIG FILE
|
.SH CONFIG FILE
|
||||||
@@ -1925,9 +1949,9 @@ if it exists. (On
|
|||||||
FreeBSD, the file is
|
FreeBSD, the file is
|
||||||
.I /usr/local/etc/dnsmasq.conf
|
.I /usr/local/etc/dnsmasq.conf
|
||||||
) (but see the
|
) (but see the
|
||||||
.B \-C
|
.B \--conf-file
|
||||||
and
|
and
|
||||||
.B \-7
|
.B \--conf-dir
|
||||||
options.) The format of this
|
options.) The format of this
|
||||||
file consists of one option per line, exactly as the long options detailed
|
file consists of one option per line, exactly as the long options detailed
|
||||||
in the OPTIONS section but without the leading "--". Lines starting with # are comments and ignored. For
|
in the OPTIONS section but without the leading "--". Lines starting with # are comments and ignored. For
|
||||||
@@ -1943,8 +1967,8 @@ clears its cache and then re-loads
|
|||||||
.I /etc/hosts
|
.I /etc/hosts
|
||||||
and
|
and
|
||||||
.I /etc/ethers
|
.I /etc/ethers
|
||||||
and any file given by --dhcp-hostsfile, --dhcp-hostsdir, --dhcp-optsfile,
|
and any file given by \fB--dhcp-hostsfile\fP, \fB--dhcp-hostsdir\fP, \fB--dhcp-optsfile\fP,
|
||||||
--dhcp-optsdir, --addn-hosts or --hostsdir.
|
\fB--dhcp-optsdir\fP, \fB--addn-hosts\fP or \fB--hostsdir\fP.
|
||||||
The dhcp lease change script is called for all
|
The dhcp lease change script is called for all
|
||||||
existing DHCP leases. If
|
existing DHCP leases. If
|
||||||
.B
|
.B
|
||||||
@@ -1964,7 +1988,7 @@ misses and the number of authoritative queries answered are also given. For each
|
|||||||
server it gives the number of queries sent, and the number which
|
server it gives the number of queries sent, and the number which
|
||||||
resulted in an error. In
|
resulted in an error. In
|
||||||
.B --no-daemon
|
.B --no-daemon
|
||||||
mode or when full logging is enabled (-q), a complete dump of the
|
mode or when full logging is enabled (\fB--log-queries\fP), a complete dump of the
|
||||||
contents of the cache is made.
|
contents of the cache is made.
|
||||||
|
|
||||||
The cache statistics are also available in the DNS as answers to
|
The cache statistics are also available in the DNS as answers to
|
||||||
@@ -2045,7 +2069,7 @@ using
|
|||||||
options or put their addresses real in another file, say
|
options or put their addresses real in another file, say
|
||||||
.I /etc/resolv.dnsmasq
|
.I /etc/resolv.dnsmasq
|
||||||
and run dnsmasq with the
|
and run dnsmasq with the
|
||||||
.B \-r /etc/resolv.dnsmasq
|
.B \--resolv-file /etc/resolv.dnsmasq
|
||||||
option. This second technique allows for dynamic update of the server
|
option. This second technique allows for dynamic update of the server
|
||||||
addresses by PPP or DHCP.
|
addresses by PPP or DHCP.
|
||||||
.PP
|
.PP
|
||||||
@@ -2063,60 +2087,60 @@ the CNAME is shadowed too.
|
|||||||
The tag system works as follows: For each DHCP request, dnsmasq
|
The tag system works as follows: For each DHCP request, dnsmasq
|
||||||
collects a set of valid tags from active configuration lines which
|
collects a set of valid tags from active configuration lines which
|
||||||
include set:<tag>, including one from the
|
include set:<tag>, including one from the
|
||||||
.B dhcp-range
|
.B --dhcp-range
|
||||||
used to allocate the address, one from any matching
|
used to allocate the address, one from any matching
|
||||||
.B dhcp-host
|
.B --dhcp-host
|
||||||
(and "known" or "known-othernet" if a dhcp-host matches)
|
(and "known" or "known-othernet" if a \fB--dhcp-host\fP matches)
|
||||||
The tag "bootp" is set for BOOTP requests, and a tag whose name is the
|
The tag "bootp" is set for BOOTP requests, and a tag whose name is the
|
||||||
name of the interface on which the request arrived is also set.
|
name of the interface on which the request arrived is also set.
|
||||||
|
|
||||||
Any configuration lines which include one or more tag:<tag> constructs
|
Any configuration lines which include one or more tag:<tag> constructs
|
||||||
will only be valid if all that tags are matched in the set derived
|
will only be valid if all that tags are matched in the set derived
|
||||||
above. Typically this is dhcp-option.
|
above. Typically this is \fB--dhcp-option\fP.
|
||||||
.B dhcp-option
|
.B --dhcp-option
|
||||||
which has tags will be used in preference to an untagged
|
which has tags will be used in preference to an untagged
|
||||||
.B dhcp-option,
|
.B --dhcp-option,
|
||||||
provided that _all_ the tags match somewhere in the
|
provided that _all_ the tags match somewhere in the
|
||||||
set collected as described above. The prefix '!' on a tag means 'not'
|
set collected as described above. The prefix '!' on a tag means 'not'
|
||||||
so --dhcp-option=tag:!purple,3,1.2.3.4 sends the option when the
|
so \fB--dhcp-option=tag:!purple,3,1.2.3.4\fP sends the option when the
|
||||||
tag purple is not in the set of valid tags. (If using this in a
|
tag purple is not in the set of valid tags. (If using this in a
|
||||||
command line rather than a configuration file, be sure to escape !,
|
command line rather than a configuration file, be sure to escape !,
|
||||||
which is a shell metacharacter)
|
which is a shell metacharacter)
|
||||||
|
|
||||||
When selecting dhcp-options, a tag from dhcp-range is second class
|
When selecting \fB--dhcp-options\fP, a tag from \fB--dhcp-range\fP is second class
|
||||||
relative to other tags, to make it easy to override options for
|
relative to other tags, to make it easy to override options for
|
||||||
individual hosts, so
|
individual hosts, so
|
||||||
.B dhcp-range=set:interface1,......
|
.B --dhcp-range=set:interface1,......
|
||||||
.B dhcp-host=set:myhost,.....
|
.B --dhcp-host=set:myhost,.....
|
||||||
.B dhcp-option=tag:interface1,option:nis-domain,"domain1"
|
.B --dhcp-option=tag:interface1,option:nis-domain,"domain1"
|
||||||
.B dhcp-option=tag:myhost,option:nis-domain,"domain2"
|
.B --dhcp-option=tag:myhost,option:nis-domain,"domain2"
|
||||||
will set the NIS-domain to domain1 for hosts in the range, but
|
will set the NIS-domain to domain1 for hosts in the range, but
|
||||||
override that to domain2 for a particular host.
|
override that to domain2 for a particular host.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
Note that for
|
Note that for
|
||||||
.B dhcp-range
|
.B --dhcp-range
|
||||||
both tag:<tag> and set:<tag> are allowed, to both select the range in
|
both tag:<tag> and set:<tag> are allowed, to both select the range in
|
||||||
use based on (eg) dhcp-host, and to affect the options sent, based on
|
use based on (eg) \fB--dhcp-host\fP, and to affect the options sent, based on
|
||||||
the range selected.
|
the range selected.
|
||||||
|
|
||||||
This system evolved from an earlier, more limited one and for backward
|
This system evolved from an earlier, more limited one and for backward
|
||||||
compatibility "net:" may be used instead of "tag:" and "set:" may be
|
compatibility "net:" may be used instead of "tag:" and "set:" may be
|
||||||
omitted. (Except in
|
omitted. (Except in
|
||||||
.B dhcp-host,
|
.B --dhcp-host,
|
||||||
where "net:" may be used instead of "set:".) For the same reason, '#'
|
where "net:" may be used instead of "set:".) For the same reason, '#'
|
||||||
may be used instead of '!' to indicate NOT.
|
may be used instead of '!' to indicate NOT.
|
||||||
.PP
|
.PP
|
||||||
The DHCP server in dnsmasq will function as a BOOTP server also,
|
The DHCP server in dnsmasq will function as a BOOTP server also,
|
||||||
provided that the MAC address and IP address for clients are given,
|
provided that the MAC address and IP address for clients are given,
|
||||||
either using
|
either using
|
||||||
.B dhcp-host
|
.B --dhcp-host
|
||||||
configurations or in
|
configurations or in
|
||||||
.I /etc/ethers
|
.I /etc/ethers
|
||||||
, and a
|
, and a
|
||||||
.B dhcp-range
|
.B --dhcp-range
|
||||||
configuration option is present to activate the DHCP server
|
configuration option is present to activate the DHCP server
|
||||||
on a particular network. (Setting --bootp-dynamic removes the need for
|
on a particular network. (Setting \fB--bootp-dynamic\fP removes the need for
|
||||||
static address mappings.) The filename
|
static address mappings.) The filename
|
||||||
parameter in a BOOTP request is used as a tag,
|
parameter in a BOOTP request is used as a tag,
|
||||||
as is the tag "bootp", allowing some control over the options returned to
|
as is the tag "bootp", allowing some control over the options returned to
|
||||||
@@ -2137,8 +2161,8 @@ for which dnsmasq is authoritative our.zone.com.
|
|||||||
The simplest configuration consists of two lines of dnsmasq configuration; something like
|
The simplest configuration consists of two lines of dnsmasq configuration; something like
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
.B auth-server=server.example.com,eth0
|
.B --auth-server=server.example.com,eth0
|
||||||
.B auth-zone=our.zone.com,1.2.3.0/24
|
.B --auth-zone=our.zone.com,1.2.3.0/24
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
and two records in the external DNS
|
and two records in the external DNS
|
||||||
@@ -2161,8 +2185,8 @@ authoritative zone which dnsmasq is serving, typically at the root. Now
|
|||||||
we have
|
we have
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
.B auth-server=our.zone.com,eth0
|
.B --auth-server=our.zone.com,eth0
|
||||||
.B auth-zone=our.zone.com,1.2.3.0/24
|
.B --auth-zone=our.zone.com,1.2.3.0/24
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
@@ -2181,25 +2205,25 @@ entry or
|
|||||||
.B --host-record.
|
.B --host-record.
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
.B auth-server=our.zone.com,eth0
|
.B --auth-server=our.zone.com,eth0
|
||||||
.B host-record=our.zone.com,1.2.3.4
|
.B --host-record=our.zone.com,1.2.3.4
|
||||||
.B auth-zone=our.zone.com,1.2.3.0/24
|
.B --auth-zone=our.zone.com,1.2.3.0/24
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
If the external address is dynamic, the address
|
If the external address is dynamic, the address
|
||||||
associated with our.zone.com must be derived from the address of the
|
associated with our.zone.com must be derived from the address of the
|
||||||
relevant interface. This is done using
|
relevant interface. This is done using
|
||||||
.B interface-name
|
.B --interface-name
|
||||||
Something like:
|
Something like:
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
.B auth-server=our.zone.com,eth0
|
.B --auth-server=our.zone.com,eth0
|
||||||
.B interface-name=our.zone.com,eth0
|
.B --interface-name=our.zone.com,eth0
|
||||||
.B auth-zone=our.zone.com,1.2.3.0/24,eth0
|
.B --auth-zone=our.zone.com,1.2.3.0/24,eth0
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
(The "eth0" argument in auth-zone adds the subnet containing eth0's
|
(The "eth0" argument in \fB--auth-zone\fP adds the subnet containing eth0's
|
||||||
dynamic address to the zone, so that the interface-name returns the
|
dynamic address to the zone, so that the \fB--interface-name\fP returns the
|
||||||
address in outside queries.)
|
address in outside queries.)
|
||||||
|
|
||||||
Our final configuration builds on that above, but also adds a
|
Our final configuration builds on that above, but also adds a
|
||||||
@@ -2210,7 +2234,7 @@ secondary is beyond the scope of this man-page, but the extra
|
|||||||
configuration of dnsmasq is simple:
|
configuration of dnsmasq is simple:
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
.B auth-sec-servers=secondary.myisp.com
|
.B --auth-sec-servers=secondary.myisp.com
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
and
|
and
|
||||||
@@ -2224,13 +2248,13 @@ secondary to collect the DNS data. If you wish to restrict this data
|
|||||||
to particular hosts then
|
to particular hosts then
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
.B auth-peer=<IP address of secondary>
|
.B --auth-peer=<IP address of secondary>
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
will do so.
|
will do so.
|
||||||
|
|
||||||
Dnsmasq acts as an authoritative server for in-addr.arpa and
|
Dnsmasq acts as an authoritative server for in-addr.arpa and
|
||||||
ip6.arpa domains associated with the subnets given in auth-zone
|
ip6.arpa domains associated with the subnets given in \fB--auth-zone\fP
|
||||||
declarations, so reverse (address to name) lookups can be simply
|
declarations, so reverse (address to name) lookups can be simply
|
||||||
configured with a suitable NS record, for instance in this example,
|
configured with a suitable NS record, for instance in this example,
|
||||||
where we allow 1.2.3.0/24 addresses.
|
where we allow 1.2.3.0/24 addresses.
|
||||||
@@ -2247,8 +2271,8 @@ secondary servers for reverse lookups.
|
|||||||
When dnsmasq is configured to act as an authoritative server, the
|
When dnsmasq is configured to act as an authoritative server, the
|
||||||
following data is used to populate the authoritative zone.
|
following data is used to populate the authoritative zone.
|
||||||
.PP
|
.PP
|
||||||
.B --mx-host, --srv-host, --dns-rr, --txt-record, --naptr-record
|
.B --mx-host, --srv-host, --dns-rr, --txt-record, --naptr-record, --caa-record,
|
||||||
, as long as the record names are in the authoritative domain.
|
as long as the record names are in the authoritative domain.
|
||||||
.PP
|
.PP
|
||||||
.B --cname
|
.B --cname
|
||||||
as long as the record name is in the authoritative domain. If the
|
as long as the record name is in the authoritative domain. If the
|
||||||
@@ -2256,7 +2280,7 @@ target of the CNAME is unqualified, then it is qualified with the
|
|||||||
authoritative zone name. CNAME used in this way (only) may be wildcards, as in
|
authoritative zone name. CNAME used in this way (only) may be wildcards, as in
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
.B cname=*.example.com,default.example.com
|
.B --cname=*.example.com,default.example.com
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|||||||
+2
-1
@@ -478,7 +478,8 @@ la traza reversa direcci
|
|||||||
.TP
|
.TP
|
||||||
.B \-c, --cache-size=<tamaño de caché>
|
.B \-c, --cache-size=<tamaño de caché>
|
||||||
Fijar el tamaño del caché de dnsmasq. El predeterminado es 150 nombres.
|
Fijar el tamaño del caché de dnsmasq. El predeterminado es 150 nombres.
|
||||||
Fijar el tamaño a cero deshabilita el caché.
|
Fijar el tamaño a cero deshabilita el caché. Nota: el gran tamaño de
|
||||||
|
caché afecta el rendimiento.
|
||||||
.TP
|
.TP
|
||||||
.B \-N, --no-negcache
|
.B \-N, --no-negcache
|
||||||
Deshabilitar caché negativo. El caché negativo le permite a dnsmasq
|
Deshabilitar caché negativo. El caché negativo le permite a dnsmasq
|
||||||
|
|||||||
+123
-115
@@ -10,7 +10,7 @@ est un serveur à faible empreinte mémoire faisant DNS, TFTP, PXE, annonces de
|
|||||||
routeurs et DHCP. Il offre à la fois les services DNS et DHCP pour un réseau
|
routeurs et DHCP. Il offre à la fois les services DNS et DHCP pour un réseau
|
||||||
local (LAN).
|
local (LAN).
|
||||||
.PP
|
.PP
|
||||||
Dnsmasq accepte les requêtes DNS et y réponds soit en utilisant un petit cache
|
Dnsmasq accepte les requêtes DNS et y répond soit en utilisant un petit cache
|
||||||
local, soit en effectuant une requête à un serveur DNS récursif externe (par
|
local, soit en effectuant une requête à un serveur DNS récursif externe (par
|
||||||
exemple celui de votre fournisseur d'accès internet). Il charge le contenu du
|
exemple celui de votre fournisseur d'accès internet). Il charge le contenu du
|
||||||
fichier /etc/hosts afin que les noms locaux n'apparaissant pas dans les DNS
|
fichier /etc/hosts afin que les noms locaux n'apparaissant pas dans les DNS
|
||||||
@@ -19,25 +19,25 @@ pour les hôtes présents dans le service DHCP. Il peut aussi agir en temps que
|
|||||||
serveur DNS faisant autorité pour un ou plusieurs domaines, permettant à des
|
serveur DNS faisant autorité pour un ou plusieurs domaines, permettant à des
|
||||||
noms locaux d'apparaitre dans le DNS global.
|
noms locaux d'apparaitre dans le DNS global.
|
||||||
.PP
|
.PP
|
||||||
Le serveur DHCP Dnsmasq DHCP supporte les définitions d'adresses statiques et les
|
Le serveur DHCP de Dnsmasq supporte les définitions d'adresses statiques et les
|
||||||
réseaux multiples. Il fournit par défaut un jeu raisonnable de paramètres DHCP,
|
réseaux multiples. Il fournit par défaut un jeu raisonnable de paramètres DHCP,
|
||||||
et peut être configuré pour fournir n'importe quelle option DHCP.
|
et peut être configuré pour fournir n'importe quelle option DHCP.
|
||||||
Il inclut un serveur TFTP sécurisé en lecture seule permettant le démarrage via
|
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. Le
|
le réseau/PXE de clients DHCP et supporte également le protocole BOOTP. Le
|
||||||
support PXE est complet, et comprend un mode proxy permettant de fournir des
|
support PXE est complet, et comprend un mode proxy permettant de fournir des
|
||||||
informations PXE aux clients alors que l'allocation DHCP est effectuée par un
|
informations PXE aux clients alors que l'allocation d'adresse via DHCP est
|
||||||
autre serveur.
|
effectuée par un autre serveur.
|
||||||
.PP
|
.PP
|
||||||
Le serveur DHCPv6 de dnsmasq possède non seulement les mêmes fonctionalités
|
Le serveur DHCPv6 de dnsmasq possède non seulement les mêmes fonctionnalités
|
||||||
que le serveur DHCPv4, mais aussi le support des annonces de routeurs ainsi
|
que le serveur DHCPv4, mais aussi le support des annonces de routeurs ainsi
|
||||||
qu'une fonctionalité permettant l'addition de ressources AAAA pour des
|
qu'une fonctionnalité permettant l'addition de ressources AAAA pour des
|
||||||
clients utilisant DHCPv4 et la configuration IPv6 sans état (stateless
|
clients utilisant DHCPv4 et la configuration IPv6 sans état (stateless
|
||||||
autoconfiguration).
|
autoconfiguration).
|
||||||
Il inclut le support d'allocations d'adresses (à la fois en DHCPv6 et en
|
Il inclut le support d'allocations d'adresses (à la fois en DHCPv6 et en
|
||||||
annonces de routeurs - RA) pour des sous-réseaux dynamiquement délégués via
|
annonces de routeurs - RA) pour des sous-réseaux dynamiquement délégués via
|
||||||
une délégation de préfixe DHCPv6.
|
une délégation de préfixe DHCPv6.
|
||||||
.PP
|
.PP
|
||||||
Dnsmasq est developpé pour de petits systèmes embarqués. It tends à avoir
|
Dnsmasq est développé pour de petits systèmes embarqués. Il tend à avoir
|
||||||
l'empreinte mémoire la plus faible possible pour les fonctions supportées,
|
l'empreinte mémoire la plus faible possible pour les fonctions supportées,
|
||||||
et permet d'exclure les fonctions inutiles du binaire compilé.
|
et permet d'exclure les fonctions inutiles du binaire compilé.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
@@ -46,16 +46,23 @@ Dans ce cas, la fonction correspondante sera désactivée. Par exemple
|
|||||||
.B --pid-file=
|
.B --pid-file=
|
||||||
(sans paramètre après le =) désactive l'écriture du fichier PID.
|
(sans paramètre après le =) désactive l'écriture du fichier PID.
|
||||||
Sur BSD, à moins que le logiciel ne soit compilé avec la bibliothèque GNU
|
Sur BSD, à moins que le logiciel ne soit compilé avec la bibliothèque GNU
|
||||||
getopt, la forme longue des options ne fonctionne pas en ligne de commande; Elle
|
getopt, la forme longue des options ne fonctionne pas en ligne de commande; elle
|
||||||
est toujours supportée dans le fichier de configuration.
|
est toujours supportée dans le fichier de configuration.
|
||||||
.TP
|
.TP
|
||||||
.B --test
|
.B --test
|
||||||
Vérifie la syntaxe du ou des fichiers de configurations. Se termine avec le
|
Vérifie la syntaxe du ou des fichiers de configuration. Se termine avec le
|
||||||
code de retour 0 si tout est OK, ou un code différent de 0 dans le cas
|
code de retour 0 si tout est OK, ou un code différent de 0 dans le cas
|
||||||
contraire. Ne démarre pas Dnsmasq.
|
contraire. Ne démarre pas Dnsmasq.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-w, --help
|
||||||
|
Affiche toutes les options de ligne de commande.
|
||||||
|
.B --help dhcp
|
||||||
|
affiche les options de configuration connues pour DHCPv4, et
|
||||||
|
.B --help dhcp6
|
||||||
|
affiche les options de configuration connues pour DHCPv6.
|
||||||
|
.TP
|
||||||
.B \-h, --no-hosts
|
.B \-h, --no-hosts
|
||||||
Ne pas charger les noms du fichier /etc/hosts.
|
Ne pas charger les noms d'hôtes du fichier /etc/hosts.
|
||||||
.TP
|
.TP
|
||||||
.B \-H, --addn-hosts=<fichier>
|
.B \-H, --addn-hosts=<fichier>
|
||||||
Fichiers d'hôtes additionnels. Lire le fichier spécifié en plus de /etc/hosts.
|
Fichiers d'hôtes additionnels. Lire le fichier spécifié en plus de /etc/hosts.
|
||||||
@@ -68,7 +75,7 @@ fichiers contenus dans ce répertoire.
|
|||||||
.B \-E, --expand-hosts
|
.B \-E, --expand-hosts
|
||||||
Ajoute le nom de domaine aux noms simples (ne contenant pas de point dans le
|
Ajoute le nom de domaine aux noms simples (ne contenant pas de point dans le
|
||||||
nom) contenus dans le fichier /etc/hosts, de la même façon que pour le service
|
nom) contenus dans le fichier /etc/hosts, de la même façon que pour le service
|
||||||
DHCP. Notez que cela ne s'applique pas au nom de domaine dans les CNAME, les
|
DHCP. Notez que cela ne s'applique pas aux noms de domaine dans les CNAME, les
|
||||||
enregistrements PTR, TXT, etc...
|
enregistrements PTR, TXT, etc...
|
||||||
.TP
|
.TP
|
||||||
.B \-T, --local-ttl=<durée>
|
.B \-T, --local-ttl=<durée>
|
||||||
@@ -86,7 +93,7 @@ Les réponses négatives provenant des serveurs amonts contiennent normalement
|
|||||||
une information de durée de vie (time-to-live) dans les enregistrements SOA,
|
une information de durée de vie (time-to-live) dans les enregistrements SOA,
|
||||||
information dont dnsmasq se sert pour mettre la réponse en cache. Si la réponse
|
information dont dnsmasq se sert pour mettre la réponse en cache. Si la réponse
|
||||||
du serveur amont omet cette information, dnsmasq ne cache pas la réponse. Cette
|
du serveur amont omet cette information, dnsmasq ne cache pas la réponse. Cette
|
||||||
option permet de doner une valeur de durée de vie par défaut (en secondes) que
|
option permet de donner une valeur de durée de vie par défaut (en secondes) que
|
||||||
dnsmasq utilise pour mettre les réponses négatives dans son cache, même en
|
dnsmasq utilise pour mettre les réponses négatives dans son cache, même en
|
||||||
l'absence d'enregistrement SOA.
|
l'absence d'enregistrement SOA.
|
||||||
.TP
|
.TP
|
||||||
@@ -194,7 +201,7 @@ au dessus de la valeur spécifiée. Utile pour des systèmes derrière des dispo
|
|||||||
garde-barrières ("firewalls").
|
garde-barrières ("firewalls").
|
||||||
.TP
|
.TP
|
||||||
.B \-i, --interface=<nom d'interface>
|
.B \-i, --interface=<nom d'interface>
|
||||||
N'écouter que sur l'interface réseau spécifiée. Dnsmasq aujoute automatiquement
|
N'écouter que sur l'interface réseau spécifiée. Dnsmasq ajoute automatiquement
|
||||||
l'interface locale ("loopback") à la liste des interfaces lorsque l'option
|
l'interface locale ("loopback") à la liste des interfaces lorsque l'option
|
||||||
.B --interface
|
.B --interface
|
||||||
est utilisée.
|
est utilisée.
|
||||||
@@ -205,13 +212,13 @@ ou
|
|||||||
n'est donnée, Dnsmasq écoutera sur toutes les interfaces disponibles sauf
|
n'est donnée, Dnsmasq écoutera sur toutes les interfaces disponibles sauf
|
||||||
celle(s) spécifiée(s) par l'option
|
celle(s) spécifiée(s) par l'option
|
||||||
.B --except-interface.
|
.B --except-interface.
|
||||||
Les alias d'interfaces IP (e-g "eth1:0") ne peuvent être utilisés ni avec
|
Les alias d'interfaces IP (par exemple "eth1:0") ne peuvent être utilisés ni avec
|
||||||
.B --interface
|
.B --interface
|
||||||
ni
|
ni
|
||||||
.B \--except-interface.
|
.B \--except-interface.
|
||||||
Utiliser l'option
|
Utiliser l'option
|
||||||
.B --listen-address
|
.B --listen-address
|
||||||
à la place. Un simple joker, consistant d'un '*' final, peut-être utilisé dans
|
à la place. Un simple joker, consistant en un '*' final, peut être utilisé dans
|
||||||
les options
|
les options
|
||||||
.B \--interface
|
.B \--interface
|
||||||
et
|
et
|
||||||
@@ -229,10 +236,10 @@ sont fournies n'importe pas, et que l'option
|
|||||||
.B --except-interface
|
.B --except-interface
|
||||||
l'emporte toujours sur les autres.
|
l'emporte toujours sur les autres.
|
||||||
.TP
|
.TP
|
||||||
.B --auth-server=<domaine>,<interface>|<addresse IP>
|
.B --auth-server=<domaine>,<interface>|<adresse IP>
|
||||||
Active le mode DNS faisant autorité pour les requêtes arrivant sur cette
|
Active le mode DNS faisant autorité pour les requêtes arrivant sur cette
|
||||||
interface ou sur cette adresse. Noter que l'interface ou l'adresse n'ont
|
interface ou sur cette adresse. Noter que l'interface ou l'adresse n'ont
|
||||||
pas besoin d'être mentionées ni dans
|
pas besoin d'être mentionnées ni dans
|
||||||
.B --interface
|
.B --interface
|
||||||
ni dans
|
ni dans
|
||||||
.B --listen-address
|
.B --listen-address
|
||||||
@@ -253,7 +260,7 @@ Ecouter sur la ou les adresse(s) IP spécifiée(s). Les options
|
|||||||
.B \--interface
|
.B \--interface
|
||||||
et
|
et
|
||||||
.B \--listen-address
|
.B \--listen-address
|
||||||
peuvent-être spécifiées simultanément, auquel cas un jeu d'interfaces et
|
peuvent être spécifiées simultanément, auquel cas un jeu d'interfaces et
|
||||||
d'adresses seront utilisées. Notez que si
|
d'adresses seront utilisées. Notez que si
|
||||||
aucune option
|
aucune option
|
||||||
.B \--interface
|
.B \--interface
|
||||||
@@ -265,7 +272,7 @@ nécessaire de fournir explicitement son adresse IP, 127.0.0.1 via l'option
|
|||||||
.B \--listen-address.
|
.B \--listen-address.
|
||||||
.TP
|
.TP
|
||||||
.B \-z, --bind-interfaces
|
.B \-z, --bind-interfaces
|
||||||
Sur les systèmes qui le supporte, Dnsmasq s'associe avec l'interface joker
|
Sur les systèmes qui le supportent, Dnsmasq s'associe avec l'interface joker
|
||||||
("wildcard"), même lorsqu'il ne doit écouter que sur certaines interfaces. Par
|
("wildcard"), même lorsqu'il ne doit écouter que sur certaines interfaces. Par
|
||||||
la suite, il rejette les requêtes auxquelles il ne doit pas répondre. Cette
|
la suite, il rejette les requêtes auxquelles il ne doit pas répondre. Cette
|
||||||
situation présente l'avantage de fonctionner même lorsque les interfaces vont
|
situation présente l'avantage de fonctionner même lorsque les interfaces vont
|
||||||
@@ -302,7 +309,7 @@ le réseau auquel ils sont attachés). Cette possibilité est actuellement limit
|
|||||||
.TP
|
.TP
|
||||||
.B \-b, --bogus-priv
|
.B \-b, --bogus-priv
|
||||||
Fausse résolution inverse pour les réseaux privés. Toutes les requêtes DNS
|
Fausse résolution inverse pour les réseaux privés. Toutes les requêtes DNS
|
||||||
inverses pour des adresses IP privées (ie 192.168.x.x, etc...) qui ne sont pas
|
inverses pour des adresses IP privées (192.168.x.x, etc...) qui ne sont pas
|
||||||
trouvées dans /etc/hosts ou dans le fichier de baux DHCP se voient retournées
|
trouvées dans /etc/hosts ou dans le fichier de baux DHCP se voient retournées
|
||||||
une réponse "pas de tel domaine" ("no such domain") au lieu d'être transmises
|
une réponse "pas de tel domaine" ("no such domain") au lieu d'être transmises
|
||||||
aux serveurs de nom amont ("upstream server").
|
aux serveurs de nom amont ("upstream server").
|
||||||
@@ -317,7 +324,7 @@ modifiera 1.2.3.56 en 6.7.8.56 et 1.2.3.67 en 6.7.8.67.
|
|||||||
Cette fonctionnalité correspond à ce que les routeurs Cisco PIX appellent
|
Cette fonctionnalité correspond à ce que les routeurs Cisco PIX appellent
|
||||||
"bidouillage DNS" ("DNS doctoring"). Si l'ancienne IP est donnée sous la forme
|
"bidouillage DNS" ("DNS doctoring"). Si l'ancienne IP est donnée sous la forme
|
||||||
d'une gamme d'adresses, alors seules les adresses dans cette gamme seront
|
d'une gamme d'adresses, alors seules les adresses dans cette gamme seront
|
||||||
réecrites, et non le sous-réseau dans son ensemble. Ainsi,
|
réécrites, et non le sous-réseau dans son ensemble. Ainsi,
|
||||||
.B --alias=192.168.0.10-192.168.0.40,10.0.0.0,255.255.255.0
|
.B --alias=192.168.0.10-192.168.0.40,10.0.0.0,255.255.255.0
|
||||||
fait correspondre 192.168.0.10->192.168.0.40 à 10.0.0.10->10.0.0.40
|
fait correspondre 192.168.0.10->192.168.0.40 à 10.0.0.10->10.0.0.40
|
||||||
.TP
|
.TP
|
||||||
@@ -380,7 +387,7 @@ effectuer ses requêtes à tous les serveurs disponibles. Le résultat renvoyé
|
|||||||
au client sera celui fournit par le premier serveur ayant répondu.
|
au client sera celui fournit par le premier serveur ayant répondu.
|
||||||
.TP
|
.TP
|
||||||
.B --stop-dns-rebind
|
.B --stop-dns-rebind
|
||||||
Rejete (et enregistre dans le journal d'activité) les adresses dans la gamme
|
Rejette (et enregistre dans le journal d'activité) les adresses dans la gamme
|
||||||
d'adresses IP privée (au sens RFC1918) qui pourraient être renvoyées par les
|
d'adresses IP privée (au sens RFC1918) qui pourraient être renvoyées par les
|
||||||
serveurs amonts suite à une résolution de nom. Cela bloque les attaques cherchant
|
serveurs amonts suite à une résolution de nom. Cela bloque les attaques cherchant
|
||||||
à détourner de leur usage les logiciels de navigation web ('browser') en s'en
|
à détourner de leur usage les logiciels de navigation web ('browser') en s'en
|
||||||
@@ -389,13 +396,13 @@ servant pour découvrir les machines situées sur le réseau local.
|
|||||||
.B --rebind-localhost-ok
|
.B --rebind-localhost-ok
|
||||||
Exclue 127.0.0/8 des vérifications de réassociation DNS. Cette gamme d'adresses
|
Exclue 127.0.0/8 des vérifications de réassociation DNS. Cette gamme d'adresses
|
||||||
est retournée par les serveurs Realtime Blackhole (RBL, utilisés dans la
|
est retournée par les serveurs Realtime Blackhole (RBL, utilisés dans la
|
||||||
lutte contre le spam), la bloquer peut entraîner des disfonctionnements de ces
|
lutte contre le spam), la bloquer peut entraîner des dysfonctionnements de ces
|
||||||
services.
|
services.
|
||||||
.TP
|
.TP
|
||||||
.B --rebind-domain-ok=[<domaine>]|[[/<domaine>/[<domaine>/]
|
.B --rebind-domain-ok=[<domaine>]|[[/<domaine>/[<domaine>/]
|
||||||
Ne pas détecter ni bloquer les actions de type dns-rebind pour ces domaines.
|
Ne pas détecter ni bloquer les actions de type dns-rebind pour ces domaines.
|
||||||
Cette option peut prendre comme valeur soit un nom de domaine soit plusieurs
|
Cette option peut prendre comme valeur soit un nom de domaine soit plusieurs
|
||||||
noms de domains entourés par des '/', selon une syntaxe similaire à l'option
|
noms de domaine entourés par des '/', selon une syntaxe similaire à l'option
|
||||||
--server, c-à-d :
|
--server, c-à-d :
|
||||||
.B --rebind-domain-ok=/domaine1/domaine2/domaine3/
|
.B --rebind-domain-ok=/domaine1/domaine2/domaine3/
|
||||||
.TP
|
.TP
|
||||||
@@ -474,7 +481,7 @@ serveur de nom. Il doit s'agir d'une des adresses IP appartenant à la machine s
|
|||||||
laquelle tourne Dnsmasq ou sinon la ligne sera ignorée et une erreur sera
|
laquelle tourne Dnsmasq ou sinon la ligne sera ignorée et une erreur sera
|
||||||
consignée dans le journal des événements, ou alors d'un nom d'interface. Si un nom
|
consignée dans le journal des événements, ou alors d'un nom d'interface. Si un nom
|
||||||
d'interface est donné, alors les requêtes vers le serveur de nom seront envoyées
|
d'interface est donné, alors les requêtes vers le serveur de nom seront envoyées
|
||||||
depuis cette interface; si une adresse ip est donnée, alors l'adresse source de
|
depuis cette interface; si une adresse IP est donnée, alors l'adresse source de
|
||||||
la requête sera l'adresse en question. L'option query-port est ignorée pour tous
|
la requête sera l'adresse en question. L'option query-port est ignorée pour tous
|
||||||
les serveurs ayant une adresse source spécifiée, mais il est possible de la donner
|
les serveurs ayant une adresse source spécifiée, mais il est possible de la donner
|
||||||
directement dans la spécification de l'adresse source. Forcer les requêtes à être
|
directement dans la spécification de l'adresse source. Forcer les requêtes à être
|
||||||
@@ -510,7 +517,7 @@ d'IP netfilter (ipset) indiqués. Domaines et sous-domaines sont résolus de la
|
|||||||
même façon que pour --address. Ces groupes d'IP doivent déjà exister. Voir
|
même façon que pour --address. Ces groupes d'IP doivent déjà exister. Voir
|
||||||
ipset(8) pour plus de détails.
|
ipset(8) pour plus de détails.
|
||||||
.TP
|
.TP
|
||||||
.B \-m, --mx-host=<nom de l'hôte>[[,<nom du MX>],<préference>]
|
.B \-m, --mx-host=<nom de l'hôte>[[,<nom du MX>],<préférence>]
|
||||||
Spécifie un enregistrement de type MX pour <nom de l'hôte> retournant le nom
|
Spécifie un enregistrement de type MX pour <nom de l'hôte> retournant le nom
|
||||||
donné dans <nom du MX> (s'il est présent), ou sinon le nom spécifié dans
|
donné dans <nom du MX> (s'il est présent), ou sinon le nom spécifié dans
|
||||||
l'option
|
l'option
|
||||||
@@ -612,7 +619,7 @@ l'enregistrement est donnée dans les données hexadécimales, qui peuvent
|
|||||||
être de la forme 01:23:45, 01 23 45,+012345 ou n'importe quelle combinaison.
|
être de la forme 01:23:45, 01 23 45,+012345 ou n'importe quelle combinaison.
|
||||||
.TP
|
.TP
|
||||||
.B --interface-name=<nom>,<interface>
|
.B --interface-name=<nom>,<interface>
|
||||||
Définit un entregistrement DNS associant le nom avec l'adresse primaire sur
|
Définit un enregistrement DNS associant le nom avec l'adresse primaire sur
|
||||||
l'interface donnée en argument. Cette option spécifie un enregistrement de type
|
l'interface donnée en argument. Cette option spécifie un enregistrement de type
|
||||||
A pour le nom donné en argument de la même façon que s'il était défini par une
|
A pour le nom donné en argument de la même façon que s'il était défini par une
|
||||||
ligne de /etc/hosts, sauf que l'adresse n'est pas constante mais dépendante de
|
ligne de /etc/hosts, sauf que l'adresse n'est pas constante mais dépendante de
|
||||||
@@ -638,7 +645,7 @@ IPv6 pouvant commencer par '::', mais les noms DNS ne pouvant pas commencer
|
|||||||
par '-', si aucun préfixe n'est donné, un zéro est ajouté en début de nom.
|
par '-', si aucun préfixe n'est donné, un zéro est ajouté en début de nom.
|
||||||
Ainsi, ::1 devient 0--1.
|
Ainsi, ::1 devient 0--1.
|
||||||
|
|
||||||
La plage d'adresses peut-être de la forme
|
La plage d'adresses peut être de la forme
|
||||||
<adresse IP>,<adresse IP> ou <adresse IP>/<masque réseau>
|
<adresse IP>,<adresse IP> ou <adresse IP>/<masque réseau>
|
||||||
.TP
|
.TP
|
||||||
.B --add-mac
|
.B --add-mac
|
||||||
@@ -647,7 +654,7 @@ 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
|
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
|
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,
|
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
|
aussi cette fonctionnalité doit être considérée comme expérimentale. Notez
|
||||||
également qu'exposer les adresses MAC de la sorte peut avoir des implications
|
également qu'exposer les adresses MAC de la sorte peut avoir des implications
|
||||||
en termes de sécurité et de vie privée. L'avertissement donné pour --add-subnet
|
en termes de sécurité et de vie privée. L'avertissement donné pour --add-subnet
|
||||||
s'applique également ici.
|
s'applique également ici.
|
||||||
@@ -659,19 +666,20 @@ longueur du préfixe : 32 (ou 128 dans le cas d'IPv6) transmet la totalité
|
|||||||
de l'adresse, 0 n'en transmet aucun mais marque néanmoins la requête ce qui
|
de l'adresse, 0 n'en transmet aucun mais marque néanmoins la requête ce qui
|
||||||
fait qu'aucun serveur amont ne rajoutera d'adresse client. La valeur par
|
fait qu'aucun serveur amont ne rajoutera d'adresse client. La valeur par
|
||||||
défaut est zéro et pour IPv4 et pour IPv6. A noter que les serveurs amonts
|
défaut est zéro et pour IPv4 et pour IPv6. A noter que les serveurs amonts
|
||||||
peuvent-être configurés pour retourner des valeurs différentes en fonction
|
peuvent être configurés pour retourner des valeurs différentes en fonction
|
||||||
de cette information mais que le cache de dnsmasq n'en tient pas compte.
|
de cette information mais que le cache de dnsmasq n'en tient pas compte.
|
||||||
Si une instance de dnsmasq est configurée de telle maniêre que des valeurs
|
Si une instance de dnsmasq est configurée de telle manière que des valeurs
|
||||||
différentes pourraient-être rencontrés, alors le cache devrait être désactivé.
|
différentes pourraient être rencontrées, alors le cache devrait être désactivé.
|
||||||
.TP
|
.TP
|
||||||
.B \-c, --cache-size=<taille>
|
.B \-c, --cache-size=<taille>
|
||||||
Définit la taille du cache de Dnsmasq. La valeur par défaut est de 150 noms.
|
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.
|
Définir une valeur de zéro désactive le cache. Remarque: la taille importante
|
||||||
|
du cache a un impact sur les performances.
|
||||||
.TP
|
.TP
|
||||||
.B \-N, --no-negcache
|
.B \-N, --no-negcache
|
||||||
Désactive le "cache négatif". Le "cache négatif" permet à Dnsmasq de se souvenir
|
Désactive le "cache négatif". Le "cache négatif" permet à Dnsmasq de se souvenir
|
||||||
des réponses de type "no such domain" fournies par les serveurs DNS en amont et
|
des réponses de type "no such domain" fournies par les serveurs DNS en amont et
|
||||||
de fournir les réponses sans avoir à re-transmettre les requêtes aux serveurs
|
de fournir les réponses sans avoir à retransmettre les requêtes aux serveurs
|
||||||
amont.
|
amont.
|
||||||
.TP
|
.TP
|
||||||
.B \-0, --dns-forward-max=<nombre de requêtes>
|
.B \-0, --dns-forward-max=<nombre de requêtes>
|
||||||
@@ -683,17 +691,17 @@ son journal des requêtes, ce qui peut générer un nombre important de requête
|
|||||||
simultanées.
|
simultanées.
|
||||||
.TP
|
.TP
|
||||||
.B --proxy-dnssec
|
.B --proxy-dnssec
|
||||||
Un resolveur sur une machine cliente peut effectuer la validation DNSSEC de
|
Un résolveur 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
|
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
|
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
|
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
|
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
|
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
|
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
|
l'activation de cette fonctionnalité. Vous ne devriez utiliser cela que si vous
|
||||||
faites confiance aux serveurs amonts
|
faites confiance aux serveurs amonts
|
||||||
.I ainsi que le réseau entre vous et eux.
|
.I ainsi que le réseau entre vous et eux.
|
||||||
Si vous utilisez le premier mode DNSSEC, la validation par le resolveur des
|
Si vous utilisez le premier mode DNSSEC, la validation par le résolveur des
|
||||||
clients, cette option n'est pas requise. Dnsmasq retourne toujours toutes les
|
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.
|
données nécessaires par un client pour effectuer la validation lui-même.
|
||||||
.TP
|
.TP
|
||||||
@@ -703,12 +711,12 @@ Définie une zone DNS pour laquelle dnsmasq agit en temps que serveur faisant
|
|||||||
autorité. Les enregistrements DNS définis localement et correspondant à ce
|
autorité. Les enregistrements DNS définis localement et correspondant à ce
|
||||||
domaine seront fournis. Les enregistrements A et AAAA doivent se situer dans
|
domaine seront fournis. Les enregistrements A et AAAA doivent se situer dans
|
||||||
l'un des sous-réseaux définis, ou dans un réseau correspondant à une plage DHCP
|
l'un des sous-réseaux définis, ou dans un réseau correspondant à une plage DHCP
|
||||||
(ce comportement peut-être désactivé par
|
(ce comportement peut être désactivé par
|
||||||
.B constructor-noauth:
|
.B constructor-noauth:
|
||||||
). Le ou les sous-réseaux sont également utilisé(s) pour définir les domaines
|
). Le ou les sous-réseaux sont également utilisé(s) pour définir les domaines
|
||||||
in-addr.arpa et ip6.arpa servant à l'interrogation DNS inverse. Si la longueur
|
in-addr.arpa et ip6.arpa servant à l'interrogation DNS inverse. Si la longueur
|
||||||
de préfixe n'est pas spécifiée, elle sera par défaut de 24 pour IPv4 et 64 pour
|
de préfixe n'est pas spécifiée, elle sera par défaut de 24 pour IPv4 et 64 pour
|
||||||
IPv6. Dans le cas d'IPv4, la longueur du masque de réseau devrait-être de 8, 16
|
IPv6. Dans le cas d'IPv4, la longueur du masque de réseau devrait être de 8, 16
|
||||||
ou 24, sauf si en cas de mise en place d'une délégation de la zone in-addr.arpa
|
ou 24, sauf si en cas de mise en place d'une délégation de la zone in-addr.arpa
|
||||||
conforme au RFC 2317.
|
conforme au RFC 2317.
|
||||||
.TP
|
.TP
|
||||||
@@ -719,7 +727,7 @@ optionnel, les valeurs par défaut devant convenir à la majorité des cas.
|
|||||||
.TP
|
.TP
|
||||||
.B --auth-sec-servers=<domaine>[,<domaine>[,<domaine>...]]
|
.B --auth-sec-servers=<domaine>[,<domaine>[,<domaine>...]]
|
||||||
Spécifie un ou plusieurs serveur de nom secondaires pour une zone pour
|
Spécifie un ou plusieurs serveur de nom secondaires pour une zone pour
|
||||||
laquelle dnsmasq fait autorité. Ces serveurs doivent-être configurés pour
|
laquelle dnsmasq fait autorité. Ces serveurs doivent être configurés pour
|
||||||
récupérer auprès de dnsmasq les informations liées à la zone au travers d'un
|
récupérer auprès de dnsmasq les informations liées à la zone au travers d'un
|
||||||
transfert de zone, et répondre aux requêtes pour toutes les zones pour
|
transfert de zone, et répondre aux requêtes pour toutes les zones pour
|
||||||
lesquelles dnsmasq fait autorité.
|
lesquelles dnsmasq fait autorité.
|
||||||
@@ -733,7 +741,7 @@ seront acceptées pour tous les serveurs secondaires.
|
|||||||
.B --conntrack
|
.B --conntrack
|
||||||
Lis le marquage de suivi de connexion Linux associé aux requêtes DNS entrantes
|
Lis le marquage de suivi de connexion Linux associé aux requêtes DNS entrantes
|
||||||
et positionne la même marque au trafic amont utilisé pour répondre à ces
|
et positionne la même marque au trafic amont utilisé pour répondre à ces
|
||||||
requétes. Cela permet au trafic généré par Dnsmasq d'étre associé aux requêtes
|
requêtes. Cela permet au trafic généré par Dnsmasq d'être associé aux requêtes
|
||||||
l'ayant déclenché, ce qui est pratique pour la gestion de la bande passante
|
l'ayant déclenché, ce qui est pratique pour la gestion de la bande passante
|
||||||
(accounting) et le filtrage (firewall). Dnsmasq doit pour cela être compilé
|
(accounting) et le filtrage (firewall). Dnsmasq doit pour cela être compilé
|
||||||
avec le support conntrack, le noyau doit également inclure conntrack et être
|
avec le support conntrack, le noyau doit également inclure conntrack et être
|
||||||
@@ -742,7 +750,7 @@ configuré pour cela. Cette option ne peut pas être combinée avec
|
|||||||
.TP
|
.TP
|
||||||
.B \-F, --dhcp-range=[tag:<label>[,tag:<label>],][set:<label>],]<adresse de début>[,<adresse de fin>][,<mode>][,<masque de réseau>[,<broadcast>]][,<durée de bail>]
|
.B \-F, --dhcp-range=[tag:<label>[,tag:<label>],][set:<label>],]<adresse de début>[,<adresse de fin>][,<mode>][,<masque de réseau>[,<broadcast>]][,<durée de bail>]
|
||||||
.TP
|
.TP
|
||||||
.B \-F, --dhcp-range=[tag:<label>[,tag:<label>],][set:<label>],]<addresse IPv6 de début>[,<adresse IPv6 de fin>|constructor:<interface>][,<mode>][,<longueur de préfixe>][,<durée de bail>]
|
.B \-F, --dhcp-range=[tag:<label>[,tag:<label>],][set:<label>],]<adresse IPv6 de début>[,<adresse IPv6 de fin>|constructor:<interface>][,<mode>][,<longueur de préfixe>][,<durée de bail>]
|
||||||
|
|
||||||
Active le serveur DHCP. Les adresses seront données dans la plage comprise entre
|
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
|
<adresse de début> et <adresse de fin> et à partir des adresses définies
|
||||||
@@ -755,7 +763,7 @@ durée indéterminée. Si aucune valeur n'est donnée, une durée de bail par d
|
|||||||
de une heure est appliquée. La valeur minimum pour un bail DHCP est de 2
|
de une heure est appliquée. La valeur minimum pour un bail DHCP est de 2
|
||||||
minutes.
|
minutes.
|
||||||
|
|
||||||
Pour les plages IPv6, la durée de bail peut-être égale au mot-clef "deprecated"
|
Pour les plages IPv6, la durée de bail peut être égale au mot-clef "deprecated"
|
||||||
(obsolète); Cela positionne la durée de vie préférée envoyée dans les baux DHCP
|
(obsolète); Cela positionne la durée de vie préférée envoyée dans les baux DHCP
|
||||||
ou les annonces routeurs à zéro, ce qui incite les clients à utiliser d'autres
|
ou les annonces routeurs à zéro, ce qui incite les clients à utiliser d'autres
|
||||||
adresses autant que possible, pour toute nouvelle connexion, en préalable à
|
adresses autant que possible, pour toute nouvelle connexion, en préalable à
|
||||||
@@ -795,7 +803,7 @@ adresses assignées à l'interface. Par exemple
|
|||||||
provoque la recherche d'adresses de la forme <réseau>::1 sur eth0 et crée une
|
provoque la recherche d'adresses de la forme <réseau>::1 sur eth0 et crée une
|
||||||
plage allant de <réseau>::1 à <réseau>:400. Si une interface est assignée à
|
plage allant de <réseau>::1 à <réseau>:400. Si une interface est assignée à
|
||||||
plus d'un réseau, les plages correspondantes seront automatiquement créées,
|
plus d'un réseau, les plages correspondantes seront automatiquement créées,
|
||||||
rendues obsolètes puis supprimées lorsque l'adress est rendue obsolète puis
|
rendues obsolètes puis supprimées lorsque l'adresse est rendue obsolète puis
|
||||||
supprimée. Le nom de l'interface peut être spécifié avec un caractère joker '*'
|
supprimée. Le nom de l'interface peut être spécifié avec un caractère joker '*'
|
||||||
final.
|
final.
|
||||||
|
|
||||||
@@ -809,7 +817,7 @@ obsolètes ne conviennent pas.
|
|||||||
|
|
||||||
Si une plage dhcp-range est uniquement utilisée pour du DHCP sans-état
|
Si une plage dhcp-range est uniquement utilisée pour du DHCP sans-état
|
||||||
("stateless") ou de l'autoconfiguration sans état ("SLAAC"), alors l'adresse
|
("stateless") ou de l'autoconfiguration sans état ("SLAAC"), alors l'adresse
|
||||||
peut-être indiquée sous la forme '::'
|
peut être indiquée sous la forme '::'
|
||||||
|
|
||||||
.B --dhcp-range=::,constructor:eth0
|
.B --dhcp-range=::,constructor:eth0
|
||||||
|
|
||||||
@@ -851,7 +859,7 @@ et
|
|||||||
.B pxe-service
|
.B pxe-service
|
||||||
pour plus de détails).
|
pour plus de détails).
|
||||||
|
|
||||||
Pour IPv6, le mode peut-être une combinaison des valeurs
|
Pour IPv6, le mode peut être une combinaison des valeurs
|
||||||
.B ra-only, slaac, ra-names, ra-stateless, off-link.
|
.B ra-only, slaac, ra-names, ra-stateless, off-link.
|
||||||
|
|
||||||
.B ra-only
|
.B ra-only
|
||||||
@@ -883,7 +891,7 @@ connectés (et non ceux pour lesquels DHCP se fait via relai), et ne
|
|||||||
fonctionnera pas si un hôte utilise les "extensions de vie privée"
|
fonctionnera pas si un hôte utilise les "extensions de vie privée"
|
||||||
("privacy extensions").
|
("privacy extensions").
|
||||||
.B ra-names
|
.B ra-names
|
||||||
peut-être combiné avec
|
peut être combiné avec
|
||||||
.B ra-stateless
|
.B ra-stateless
|
||||||
et
|
et
|
||||||
.B slaac.
|
.B slaac.
|
||||||
@@ -914,7 +922,7 @@ sous-réseau qu'une plage dhcp-range valide. Pour les sous-réseaux qui n'ont pa
|
|||||||
besoin d'adresses dynamiquement allouées, utiliser le mot-clef "static" dans la
|
besoin d'adresses dynamiquement allouées, utiliser le mot-clef "static" dans la
|
||||||
déclaration de plage d'adresses dhcp-range.
|
déclaration de plage d'adresses dhcp-range.
|
||||||
|
|
||||||
Il est possible d'utiliser des identifiants clients (appellé "DUID client" dans
|
Il est possible d'utiliser des identifiants clients (appelés "DUID client" dans
|
||||||
le monde IPv6) plutôt que des adresses matérielles pour identifier les hôtes,
|
le monde IPv6) plutôt que des adresses matérielles pour identifier les hôtes,
|
||||||
en préfixant ceux-ci par 'id:'. Ainsi,
|
en préfixant ceux-ci par 'id:'. Ainsi,
|
||||||
.B --dhcp-host=id:01:02:03:04,.....
|
.B --dhcp-host=id:01:02:03:04,.....
|
||||||
@@ -926,7 +934,7 @@ ceci :
|
|||||||
Un seul
|
Un seul
|
||||||
.B dhcp-host
|
.B dhcp-host
|
||||||
peut contenir une adresse IPv4, une adresse IPv6, ou les deux en même temps.
|
peut contenir une adresse IPv4, une adresse IPv6, ou les deux en même temps.
|
||||||
Les adresses IPv6 doivent-être mises entre crochets comme suit :
|
Les adresses IPv6 doivent être mises entre crochets comme suit :
|
||||||
.B --dhcp-host=laptop,[1234::56]
|
.B --dhcp-host=laptop,[1234::56]
|
||||||
Les adresses IPv6 peuvent ne contenir que la partie identifiant de client :
|
Les adresses IPv6 peuvent ne contenir que la partie identifiant de client :
|
||||||
.B --dhcp-host=laptop,[::56]
|
.B --dhcp-host=laptop,[::56]
|
||||||
@@ -945,7 +953,7 @@ identifiant client mais pas les autres.
|
|||||||
Si un nom apparaît dans /etc/hosts, l'adresse associée peut être allouée à un
|
Si un nom apparaît dans /etc/hosts, l'adresse associée peut être allouée à un
|
||||||
bail DHCP mais seulement si une option
|
bail DHCP mais seulement si une option
|
||||||
.B --dhcp-host
|
.B --dhcp-host
|
||||||
spécifiant le nom existe par ailleurs. Seul un nom d'hôte peut-être donné dans
|
spécifiant le nom existe par ailleurs. Seul un nom d'hôte peut être donné dans
|
||||||
une option
|
une option
|
||||||
.B dhcp-host
|
.B dhcp-host
|
||||||
, mais les alias sont possibles au travers de l'utilisation des CNAMEs. (Voir
|
, mais les alias sont possibles au travers de l'utilisation des CNAMEs. (Voir
|
||||||
@@ -973,7 +981,7 @@ Les adresses ethernet (mais pas les identifiants clients) peuvent être définie
|
|||||||
avec des octets joker, ainsi par exemple
|
avec des octets joker, ainsi par exemple
|
||||||
.B --dhcp-host=00:20:e0:3b:13:*,ignore
|
.B --dhcp-host=00:20:e0:3b:13:*,ignore
|
||||||
demande à Dnsmasq d'ignorer une gamme d'adresses matérielles. Il est à noter
|
demande à Dnsmasq d'ignorer une gamme d'adresses matérielles. Il est à noter
|
||||||
que "*" doit-être précédé d'un caractère d'échappement ou mis entre guillemets
|
que "*" doit être précédé d'un caractère d'échappement ou mis entre guillemets
|
||||||
lorsque spécifié en option de ligne de commande, mais pas dans le fichier de
|
lorsque spécifié en option de ligne de commande, mais pas dans le fichier de
|
||||||
configuration.
|
configuration.
|
||||||
|
|
||||||
@@ -1059,14 +1067,14 @@ qu'aux réseaux dont tous les labels coïncident avec ceux de la requête.
|
|||||||
Un traitement spécial est effectué sur les chaînes de caractères fournies pour
|
Un traitement spécial est effectué sur les chaînes de caractères fournies pour
|
||||||
l'option 119, conformément à la RFC 3397. Les chaînes de caractères ou les
|
l'option 119, conformément à la RFC 3397. Les chaînes de caractères ou les
|
||||||
adresses IP sous forme de 4 chiffres séparés par des points donnés en arguments
|
adresses IP sous forme de 4 chiffres séparés par des points donnés en arguments
|
||||||
de l'option 120 sont traités conforméments à la RFC 3361. Les adresses IP sous
|
de l'option 120 sont traités conformément à la RFC 3361. Les adresses IP sous
|
||||||
forme de 4 chiffres séparés par des points suivies par une barre montante "/",
|
forme de 4 chiffres séparés par des points suivies par une barre montante "/",
|
||||||
puis une taille de masque sont encodés conforméments à la RFC 3442.
|
puis une taille de masque sont encodés conformément à la RFC 3442.
|
||||||
|
|
||||||
Les options IPv6 sont fournies en utilisant le mot-clef
|
Les options IPv6 sont fournies en utilisant le mot-clef
|
||||||
.B option6:
|
.B option6:
|
||||||
suivi par le numéro d'option ou le nom d'option. L'espace de nommage des options
|
suivi par le numéro d'option ou le nom d'option. L'espace de nommage des options
|
||||||
IPv6 est disjint de l'espace de nommage des options IPv4. Les adresses IPv6
|
IPv6 est disjoint de l'espace de nommage des options IPv4. Les adresses IPv6
|
||||||
en option doivent être entourées de crochets, comme par exemple :
|
en option doivent être entourées de crochets, comme par exemple :
|
||||||
.B --dhcp-option=option6:ntp-server,[1234::56]
|
.B --dhcp-option=option6:ntp-server,[1234::56]
|
||||||
|
|
||||||
@@ -1075,7 +1083,7 @@ adéquat sont envoyées pour un numéro d'option donné, il est tout à fait pos
|
|||||||
de persuader Dnsmasq de générer des paquets DHCP illégaux par une utilisation
|
de persuader Dnsmasq de générer des paquets DHCP illégaux par une utilisation
|
||||||
incorrecte de cette option. Lorsque la valeur est un nombre décimal, Dnsmasq
|
incorrecte de cette option. Lorsque la valeur est un nombre décimal, Dnsmasq
|
||||||
doit déterminer la taille des données. Cela est fait en examinant le numéro de
|
doit déterminer la taille des données. Cela est fait en examinant le numéro de
|
||||||
l'option et/ou la valeur, mais peut-être évité en rajoutant un suffixe d'une
|
l'option et/ou la valeur, mais peut être évité en rajoutant un suffixe d'une
|
||||||
lettre comme suit :
|
lettre comme suit :
|
||||||
b = un octet, s = 2 octets, i = 4 octets. Cela sert essentiellement pour des
|
b = un octet, s = 2 octets, i = 4 octets. Cela sert essentiellement pour des
|
||||||
options encapsulées de classes de vendeurs (voir plus bas), pour lesquelles
|
options encapsulées de classes de vendeurs (voir plus bas), pour lesquelles
|
||||||
@@ -1088,7 +1096,7 @@ d'une chaîne de caractères comme nom de serveur TFTP, il est nécessaire de fa
|
|||||||
comme suit :
|
comme suit :
|
||||||
.B --dhcp-option=66,"1.2.3.4"
|
.B --dhcp-option=66,"1.2.3.4"
|
||||||
|
|
||||||
Les options encapsulées de classes de vendeurs peuvent-être aussi spécifiées
|
Les options encapsulées de classes de vendeurs peuvent être aussi spécifiées
|
||||||
(pour IPv4 seulement) en utilisant
|
(pour IPv4 seulement) en utilisant
|
||||||
.B --dhcp-option
|
.B --dhcp-option
|
||||||
: par exemple
|
: par exemple
|
||||||
@@ -1105,7 +1113,7 @@ par le client. Il est possible d'omettre complètement une classe de vendeur :
|
|||||||
.B --dhcp-option=vendor:,1,0.0.0.0
|
.B --dhcp-option=vendor:,1,0.0.0.0
|
||||||
Dans ce cas l'option encapsulée est toujours envoyée.
|
Dans ce cas l'option encapsulée est toujours envoyée.
|
||||||
|
|
||||||
En IPv4, les options peuvent-être encapsulées au sein d'autres options :
|
En IPv4, les options peuvent être encapsulées au sein d'autres options :
|
||||||
par exemple
|
par exemple
|
||||||
.B --dhcp-option=encap:175, 190, "iscsi-client0"
|
.B --dhcp-option=encap:175, 190, "iscsi-client0"
|
||||||
enverra l'option 175, au sein de laquelle se trouve l'option 190.
|
enverra l'option 175, au sein de laquelle se trouve l'option 190.
|
||||||
@@ -1128,7 +1136,7 @@ une option encapsulée.
|
|||||||
Cela fonctionne exactement de la même façon que
|
Cela fonctionne exactement de la même façon que
|
||||||
.B --dhcp-option
|
.B --dhcp-option
|
||||||
sauf que cette option sera toujours envoyée, même si le client ne la demande pas
|
sauf que cette option sera toujours envoyée, même si le client ne la demande pas
|
||||||
dans la liste de paramêtres requis. Cela est parfois nécessaire, par exemple lors
|
dans la liste de paramètres requis. Cela est parfois nécessaire, par exemple lors
|
||||||
de la fourniture d'options à PXELinux.
|
de la fourniture d'options à PXELinux.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-no-override
|
.B --dhcp-no-override
|
||||||
@@ -1149,10 +1157,10 @@ Toutes les requêtes DHCP arrivant sur cette interface seront relayées au
|
|||||||
serveur DHCP distant correspondant à l'adresse de serveur indiquée. Il est
|
serveur DHCP distant correspondant à l'adresse de serveur indiquée. Il est
|
||||||
possible de relayer depuis une unique adresse locale vers différents serveurs
|
possible de relayer depuis une unique adresse locale vers différents serveurs
|
||||||
distant en spécifiant plusieurs fois l'option dhcp-relay avec la même adresse
|
distant en spécifiant plusieurs fois l'option dhcp-relay avec la même adresse
|
||||||
locale et différentes adresses de serveur. L'adresse de serveur doit-être
|
locale et différentes adresses de serveur. L'adresse de serveur doit être
|
||||||
sous forme numérique. Dans le cas de DHCPv6, l'adresse de serveur peut-être
|
sous forme numérique. Dans le cas de DHCPv6, l'adresse de serveur peut être
|
||||||
l'adresse de multicast ff05::1:3 correspondant à tous les serveurs DHCP. Dans
|
l'adresse de multicast ff05::1:3 correspondant à tous les serveurs DHCP. Dans
|
||||||
ce cas, l'interface doit-étre spécifiée et ne peut comporter de caractère
|
ce cas, l'interface doit être spécifiée et ne peut comporter de caractère
|
||||||
joker. Elle sera utilisée pour indiquer l'interface à partir de laquelle le
|
joker. Elle sera utilisée pour indiquer l'interface à partir de laquelle le
|
||||||
multicast pourra atteindre le serveur DHCP.
|
multicast pourra atteindre le serveur DHCP.
|
||||||
|
|
||||||
@@ -1181,14 +1189,14 @@ vice-versa.
|
|||||||
Associe une chaîne de classe de vendeur à un label. La plupart
|
Associe une chaîne de classe de vendeur à un label. La plupart
|
||||||
des clients DHCP fournissent une "classe de vendeur" ("vendor class") qui
|
des clients DHCP fournissent une "classe de vendeur" ("vendor class") qui
|
||||||
représente, d'une certaine façon, le type d'hôte. Cette option associe des
|
représente, d'une certaine façon, le type d'hôte. Cette option associe des
|
||||||
classes de vendeur à des labels, de telle sorte que des options DHCP peuvent-être
|
classes de vendeur à des labels, de telle sorte que des options DHCP peuvent être
|
||||||
fournie de manière sélective aux différentes classes d'hôtes. Par exemple,
|
fournies de manière sélective aux différentes classes d'hôtes. Par exemple,
|
||||||
.B dhcp-vendorclass=set:printers,Hewlett-Packard JetDirect
|
.B dhcp-vendorclass=set:printers,Hewlett-Packard JetDirect
|
||||||
ou
|
ou
|
||||||
.B dhcp-vendorclass=printers,Hewlett-Packard JetDirect
|
.B dhcp-vendorclass=printers,Hewlett-Packard JetDirect
|
||||||
permet de n'allouer des options qu'aux imprimantes HP de la manière suivante :
|
permet de n'allouer des options qu'aux imprimantes HP de la manière suivante :
|
||||||
.B --dhcp-option=tag:printers,3,192.168.4.4
|
.B --dhcp-option=tag:printers,3,192.168.4.4
|
||||||
La chaîne de caractères de la classe de vendeur founie en argument est cherchée
|
La chaîne de caractères de la classe de vendeur fournie en argument est cherchée
|
||||||
en temps que sous-chaîne de caractères au sein de la classe de vendeur fournie
|
en temps que sous-chaîne de caractères au sein de la classe de vendeur fournie
|
||||||
par le client, de façon à permettre la recherche d'un sous-ensemble de la chaîne
|
par le client, de façon à permettre la recherche d'un sous-ensemble de la chaîne
|
||||||
de caractères ("fuzzy matching"). Le préfixe set: est optionnel mais autorisé
|
de caractères ("fuzzy matching"). Le préfixe set: est optionnel mais autorisé
|
||||||
@@ -1218,7 +1226,7 @@ matérielle coïncide avec les critères définis.
|
|||||||
.TP
|
.TP
|
||||||
.B --dhcp-circuitid=set:<label>,<identifiant de circuit>, --dhcp-remoteid=set:<label>,<identifiant distant>
|
.B --dhcp-circuitid=set:<label>,<identifiant de circuit>, --dhcp-remoteid=set:<label>,<identifiant distant>
|
||||||
Associe des options de relais DHCP issus de la RFC3046 à des labels.
|
Associe des options de relais DHCP issus de la RFC3046 à des labels.
|
||||||
Cette information peut-être fournie par des relais DHCP. L'identifiant
|
Cette information peut être fournie par des relais DHCP. L'identifiant
|
||||||
de circuit ou l'identifiant distant est normalement fourni sous la forme d'une
|
de circuit ou l'identifiant distant est normalement fourni sous la forme d'une
|
||||||
chaîne de valeurs hexadécimales séparées par des ":", mais il est également
|
chaîne de valeurs hexadécimales séparées par des ":", mais il est également
|
||||||
possible qu'elle le soit sous la forme d'une simple chaîne de caractères. Si
|
possible qu'elle le soit sous la forme d'une simple chaîne de caractères. Si
|
||||||
@@ -1231,7 +1239,7 @@ est supporté en IPv6 (mais non dhcp-circuitid).
|
|||||||
(IPv4 et IPv6) Associe des options de relais DHCP issues de la RFC3993 à des
|
(IPv4 et IPv6) Associe des options de relais DHCP issues de la RFC3993 à des
|
||||||
labels.
|
labels.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-proxy[=<adresse ip>]......
|
.B --dhcp-proxy[=<adresse IP>]......
|
||||||
(IPv4 seulement) Un agent relai DHCP normal est uniquement utilisé pour faire
|
(IPv4 seulement) Un agent relai DHCP normal est uniquement utilisé pour faire
|
||||||
suivre les éléments initiaux de l'interaction avec le serveur DHCP. Une fois
|
suivre les éléments initiaux de l'interaction avec le serveur DHCP. Une fois
|
||||||
que le client est configuré, il communique directement avec le serveur. Cela
|
que le client est configuré, il communique directement avec le serveur. Cela
|
||||||
@@ -1252,7 +1260,7 @@ interactions avec les relais dont l'adresse est dans la liste seront affectées.
|
|||||||
Si aucune valeur n'est spécifiée, associe le label si le client
|
Si aucune valeur n'est spécifiée, associe le label si le client
|
||||||
envoie une option DHCP avec le numéro ou le nom spécifié. Lorsqu'une valeur est
|
envoie une option DHCP avec le numéro ou le nom spécifié. Lorsqu'une valeur est
|
||||||
fournie, positionne le label seulement dans le cas où l'option est fournie et
|
fournie, positionne le label seulement dans le cas où l'option est fournie et
|
||||||
correspond à la valeur. La valeur peut-être de la forme "01:ff:*:02", auquel
|
correspond à la valeur. La valeur peut être de la forme "01:ff:*:02", auquel
|
||||||
cas le début de l'option doit correspondre (en respectant les jokers). La
|
cas le début de l'option doit correspondre (en respectant les jokers). La
|
||||||
valeur peut aussi être de la même forme que dans
|
valeur peut aussi être de la même forme que dans
|
||||||
.B dhcp-option
|
.B dhcp-option
|
||||||
@@ -1262,14 +1270,14 @@ valeur peut aussi être de la même forme que dans
|
|||||||
--dhcp-match=set:efi-ia32,option:client-arch,6
|
--dhcp-match=set:efi-ia32,option:client-arch,6
|
||||||
|
|
||||||
spécifie le label "efi-ia32" si le numéro 6 apparaît dnas la liste
|
spécifie le label "efi-ia32" si le numéro 6 apparaît dnas la liste
|
||||||
d'architectures envoyé par le client au sein de l'option 93. (se réferer
|
d'architectures envoyé par le client au sein de l'option 93. (se référer
|
||||||
au RFC 4578 pour plus de détails). Si la valeur est un chaine de caractères,
|
au RFC 4578 pour plus de détails). Si la valeur est un chaine de caractères,
|
||||||
celle-ci est recherchée (correspondance en temps que sous-chaîne).
|
celle-ci est recherchée (correspondance en temps que sous-chaîne).
|
||||||
|
|
||||||
Pour la forme particulière vi-encap:<numéro d'entreprise>, la comparaison se
|
Pour la forme particulière vi-encap:<numéro d'entreprise>, la comparaison se
|
||||||
fait avec les classes de vendeur "identifiant de vendeur" ("vendor-identifying
|
fait avec les classes de vendeur "identifiant de vendeur" ("vendor-identifying
|
||||||
vendor classes") pour l'entreprise dont le numéro est fourni en option.
|
vendor classes") pour l'entreprise dont le numéro est fourni en option.
|
||||||
Veuillez vous réferer à la RFC 3925 pour plus de détail.
|
Veuillez vous référer à la RFC 3925 pour plus de détails.
|
||||||
.TP
|
.TP
|
||||||
.B --tag-if=set:<label>[,set:<label>[,tag:<label>[,tag:<label>]]]
|
.B --tag-if=set:<label>[,set:<label>[,tag:<label>[,tag:<label>]]]
|
||||||
Effectue une opération booléenne sur les labels. Si tous les labels
|
Effectue une opération booléenne sur les labels. Si tous les labels
|
||||||
@@ -1280,7 +1288,7 @@ Si aucun tag:<label> n'est spécifié, alors tous les labels fournis par
|
|||||||
set:<label> sont positionnés.
|
set:<label> sont positionnés.
|
||||||
N'importe quel nombre de set: ou tag: peuvent être fournis, et l'ordre est sans
|
N'importe quel nombre de set: ou tag: peuvent être fournis, et l'ordre est sans
|
||||||
importance.
|
importance.
|
||||||
Les lignes tag-if sont executées dans l'ordre, ce qui fait que si un label dans
|
Les lignes tag-if sont exécutées dans l'ordre, ce qui fait que si un label dans
|
||||||
tag:<label> est un label positionné par une rêgle
|
tag:<label> est un label positionné par une rêgle
|
||||||
.B tag-if,
|
.B tag-if,
|
||||||
la ligne qui positionne le label doit précéder celle qui le teste.
|
la ligne qui positionne le label doit précéder celle qui le teste.
|
||||||
@@ -1320,17 +1328,17 @@ le cas de certains vieux clients BOOTP.
|
|||||||
(IPv4 seulement) Spécifie les options BOOTP devant être retournées par le
|
(IPv4 seulement) Spécifie les options BOOTP devant être retournées par le
|
||||||
serveur DHCP. Le nom de serveur ainsi que l'adresse sont optionnels : s'ils
|
serveur DHCP. Le nom de serveur ainsi que l'adresse sont optionnels : s'ils
|
||||||
ne sont pas fournis, le nom est laissé vide et l'adresse fournie est celle de
|
ne sont pas fournis, le nom est laissé vide et l'adresse fournie est celle de
|
||||||
la machine sur laquelle s'exécute Dnsmasq. Si Dnsmasq founit un service TFTP (voir
|
la machine sur laquelle s'exécute Dnsmasq. Si Dnsmasq fournit un service TFTP (voir
|
||||||
.B --enable-tftp
|
.B --enable-tftp
|
||||||
), alors seul un nom de fichier est requis ici pour permettre un démarrage par
|
), alors seul un nom de fichier est requis ici pour permettre un démarrage par
|
||||||
le réseau.
|
le réseau.
|
||||||
Si d'éventuels labels sont fournis, ils doivent coïncider avec
|
Si d'éventuels labels sont fournis, ils doivent coïncider avec
|
||||||
ceux du client pour que cet élement de configuration lui soit envoyé.
|
ceux du client pour que cet élément de configuration lui soit envoyé.
|
||||||
Une adresse de serveur TFTP peut être spécifiée à la place de l'adresse IP,
|
Une adresse de serveur TFTP peut être spécifiée à la place de l'adresse IP,
|
||||||
sous la forme d'un nom de domaine qui sera cherché dans le fichier /etc/hosts.
|
sous la forme d'un nom de domaine qui sera cherché dans le fichier /etc/hosts.
|
||||||
Ce nom peut être associé dans /etc/hosts avec plusieurs adresses IP, auquel cas
|
Ce nom peut être associé dans /etc/hosts avec plusieurs adresses IP, auquel cas
|
||||||
celles-ci seront utilisées tour à tour (algorithme round-robin).
|
celles-ci seront utilisées tour à tour (algorithme round-robin).
|
||||||
Cela peut-être utiliser pour équilibrer la charge tftp sur plusieurs serveurs.
|
Cela peut être utilisé pour équilibrer la charge tftp sur plusieurs serveurs.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-sequential-ip
|
.B --dhcp-sequential-ip
|
||||||
Dnsmasq est conçu pour choisir l'adresse IP des clients DHCP en utilisant
|
Dnsmasq est conçu pour choisir l'adresse IP des clients DHCP en utilisant
|
||||||
@@ -1357,7 +1365,7 @@ Ceci spécifie l'option de démarrage qui apparaitra dans un menu de démarrage
|
|||||||
PXE. <CSA> est le type du système client. Seuls des types de services valides
|
PXE. <CSA> est le type du système client. Seuls des types de services valides
|
||||||
apparaitront dans un menu. Les types connus sont x86PC, PC98, IA64_EFI, Alpha,
|
apparaitront dans un menu. Les types connus sont x86PC, PC98, IA64_EFI, Alpha,
|
||||||
Arc_x86, Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI et X86-64_EFI;
|
Arc_x86, Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI et X86-64_EFI;
|
||||||
D'autres types peuvent-être spécifiés sous la forme d'une valeur entière. Le
|
D'autres types peuvent être spécifiés sous la forme d'une valeur entière. Le
|
||||||
paramètre après le texte correspondant à l'entrée dans le menu peut être un nom
|
paramètre après le texte correspondant à l'entrée dans le menu peut être un nom
|
||||||
de fichier, auquel cas Dnsmasq agit comme un serveur de démarrage et indique au
|
de fichier, auquel cas Dnsmasq agit comme un serveur de démarrage et indique au
|
||||||
client PXE qu'il faut télécharger ce fichier via TFTP, soit depuis ce serveur
|
client PXE qu'il faut télécharger ce fichier via TFTP, soit depuis ce serveur
|
||||||
@@ -1376,7 +1384,7 @@ démarrage n'est fournie (ou qu'une valeur de 0 est donnée pour le type de
|
|||||||
service), alors l'entrée de menu provoque l'interruption du démarrage par
|
service), alors l'entrée de menu provoque l'interruption du démarrage par
|
||||||
le réseau et la poursuite du démarrage sur un média local. L'adresse de serveur
|
le réseau et la poursuite du démarrage sur un média local. L'adresse de serveur
|
||||||
peut être donnée sous la forme de nom de domaine qui est recherché dans
|
peut être donnée sous la forme de nom de domaine qui est recherché dans
|
||||||
/etc/hosts. Ce nom peut-être associé à plusieurs adresses IP, qui dans ce cas
|
/etc/hosts. Ce nom peut être associé à plusieurs adresses IP, qui dans ce cas
|
||||||
sont utilisées à tour de rôle (en "round-robin").
|
sont utilisées à tour de rôle (en "round-robin").
|
||||||
.TP
|
.TP
|
||||||
.B --pxe-prompt=[tag:<label>,]<invite>[,<délai>]
|
.B --pxe-prompt=[tag:<label>,]<invite>[,<délai>]
|
||||||
@@ -1435,7 +1443,7 @@ Utiliser cette option avec précaution, une adresse allouée à un client BOOTP
|
|||||||
étant perpétuelle, et de fait n'est plus disponibles pour d'autres hôtes. Si
|
étant perpétuelle, et de fait n'est plus disponibles pour d'autres hôtes. Si
|
||||||
aucun argument n'est donné, alors cette option permet une allocation dynamique
|
aucun argument n'est donné, alors cette option permet une allocation dynamique
|
||||||
dans tous les cas. Si des arguments sont spécifiés, alors l'allocation ne se
|
dans tous les cas. Si des arguments sont spécifiés, alors l'allocation ne se
|
||||||
fait que lorsque tous les identifiants coïncident. Il est possible de répeter
|
fait que lorsque tous les identifiants coïncident. Il est possible de répéter
|
||||||
cette option avec plusieurs jeux d'arguments.
|
cette option avec plusieurs jeux d'arguments.
|
||||||
.TP
|
.TP
|
||||||
.B \-5, --no-ping
|
.B \-5, --no-ping
|
||||||
@@ -1560,7 +1568,7 @@ Tous les descripteurs de fichiers sont fermés, sauf stdin, stdout et stderr qui
|
|||||||
sont ouverts sur /dev/null (sauf en mode déverminage).
|
sont ouverts sur /dev/null (sauf en mode déverminage).
|
||||||
|
|
||||||
Le script n'est pas lancé de manière concurrente : au plus une instance du
|
Le script n'est pas lancé de manière concurrente : au plus une instance du
|
||||||
script est executée à la fois (dnsmasq attends qu'une instance de script se
|
script est exécutée à la fois (dnsmasq attend qu'une instance de script se
|
||||||
termine avant de lancer la suivante). Les changements dans la base des baux
|
termine avant de lancer la suivante). Les changements dans la base des baux
|
||||||
nécessitant le lancement du script sont placé en attente dans une queue jusqu'à
|
nécessitant le lancement du script sont placé en attente dans une queue jusqu'à
|
||||||
terminaison d'une instance du script en cours. Si cette mise en queue fait que
|
terminaison d'une instance du script en cours. Si cette mise en queue fait que
|
||||||
@@ -1575,7 +1583,7 @@ le script sera invoqué avec une action "old" pour tous les baux existants.
|
|||||||
|
|
||||||
Il existe deux autres actions pouvant apparaître comme argument au script :
|
Il existe deux autres actions pouvant apparaître comme argument au script :
|
||||||
"init" et "tftp". D'autres sont susceptibles d'être rajoutées dans le futur,
|
"init" et "tftp". D'autres sont susceptibles d'être rajoutées dans le futur,
|
||||||
aussi les scripts devraient-être écrits de sorte à ignorer les actions
|
aussi les scripts devraient être écrits de sorte à ignorer les actions
|
||||||
inconnues. "init" est décrite ci-dessous dans
|
inconnues. "init" est décrite ci-dessous dans
|
||||||
.B --leasefile-ro.
|
.B --leasefile-ro.
|
||||||
L'action "tftp" est invoquée lorsqu'un transfert de fichier TFTP s'est
|
L'action "tftp" est invoquée lorsqu'un transfert de fichier TFTP s'est
|
||||||
@@ -1588,7 +1596,7 @@ Spécifie un script écrit en Lua, devant être exécuté lorsque des baux sont
|
|||||||
créés, détruits ou modifiés. Pour utiliser cette option, dnsmasq doit être
|
créés, détruits ou modifiés. Pour utiliser cette option, dnsmasq doit être
|
||||||
compilé avec avec le support de Lua. L'interpréteur Lua est initialisé une
|
compilé avec avec le support de Lua. L'interpréteur Lua est initialisé une
|
||||||
seule fois, lorsque dnsmasq démarre, ce qui fait que les variables globales
|
seule fois, lorsque dnsmasq démarre, ce qui fait que les variables globales
|
||||||
persistent entre les évênements liés aux baux. Le code Lua doit définir une
|
persistent entre les événements liés aux baux. Le code Lua doit définir une
|
||||||
fonction
|
fonction
|
||||||
.B lease
|
.B lease
|
||||||
et peut fournir des fonctions
|
et peut fournir des fonctions
|
||||||
@@ -1637,7 +1645,7 @@ et
|
|||||||
.B --dhcp-scriptuser
|
.B --dhcp-scriptuser
|
||||||
Spécifie l'utilisateur sous lequel le script shell lease-change ou le script
|
Spécifie l'utilisateur sous lequel le script shell lease-change ou le script
|
||||||
doivent être exécutés. La valeur par défaut correspond à l'utilisateur root
|
doivent être exécutés. La valeur par défaut correspond à l'utilisateur root
|
||||||
mais peut-être changée par le biais de cette option.
|
mais peut être changée par le biais de cette option.
|
||||||
.TP
|
.TP
|
||||||
.B \-9, --leasefile-ro
|
.B \-9, --leasefile-ro
|
||||||
Supprimer complètement l'usage du fichier servant de base de donnée pour les
|
Supprimer complètement l'usage du fichier servant de base de donnée pour les
|
||||||
@@ -1649,8 +1657,8 @@ biais de l'option
|
|||||||
être complètement gérée par le script sur un stockage externe. En addition aux
|
être complètement gérée par le script sur un stockage externe. En addition aux
|
||||||
actions décrites dans
|
actions décrites dans
|
||||||
.B --dhcp-script,
|
.B --dhcp-script,
|
||||||
le script de changement d'état de bail est appellé une fois, au lancement de
|
le script de changement d'état de bail est appelé une fois, au lancement de
|
||||||
Dnsmasq, avec pour seul argument "init". Lorsqu'appellé de la sorte, le script
|
Dnsmasq, avec pour seul argument "init". Lorsqu'appelé de la sorte, le script
|
||||||
doit fournir l'état de la base de baux, dans le format de fichier de baux de
|
doit fournir l'état de la base de baux, dans le format de fichier de baux de
|
||||||
Dnsmasq, sur sa sortie standard (stdout) et retourner un code de retour de 0.
|
Dnsmasq, sur sa sortie standard (stdout) et retourner un code de retour de 0.
|
||||||
Positionner cette option provoque également une invocation du script de
|
Positionner cette option provoque également une invocation du script de
|
||||||
@@ -1692,20 +1700,20 @@ positionné à la première valeur de la directive "search" du fichier
|
|||||||
/etc/resolv.conf (ou équivalent).
|
/etc/resolv.conf (ou équivalent).
|
||||||
|
|
||||||
La gamme d'adresses peut être de la forme
|
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>,<adresse IP> ou <adresse IP>/<masque de réseau> voire une simple
|
||||||
<adresse ip>. Voir
|
<adresse IP>. Voir
|
||||||
.B --dhcp-fqdn
|
.B --dhcp-fqdn
|
||||||
qui peut changer le comportement de dnsmasq relatif aux domaines.
|
qui peut changer le comportement de dnsmasq relatif aux domaines.
|
||||||
|
|
||||||
Si la gamme d'adresse est fournie sous la forme
|
Si la gamme d'adresse est fournie sous la forme
|
||||||
<adresse ip>/<taille de réseau>, alors le drapeau "local" peut-être rajouté
|
<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
|
qui a pour effet d'ajouter --local-declarations aux requêtes DNS directes et
|
||||||
inverses. C-à-d
|
inverses. C-à-d
|
||||||
.B --domain=thekelleys.org.uk,192.168.0.0/24,local
|
.B --domain=thekelleys.org.uk,192.168.0.0/24,local
|
||||||
est identique à
|
est identique à
|
||||||
.B --domain=thekelleys.org.uk,192.168.0.0/24
|
.B --domain=thekelleys.org.uk,192.168.0.0/24
|
||||||
--local=/thekelleys.org.uk/ --local=/0.168.192.in-addr.arpa/
|
--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.
|
La taille de réseau doit être de 8, 16 ou 24 pour être valide.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-fqdn
|
.B --dhcp-fqdn
|
||||||
Dans le mode par défaut, dnsmasq insère les noms non-qualifiés des clients
|
Dans le mode par défaut, dnsmasq insère les noms non-qualifiés des clients
|
||||||
@@ -1717,8 +1725,8 @@ ce nom est transféré au nouveau client. Si
|
|||||||
est spécifié, ce comportement change : les noms non qualifiés ne sont plus
|
est spécifié, ce comportement change : les noms non qualifiés ne sont plus
|
||||||
rajoutés dans le DNS, seuls les noms qualifiés le sont. Deux clients DHCP
|
rajoutés dans le DNS, seuls les noms qualifiés le sont. Deux clients DHCP
|
||||||
avec le même nom peuvent tous les deux garder le nom, pour peu que la partie
|
avec le même nom peuvent tous les deux garder le nom, pour peu que la partie
|
||||||
relative au domaine soit différente (c-à-d que les noms pleinements qualifiés
|
relative au domaine soit différente (c-à-d que les noms pleinement qualifiés
|
||||||
diffèrent). Pour d'assurer que tous les noms ont une partie domaine, il doit-y
|
diffèrent). Pour s'assurer que tous les noms ont une partie domaine, il doit y
|
||||||
avoir au moins un
|
avoir au moins un
|
||||||
.B --domain
|
.B --domain
|
||||||
sans gamme d'adresses de spécifié lorsque l'option
|
sans gamme d'adresses de spécifié lorsque l'option
|
||||||
@@ -1735,7 +1743,7 @@ Windows de la mise à jour de serveurs Active Directory. Voir la RFC 4702 pour
|
|||||||
plus de détails.
|
plus de détails.
|
||||||
.TP
|
.TP
|
||||||
.B --enable-ra
|
.B --enable-ra
|
||||||
Active la fonctionalité d'annonces routeurs IPv6 ("IPv6 Router Advertisement").
|
Active la fonctionnalité d'annonces routeurs IPv6 ("IPv6 Router Advertisement").
|
||||||
DHCPv6 ne gère pas la configuration complète du réseau de la même façon que
|
DHCPv6 ne gère pas la configuration complète du réseau de la même façon que
|
||||||
DHCPv4. La découverte de routeurs et la découverte (éventuelle) de préfixes pour
|
DHCPv4. La découverte de routeurs et la découverte (éventuelle) de préfixes pour
|
||||||
la création autonome d'adresse sont gérées par un protocole différent.
|
la création autonome d'adresse sont gérées par un protocole différent.
|
||||||
@@ -1747,7 +1755,7 @@ dhcp-range et, par défaut, fournir comme valeur de routeur et de DNS récursif
|
|||||||
la valeur d'adresse link-local appropriée parmi celles de la machine sur
|
la valeur d'adresse link-local appropriée parmi celles de la machine sur
|
||||||
laquelle tourne dnsmasq.
|
laquelle tourne dnsmasq.
|
||||||
Par défaut, les bits "managed address" sont positionnés, et le bit "use SLAAC"
|
Par défaut, les bits "managed address" sont positionnés, et le bit "use SLAAC"
|
||||||
("utiliser SLAAC") est réinitialisé. Cela peut-être changé pour des
|
("utiliser SLAAC") est réinitialisé. Cela peut être changé pour des
|
||||||
sous-réseaux donnés par le biais du mot clef de mode décris dans
|
sous-réseaux donnés par le biais du mot clef de mode décris dans
|
||||||
.B --dhcp-range.
|
.B --dhcp-range.
|
||||||
Les paramètres DNS du RFC6106 sont inclus dans les annonces. Par défaut,
|
Les paramètres DNS du RFC6106 sont inclus dans les annonces. Par défaut,
|
||||||
@@ -1759,16 +1767,16 @@ DNSSL.
|
|||||||
.B --ra-param=<interface>,[mtu:<valeur>|<interface>|off,][high,|low,]<intervalle d'annonce routeur>[,<durée de vie route>]
|
.B --ra-param=<interface>,[mtu:<valeur>|<interface>|off,][high,|low,]<intervalle d'annonce routeur>[,<durée de vie route>]
|
||||||
Configure pour une interface donnée des valeurs pour les annonces routeurs
|
Configure pour une interface donnée des valeurs pour les annonces routeurs
|
||||||
différentes des valeurs par défaut. La valeur par défaut du champ priorité
|
différentes des valeurs par défaut. La valeur par défaut du champ priorité
|
||||||
pour le routeur peut-être changée de "medium" (moyen) à "high" (haute) ou
|
pour le routeur peut être changée de "medium" (moyen) à "high" (haute) ou
|
||||||
"low" (basse). Par exemple :
|
"low" (basse). Par exemple :
|
||||||
.B --ra-param=eth0,high,0.
|
.B --ra-param=eth0,high,0.
|
||||||
Un intervalle (en secondes) entre les annonces routeur peut-être fourni par :
|
Un intervalle (en secondes) entre les annonces routeur peut être fourni par :
|
||||||
.B --ra-param=eth0,60.
|
.B --ra-param=eth0,60.
|
||||||
La durée de vie de la route peut-être changée ou mise à zéro, auquel cas
|
La durée de vie de la route peut être changée ou mise à zéro, auquel cas
|
||||||
le routeur peut annoncer les préfixes mais pas de route :
|
le routeur peut annoncer les préfixes mais pas de route :
|
||||||
.B --ra-parm=eth0,0,0
|
.B --ra-parm=eth0,0,0
|
||||||
(une valeur de zéro pour l'intervalle signifie qu'il garde la valeur par défaut).
|
(une valeur de zéro pour l'intervalle signifie qu'il garde la valeur par défaut).
|
||||||
Ces quatre paramètres peuvent-être configurés en une fois :
|
Ces quatre paramètres peuvent être configurés en une fois :
|
||||||
.B --ra-param=eth0,mtu:1280,low,60,1200
|
.B --ra-param=eth0,mtu:1280,low,60,1200
|
||||||
La valeur pour l'interface peut inclure un caractère joker.
|
La valeur pour l'interface peut inclure un caractère joker.
|
||||||
.TP
|
.TP
|
||||||
@@ -1776,7 +1784,7 @@ La valeur pour l'interface peut inclure un caractère joker.
|
|||||||
Active la fonction serveur TFTP. Celui-ci est de manière délibérée limité aux
|
Active la fonction serveur TFTP. Celui-ci est de manière délibérée limité aux
|
||||||
fonctions nécessaires au démarrage par le réseau ("net-boot") d'un client. Seul
|
fonctions nécessaires au démarrage par le réseau ("net-boot") d'un client. Seul
|
||||||
un accès en lecture est possible; les extensions tsize et blksize sont supportées
|
un accès en lecture est possible; les extensions tsize et blksize sont supportées
|
||||||
(tsize est seulement supporté en mode octet). Sans argument optionel, le service
|
(tsize est seulement supportée en mode octet). Sans argument optionnel, le service
|
||||||
TFTP est fourni sur les mêmes interfaces que le service DHCP. Si une liste
|
TFTP est fourni sur les mêmes interfaces que le service DHCP. Si une liste
|
||||||
d'interfaces est fournie, cela définit les interfaces sur lesquelles le
|
d'interfaces est fournie, cela définit les interfaces sur lesquelles le
|
||||||
service TFTP sera activé.
|
service TFTP sera activé.
|
||||||
@@ -1847,9 +1855,9 @@ Un serveur TFTP écoute sur le port prédéfini 69 ("well-known port") pour
|
|||||||
l'initiation de la connexion, mais utilise également un port dynamiquement
|
l'initiation de la connexion, mais utilise également un port dynamiquement
|
||||||
alloué pour chaque connexion. Normalement, ces ports sont alloués par
|
alloué pour chaque connexion. Normalement, ces ports sont alloués par
|
||||||
le système d'exploitation, mais cette option permet de spécifier une gamme
|
le système d'exploitation, mais cette option permet de spécifier une gamme
|
||||||
de ports à utiliser pour les transferts TFTP. Cela peut-être utile si
|
de ports à utiliser pour les transferts TFTP. Cela peut être utile si
|
||||||
TFTP doit traverser un dispositif garde-barrière ("firewall"). La valeur
|
TFTP doit traverser un dispositif garde-barrière ("firewall"). La valeur
|
||||||
de début pour la plage de port ne peut-être inférieure à 1025 sauf si
|
de début pour la plage de port ne peut être inférieure à 1025 sauf si
|
||||||
dnsmasq tourne en temps que super-utilisateur ("root"). Le nombre de
|
dnsmasq tourne en temps que super-utilisateur ("root"). Le nombre de
|
||||||
connexions TFTP concurrentes est limitée par la taille de la gamme de
|
connexions TFTP concurrentes est limitée par la taille de la gamme de
|
||||||
ports ainsi spécifiée.
|
ports ainsi spécifiée.
|
||||||
@@ -1859,8 +1867,8 @@ Un serveur TFTP écoute sur un numéro de port bien connu (69) pour l'initiation
|
|||||||
de la connexion, et alloue dynamiquement un port pour chaque connexion. Ces
|
de la connexion, et alloue dynamiquement un port pour chaque connexion. Ces
|
||||||
numéros de ports sont en principe alloués par le système d'exploitation, mais
|
numéros de ports sont en principe alloués par le système d'exploitation, mais
|
||||||
cette option permet de spécifier une gamme de ports à utiliser pour les
|
cette option permet de spécifier une gamme de ports à utiliser pour les
|
||||||
transferts TFTP. Cela peut-être utile lorsque ceux-ci doivent traverser un
|
transferts TFTP. Cela peut être utile lorsque ceux-ci doivent traverser un
|
||||||
dispositif garde-barrière ("firewall"). Le début de la plage ne peut-être
|
dispositif garde-barrière ("firewall"). Le début de la plage ne peut être
|
||||||
inférieur à 1024 à moins que Dnsmasq ne fonctionne en temps que
|
inférieur à 1024 à moins que Dnsmasq ne fonctionne en temps que
|
||||||
super-utilisateur ("root"). Le nombre maximal de connexions TFTP concurrentes
|
super-utilisateur ("root"). Le nombre maximal de connexions TFTP concurrentes
|
||||||
est limitée par la taille de la plage de ports ainsi définie.
|
est limitée par la taille de la plage de ports ainsi définie.
|
||||||
@@ -1895,7 +1903,7 @@ par "--". Les lignes commençant par # sont des commentaires et sont ignorées.
|
|||||||
Pour les options qui ne peuvent-être spécifiées qu'une seule fois, celle du
|
Pour les options qui ne peuvent-être spécifiées qu'une seule fois, celle du
|
||||||
fichier de configuration prends le pas sur celle fournie en ligne de commande.
|
fichier de configuration prends le pas sur celle fournie en ligne de commande.
|
||||||
Il est possible d'utiliser des guillemets afin d'éviter que les ",",":","." et
|
Il est possible d'utiliser des guillemets afin d'éviter que les ",",":","." et
|
||||||
"#" ne soit interprêtés, et il est possible d'utiliser les séquences
|
"#" ne soient interprétés, et il est possible d'utiliser les séquences
|
||||||
d'échappement suivantes : \\\\ \\" \\t \\e \\b \\r et \\n. Elles correspondent
|
d'échappement suivantes : \\\\ \\" \\t \\e \\b \\r et \\n. Elles correspondent
|
||||||
respectivement à la barre oblique descendante ("anti-slash"), guillemets doubles,
|
respectivement à la barre oblique descendante ("anti-slash"), guillemets doubles,
|
||||||
tabulation, caractère d'échappement ("escape"), suppression ("backspace"), retour ("return") et
|
tabulation, caractère d'échappement ("escape"), suppression ("backspace"), retour ("return") et
|
||||||
@@ -1940,8 +1948,8 @@ traces dans un fichier (voir
|
|||||||
.B --log-facility
|
.B --log-facility
|
||||||
), alors
|
), alors
|
||||||
.B Dnsmasq
|
.B Dnsmasq
|
||||||
ferme et re-rouvre le fichier de traces. Il faut noter que pendant cette
|
ferme et rouvre le fichier de traces. Il faut noter que pendant cette
|
||||||
opération Dnsmasq ne s'exécute pas en temps que "root". Lorsqu'il créé un
|
opération Dnsmasq ne s'exécute pas en tant que "root". Lorsqu'il créé un
|
||||||
fichier de traces pour la première fois, Dnsmasq change le propriétaire du
|
fichier de traces pour la première fois, Dnsmasq change le propriétaire du
|
||||||
fichier afin de le faire appartenir à l'utilisateur non "root" sous lequel
|
fichier afin de le faire appartenir à l'utilisateur non "root" sous lequel
|
||||||
Dnsmasq s'exécute. Le logiciel de rotation de fichiers de trace logrotate doit
|
Dnsmasq s'exécute. Le logiciel de rotation de fichiers de trace logrotate doit
|
||||||
@@ -1983,7 +1991,7 @@ qu'une connexion PPP ne soit établie. Dans ce cas, Dnsmasq vérifie régulière
|
|||||||
pour voir si un fichier
|
pour voir si un fichier
|
||||||
.I /etc/resolv.conf
|
.I /etc/resolv.conf
|
||||||
est créé. Dnsmasq peut être configuré pour lire plus d'un fichier resolv.conf.
|
est créé. Dnsmasq peut être configuré pour lire plus d'un fichier resolv.conf.
|
||||||
Cela est utile sur un ordinateur portable où PPP et DHCP peuvent-être utilisés :
|
Cela est utile sur un ordinateur portable où PPP et DHCP peuvent être utilisés :
|
||||||
Dnsmasq peut alors être configuré pour lire à la fois
|
Dnsmasq peut alors être configuré pour lire à la fois
|
||||||
.I /etc/ppp/resolv.conf
|
.I /etc/ppp/resolv.conf
|
||||||
et
|
et
|
||||||
@@ -2007,7 +2015,7 @@ ou alors en mettant leurs adresses dans un autre fichier, par exemple
|
|||||||
.I /etc/resolv.dnsmasq
|
.I /etc/resolv.dnsmasq
|
||||||
et en lançant Dnsmasq avec l'option
|
et en lançant Dnsmasq avec l'option
|
||||||
.B \-r /etc/resolv.dnsmasq.
|
.B \-r /etc/resolv.dnsmasq.
|
||||||
Cette deuxième technique permet la mise-à-jour dynamique des addresses de
|
Cette deuxième technique permet la mise-à-jour dynamique des adresses de
|
||||||
serveurs DNS amont par le biais de PPP ou DHCP.
|
serveurs DNS amont par le biais de PPP ou DHCP.
|
||||||
.PP
|
.PP
|
||||||
Les adresses dans /etc/hosts prennent le dessus sur celles fournies par le
|
Les adresses dans /etc/hosts prennent le dessus sur celles fournies par le
|
||||||
@@ -2067,10 +2075,10 @@ et pour affecter l'option envoyée, sur la base de la plage sélectionnée.
|
|||||||
|
|
||||||
Ce système a évolué d'un système plus ancien et aux possibilités plus limitées,
|
Ce système a évolué d'un système plus ancien et aux possibilités plus limitées,
|
||||||
et pour des raisons de compatibilité "net:" peut être utilisé à la place de
|
et pour des raisons de compatibilité "net:" peut être utilisé à la place de
|
||||||
"tag:" et "set:" peut-être omis (à l'exception de
|
"tag:" et "set:" peut être omis (à l'exception de
|
||||||
.B dhcp-host,
|
.B dhcp-host,
|
||||||
où "net:" peut-être utilisé à la place de "set:"). Pour les mêmes raisons, '#'
|
où "net:" peut être utilisé à la place de "set:"). Pour les mêmes raisons, '#'
|
||||||
peut-être utilisé à la place de '!' pour indiquer la négation.
|
peut être utilisé à la place de '!' pour indiquer la négation.
|
||||||
.PP
|
.PP
|
||||||
Le serveur DHCP intégré dans Dnsmasq fonctionne également en temps que serveur
|
Le serveur DHCP intégré dans Dnsmasq fonctionne également en temps que serveur
|
||||||
BOOTP, pour peu que l'adresse MAC et l'adresse IP des clients soient fournies,
|
BOOTP, pour peu que l'adresse MAC et l'adresse IP des clients soient fournies,
|
||||||
@@ -2097,7 +2105,7 @@ scénarios de complexité croissante. Le pré-requis pour chacun de ces scénari
|
|||||||
est l'existence d'une adresse IP globalement disponible, d'un enregistrement de
|
est l'existence d'une adresse IP globalement disponible, d'un enregistrement de
|
||||||
type A ou AAAA pointant vers cette adresse, ainsi que d'un serveur DNS externe
|
type A ou AAAA pointant vers cette adresse, ainsi que d'un serveur DNS externe
|
||||||
capable d'effectuer la délégation de la zone en question. Pour la première
|
capable d'effectuer la délégation de la zone en question. Pour la première
|
||||||
partie de ces explications, nous allons appeller serveur.exemple.com
|
partie de ces explications, nous allons appeler serveur.exemple.com
|
||||||
l'enregistrement A (ou AAAA) de l'adresse globalement accessible, et
|
l'enregistrement A (ou AAAA) de l'adresse globalement accessible, et
|
||||||
notre.zone.com la zone pour laquelle dnsmasq fait autorité.
|
notre.zone.com la zone pour laquelle dnsmasq fait autorité.
|
||||||
|
|
||||||
@@ -2138,11 +2146,11 @@ notre.zone.com NS our.zone.com
|
|||||||
.fi
|
.fi
|
||||||
|
|
||||||
L'enregistrement A pour notre.zone.com est dorénavant un enregistrement "colle"
|
L'enregistrement A pour notre.zone.com est dorénavant un enregistrement "colle"
|
||||||
qui résoud le problème de poule et d'oeuf consistant à trouver l'adresse IP
|
qui résout le problème de poule et d'oeuf consistant à trouver l'adresse IP
|
||||||
du serveur de nom pour notre.zone.com lorsque l'enregistrement se trouve dans
|
du serveur de nom pour notre.zone.com lorsque l'enregistrement se trouve dans
|
||||||
la zone en question. Il s'agit du seul rôle de cet enregistrement : comme dnsmasq
|
la zone en question. Il s'agit du seul rôle de cet enregistrement : comme dnsmasq
|
||||||
fait désormais autorité pour notre.zone.com, il doit également fournir cet
|
fait désormais autorité pour notre.zone.com, il doit également fournir cet
|
||||||
enregistrement. Si l'adresse externe est statique, cela peut-être réalisé par
|
enregistrement. Si l'adresse externe est statique, cela peut être réalisé par
|
||||||
le biais d'une entrée dans
|
le biais d'une entrée dans
|
||||||
.B /etc/hosts
|
.B /etc/hosts
|
||||||
ou via un
|
ou via un
|
||||||
@@ -2194,7 +2202,7 @@ spécifiques, vous pouvez le faire via :
|
|||||||
Dnsmasq joue le rôle de serveur faisant autorité pour les domaines in-addr.arpa
|
Dnsmasq joue le rôle de serveur faisant autorité pour les domaines in-addr.arpa
|
||||||
et ip6.arpa associés aux sous-réseaux définis dans la déclaration de zone
|
et ip6.arpa associés aux sous-réseaux définis dans la déclaration de zone
|
||||||
auth-zone, ce qui fait que les requêtes DNS inversées (de l'adresse vers
|
auth-zone, ce qui fait que les requêtes DNS inversées (de l'adresse vers
|
||||||
le nom) peuvent-simplement être configurées avec un enregistrement NS
|
le nom) peuvent simplement être configurées avec un enregistrement NS
|
||||||
adéquat. Par exemple, comme nous définissons plus haut les adresses
|
adéquat. Par exemple, comme nous définissons plus haut les adresses
|
||||||
1.2.3.0/24 :
|
1.2.3.0/24 :
|
||||||
.nf
|
.nf
|
||||||
@@ -2243,7 +2251,7 @@ celui fourni par
|
|||||||
.B --domain.
|
.B --domain.
|
||||||
Si l'option
|
Si l'option
|
||||||
.B --dhcp-fqdn
|
.B --dhcp-fqdn
|
||||||
est fournie, alors les noms pleinemenet qualifiés associés aux baux DHCP
|
est fournie, alors les noms pleinement qualifiés associés aux baux DHCP
|
||||||
sont utilisés, dès lors qu'ils correspondent au nom de domaine associé
|
sont utilisés, dès lors qu'ils correspondent au nom de domaine associé
|
||||||
à la zone.
|
à la zone.
|
||||||
|
|
||||||
@@ -2282,7 +2290,7 @@ Dnsmasq est capable de gérer le DNS et DHCP pour au moins un millier de clients
|
|||||||
Pour cela, la durée des bail ne doit pas être très courte (moins d'une heure).
|
Pour cela, la durée des bail ne doit pas être très courte (moins d'une heure).
|
||||||
La valeur de
|
La valeur de
|
||||||
.B --dns-forward-max
|
.B --dns-forward-max
|
||||||
peut-être augmentée : commencer par la rendre égale au nombre de clients et
|
peut être augmentée : commencer par la rendre égale au nombre de clients et
|
||||||
l'augmenter si le DNS semble lent. Noter que la performance du DNS dépends
|
l'augmenter si le DNS semble lent. Noter que la performance du DNS dépends
|
||||||
également de la performance des serveurs amonts. La taille du cache DNS peut-
|
également de la performance des serveurs amonts. La taille du cache DNS peut-
|
||||||
être augmentée : la limite en dur est de 10000 entrées et la valeur par défaut
|
être augmentée : la limite en dur est de 10000 entrées et la valeur par défaut
|
||||||
@@ -2306,7 +2314,7 @@ Il est possible d'utiliser Dnsmasq pour bloquer la publicité sur la toile
|
|||||||
en associant des serveurs de publicité bien connus à l'adresse 127.0.0.1 ou
|
en associant des serveurs de publicité bien connus à l'adresse 127.0.0.1 ou
|
||||||
0.0.0.0 par le biais du fichier
|
0.0.0.0 par le biais du fichier
|
||||||
.B /etc/hosts
|
.B /etc/hosts
|
||||||
ou d'un fichier d'hôte additionnel. Cette liste peut-être très longue, Dnsmasq
|
ou d'un fichier d'hôte additionnel. Cette liste peut être très longue, Dnsmasq
|
||||||
ayant été testé avec succès avec un million de noms. Cette taille de fichier
|
ayant été testé avec succès avec un million de noms. Cette taille de fichier
|
||||||
nécessite un processeur à 1 Ghz et environ 60 Mo de RAM.
|
nécessite un processeur à 1 Ghz et environ 60 Mo de RAM.
|
||||||
|
|
||||||
|
|||||||
@@ -9,18 +9,18 @@
|
|||||||
# Simon Kelley <simon@thekelleys.org.uk>, 2005.
|
# Simon Kelley <simon@thekelleys.org.uk>, 2005.
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: dnsmasq 2.77\n"
|
"Project-Id-Version: dnsmasq 2.80\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2009-06-18 12:24+0100\n"
|
"POT-Creation-Date: 2009-06-18 12:24+0100\n"
|
||||||
"PO-Revision-Date: 2017-07-17 18:30+0100\n"
|
"PO-Revision-Date: 2018-09-29 00:13+0200\n"
|
||||||
"Last-Translator: Conrad Kostecki <ck@conrad-kostecki.de>\n"
|
"Last-Translator: Conrad Kostecki <conrad@kostecki.com>\n"
|
||||||
"Language-Team: German <de@li.org>\n"
|
"Language-Team: German <de@li.org>\n"
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
"X-Generator: Poedit 2.0.1\n"
|
"X-Generator: Poedit 2.1.1\n"
|
||||||
"X-Poedit-SourceCharset: UTF-8\n"
|
"X-Poedit-SourceCharset: UTF-8\n"
|
||||||
|
|
||||||
#: cache.c:518
|
#: cache.c:518
|
||||||
@@ -150,7 +150,7 @@ msgstr "Konfigurationsdatei festlegen (Voreinstellung: %s)."
|
|||||||
|
|
||||||
#: option.c:350
|
#: option.c:350
|
||||||
msgid "Do NOT fork into the background: run in debug mode."
|
msgid "Do NOT fork into the background: run in debug mode."
|
||||||
msgstr "NICHT in den Hintergrund gehen: Betrieb im Debug-Modus"
|
msgstr "NICHT in den Hintergrund gehen: Betrieb im Debug-Modus."
|
||||||
|
|
||||||
#: option.c:351
|
#: option.c:351
|
||||||
msgid "Do NOT forward queries with no domain part."
|
msgid "Do NOT forward queries with no domain part."
|
||||||
@@ -166,12 +166,12 @@ msgstr "Erweitere einfache Namen in /etc/hosts mit der Domänen-Endung."
|
|||||||
|
|
||||||
#: option.c:354
|
#: option.c:354
|
||||||
msgid "Don't forward spurious DNS requests from Windows hosts."
|
msgid "Don't forward spurious DNS requests from Windows hosts."
|
||||||
msgstr "'unechte' DNS-Anfragen von Windows-Rechnern nicht weiterleiten"
|
msgstr "'unechte' DNS-Anfragen von Windows-Rechnern nicht weiterleiten."
|
||||||
|
|
||||||
# @Simon: I'm a bit unsure about "spurious"
|
# @Simon: I'm a bit unsure about "spurious"
|
||||||
#: option.c:355
|
#: option.c:355
|
||||||
msgid "Enable DHCP in the range given with lease duration."
|
msgid "Enable DHCP in the range given with lease duration."
|
||||||
msgstr "DHCP für angegebenen Bereich und Dauer einschalten"
|
msgstr "DHCP für angegebenen Bereich und Dauer einschalten."
|
||||||
|
|
||||||
#: option.c:356
|
#: option.c:356
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -314,7 +314,7 @@ msgstr "Ausgehenden Port erzwingen für DNS-Anfragen an vorgelagerte Server."
|
|||||||
|
|
||||||
#: option.c:389
|
#: option.c:389
|
||||||
msgid "Do NOT read resolv.conf."
|
msgid "Do NOT read resolv.conf."
|
||||||
msgstr "resolv.conf NICHT lesen."
|
msgstr "Die resolv.conf NICHT lesen."
|
||||||
|
|
||||||
#: option.c:390
|
#: option.c:390
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -323,7 +323,7 @@ msgstr "Pfad zu resolv.conf festlegen (%s voreingestellt)."
|
|||||||
|
|
||||||
#: option.c:391
|
#: option.c:391
|
||||||
msgid "Specify path to file with server= options"
|
msgid "Specify path to file with server= options"
|
||||||
msgstr " Dateipfad mit der Option server= angeben"
|
msgstr "Dateipfad mit der Option server= angeben"
|
||||||
|
|
||||||
#: option.c:392
|
#: option.c:392
|
||||||
msgid "Specify address(es) of upstream servers with optional domains."
|
msgid "Specify address(es) of upstream servers with optional domains."
|
||||||
@@ -376,7 +376,7 @@ msgstr "DHCP-\"vendor class\" auf Marke abbilden."
|
|||||||
|
|
||||||
#: option.c:404
|
#: option.c:404
|
||||||
msgid "Display dnsmasq version and copyright information."
|
msgid "Display dnsmasq version and copyright information."
|
||||||
msgstr "dnsmasq-Version und Urheberrecht anzeigen."
|
msgstr "DNSMasq-Version und Urheberrecht anzeigen."
|
||||||
|
|
||||||
#: option.c:405
|
#: option.c:405
|
||||||
msgid "Translate IPv4 addresses from upstream servers."
|
msgid "Translate IPv4 addresses from upstream servers."
|
||||||
@@ -504,9 +504,8 @@ msgid "Export files by TFTP only from the specified subtree."
|
|||||||
msgstr "Nur vom festgelegten Unterbaum Dateien per TFTP exportieren."
|
msgstr "Nur vom festgelegten Unterbaum Dateien per TFTP exportieren."
|
||||||
|
|
||||||
#: option.c:435
|
#: option.c:435
|
||||||
#, fuzzy
|
|
||||||
msgid "Add client IP or hardware address to tftp-root."
|
msgid "Add client IP or hardware address to tftp-root."
|
||||||
msgstr "IP-Adresse des Klienten an tftp-root anhängen."
|
msgstr "IP-Adresse oder Hardware-Adresse des Klienten an tftp-root anhängen."
|
||||||
|
|
||||||
#: option.c:436
|
#: option.c:436
|
||||||
msgid "Allow access only to files owned by the user running dnsmasq."
|
msgid "Allow access only to files owned by the user running dnsmasq."
|
||||||
@@ -517,9 +516,9 @@ msgid "Do not terminate the service if TFTP directories are inaccessible."
|
|||||||
msgstr "Der Dienst sollte nicht beendet werden, wenn die TFTP-Verzeichnisse nicht zugreifbar sind."
|
msgstr "Der Dienst sollte nicht beendet werden, wenn die TFTP-Verzeichnisse nicht zugreifbar sind."
|
||||||
|
|
||||||
#: option.c:438
|
#: option.c:438
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "Maximum number of concurrent TFTP transfers (defaults to %s)."
|
msgid "Maximum number of concurrent TFTP transfers (defaults to %s)."
|
||||||
msgstr "Höchstzahl nebenläufiger TFTP-Übertragungen (%s voreingestellt)."
|
msgstr "Maximale Anzahl gleichzeitiger TFTP-Übertragungen (%s voreingestellt)."
|
||||||
|
|
||||||
#: option.c:439
|
#: option.c:439
|
||||||
msgid "Maximum MTU to use for TFTP transfers."
|
msgid "Maximum MTU to use for TFTP transfers."
|
||||||
@@ -675,7 +674,6 @@ msgid "Set TTL for authoritative replies"
|
|||||||
msgstr "Setzte TTL für autoritative Antworten"
|
msgstr "Setzte TTL für autoritative Antworten"
|
||||||
|
|
||||||
#: option.c:477
|
#: option.c:477
|
||||||
#, fuzzy
|
|
||||||
msgid "Set authoritative zone information"
|
msgid "Set authoritative zone information"
|
||||||
msgstr "Setze autoritative Zoneninformationen"
|
msgstr "Setze autoritative Zoneninformationen"
|
||||||
|
|
||||||
@@ -724,9 +722,8 @@ msgid "Specify DHCPv6 prefix class"
|
|||||||
msgstr "Spezifiziere DHCPv6 Prefix Klasse"
|
msgstr "Spezifiziere DHCPv6 Prefix Klasse"
|
||||||
|
|
||||||
#: option.c:491
|
#: option.c:491
|
||||||
#, fuzzy
|
|
||||||
msgid "Set MTU, priority, resend-interval and router-lifetime"
|
msgid "Set MTU, priority, resend-interval and router-lifetime"
|
||||||
msgstr "Setze Priorität, Intervall des erneuten Sendens und Router Lebenszeit"
|
msgstr "Setze MTU, Priorität, Sendewiederholungsintervall und Router-Lebensdauer"
|
||||||
|
|
||||||
#: option.c:492
|
#: option.c:492
|
||||||
msgid "Do not log routine DHCP."
|
msgid "Do not log routine DHCP."
|
||||||
@@ -758,7 +755,7 @@ msgstr "Setzte TTL in DNS-Antworten mit DHCP-abgeleiteten Adressen."
|
|||||||
|
|
||||||
#: option.c:499
|
#: option.c:499
|
||||||
msgid "Delay DHCP replies for at least number of seconds."
|
msgid "Delay DHCP replies for at least number of seconds."
|
||||||
msgstr ""
|
msgstr "Verzögere DHCP-Antworten für mindestens Anzahl von Sekunden."
|
||||||
|
|
||||||
#: option.c:703
|
#: option.c:703
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -781,7 +778,7 @@ msgstr "Gültige Optionen sind:\n"
|
|||||||
|
|
||||||
#: option.c:754 option.c:868
|
#: option.c:754 option.c:868
|
||||||
msgid "bad address"
|
msgid "bad address"
|
||||||
msgstr "Fehlerhafte Adresse."
|
msgstr "Fehlerhafte Adresse"
|
||||||
|
|
||||||
#: option.c:779 option.c:783
|
#: option.c:779 option.c:783
|
||||||
msgid "bad port"
|
msgid "bad port"
|
||||||
@@ -793,7 +790,7 @@ msgstr "Schnittstellenbindung nicht unterstützt"
|
|||||||
|
|
||||||
#: option.c:821 option.c:856
|
#: option.c:821 option.c:856
|
||||||
msgid "interface can only be specified once"
|
msgid "interface can only be specified once"
|
||||||
msgstr ""
|
msgstr "Schnittstelle kann nur einmal angegeben werden"
|
||||||
|
|
||||||
#: option.c:835 option.c:3809
|
#: option.c:835 option.c:3809
|
||||||
msgid "bad interface name"
|
msgid "bad interface name"
|
||||||
@@ -960,7 +957,7 @@ msgstr "Fehlerhafte DHCP-Proxy-Adresse"
|
|||||||
|
|
||||||
#: option.c:3704
|
#: option.c:3704
|
||||||
msgid "Bad dhcp-relay"
|
msgid "Bad dhcp-relay"
|
||||||
msgstr "unzulässiger dhcp-relay"
|
msgstr "Uunzulässiger dhcp-relay"
|
||||||
|
|
||||||
#: option.c:3745
|
#: option.c:3745
|
||||||
msgid "bad RA-params"
|
msgid "bad RA-params"
|
||||||
@@ -1016,7 +1013,7 @@ msgstr "unzulässige Wichtung"
|
|||||||
|
|
||||||
#: option.c:4073
|
#: option.c:4073
|
||||||
msgid "Bad host-record"
|
msgid "Bad host-record"
|
||||||
msgstr "unzulässiger host-record"
|
msgstr "Unzulässiger host-record"
|
||||||
|
|
||||||
#: option.c:4097
|
#: option.c:4097
|
||||||
msgid "Bad name in host-record"
|
msgid "Bad name in host-record"
|
||||||
@@ -1123,7 +1120,7 @@ msgstr "unzulässige Optionen auf der Befehlszeile: %s"
|
|||||||
#: option.c:4818
|
#: option.c:4818
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "CNAME loop involving %s"
|
msgid "CNAME loop involving %s"
|
||||||
msgstr ""
|
msgstr "CNAME-Schleife mit %s"
|
||||||
|
|
||||||
#: option.c:4854
|
#: option.c:4854
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1178,7 +1175,7 @@ msgstr "möglichen DNS-Rebind-Angriff entdeckt: %s"
|
|||||||
#: forward.c:870
|
#: forward.c:870
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "reducing DNS packet size for nameserver %s to %d"
|
msgid "reducing DNS packet size for nameserver %s to %d"
|
||||||
msgstr ""
|
msgstr "Reduziere der DNS-Paketgröße für Nameserver %s auf %d"
|
||||||
|
|
||||||
#: forward.c:1266 forward.c:1704
|
#: forward.c:1266 forward.c:1704
|
||||||
msgid "Ignoring query from non-local network"
|
msgid "Ignoring query from non-local network"
|
||||||
@@ -1204,9 +1201,9 @@ msgid "LOUD WARNING: use --bind-dynamic rather than --bind-interfaces to avoid D
|
|||||||
msgstr "LOUD WARNING: Es sollte --bind-dynamic anstatt --bind-interfaces benutzt werden, um DNS-Verstärkungsangriffe auf diesen Schnittstellen zu unterbinden"
|
msgstr "LOUD WARNING: Es sollte --bind-dynamic anstatt --bind-interfaces benutzt werden, um DNS-Verstärkungsangriffe auf diesen Schnittstellen zu unterbinden"
|
||||||
|
|
||||||
#: network.c:1047
|
#: network.c:1047
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "warning: using interface %s instead"
|
msgid "warning: using interface %s instead"
|
||||||
msgstr "Warnung: %s nicht zugreifbar"
|
msgstr "Warnung: Benutzer stattdessen Schnittstelle %s"
|
||||||
|
|
||||||
#: network.c:1056
|
#: network.c:1056
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1289,9 +1286,9 @@ msgid "using nameserver %s#%d"
|
|||||||
msgstr "Benutze Namensserver %s#%d"
|
msgstr "Benutze Namensserver %s#%d"
|
||||||
|
|
||||||
#: network.c:1591
|
#: network.c:1591
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "using %d more local addresses"
|
msgid "using %d more local addresses"
|
||||||
msgstr "Benutze %d mehr Namensserver"
|
msgstr "Benutze %d mehr lokale Adressen"
|
||||||
|
|
||||||
#: network.c:1593
|
#: network.c:1593
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1425,9 +1422,8 @@ msgid "DNSSEC validation enabled"
|
|||||||
msgstr "DNSSEC-Validierung aktiviert"
|
msgstr "DNSSEC-Validierung aktiviert"
|
||||||
|
|
||||||
#: dnsmasq.c:775
|
#: dnsmasq.c:775
|
||||||
#, fuzzy
|
|
||||||
msgid "DNSSEC signature timestamps not checked until receipt of SIGINT"
|
msgid "DNSSEC signature timestamps not checked until receipt of SIGINT"
|
||||||
msgstr "DNSSEC Signatur-Zeitstempel werden erst ab dem ersten Neuladen des Caches überprüft"
|
msgstr "DNSSEC-Signatur-Zeitstempel werden erst nach Empfang von SIGINT überprüft"
|
||||||
|
|
||||||
#: dnsmasq.c:778
|
#: dnsmasq.c:778
|
||||||
msgid "DNSSEC signature timestamps not checked until system time valid"
|
msgid "DNSSEC signature timestamps not checked until system time valid"
|
||||||
@@ -1549,7 +1545,7 @@ msgstr "Das TFTP-Verzeichnis %s ist nicht zugreifbar: %s"
|
|||||||
#: dnsmasq.c:1242
|
#: dnsmasq.c:1242
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "cannot create timestamp file %s: %s"
|
msgid "cannot create timestamp file %s: %s"
|
||||||
msgstr "Kann keine timestamp-Datei %s erzeugen: %s "
|
msgstr "Kann keine Zeitstempel-Datei %s erzeugen: %s"
|
||||||
|
|
||||||
#: dnsmasq.c:1326
|
#: dnsmasq.c:1326
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1671,12 +1667,12 @@ msgstr "kann Lease-Datei %s nicht öffnen: %s"
|
|||||||
#: lease.c:175
|
#: lease.c:175
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "failed to parse lease database, invalid line: %s %s %s %s ..."
|
msgid "failed to parse lease database, invalid line: %s %s %s %s ..."
|
||||||
msgstr ""
|
msgstr "Fehler beim Parsen der Lease-Datenbank, ungültige Zeile: %s %s %s %s ..."
|
||||||
|
|
||||||
#: lease.c:180
|
#: lease.c:180
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to read lease file %s: %s"
|
msgid "failed to read lease file %s: %s"
|
||||||
msgstr "konnte %s nicht lesen: %s"
|
msgstr "konnte Lease-Datei %s nicht lesen: %s"
|
||||||
|
|
||||||
#: lease.c:196
|
#: lease.c:196
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1874,7 +1870,7 @@ msgstr "Kann RFC3925-Option nicht senden: zu viele Optionen für Unternehmen Nr.
|
|||||||
#: rfc2131.c:2650
|
#: rfc2131.c:2650
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%u reply delay: %d"
|
msgid "%u reply delay: %d"
|
||||||
msgstr ""
|
msgstr "%u Antwortverzögerung: %d"
|
||||||
|
|
||||||
#: netlink.c:77
|
#: netlink.c:77
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -2111,7 +2107,7 @@ msgstr ", Prefix veraltet"
|
|||||||
#: dhcp-common.c:823
|
#: dhcp-common.c:823
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid ", lease time "
|
msgid ", lease time "
|
||||||
msgstr ", Lease Zeit"
|
msgstr ", Lease Zeit "
|
||||||
|
|
||||||
#: dhcp-common.c:865
|
#: dhcp-common.c:865
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -2174,14 +2170,13 @@ msgid "failed to create IPset control socket: %s"
|
|||||||
msgstr "konnte IPset-Kontroll-Socket nicht erzeugen: %s"
|
msgstr "konnte IPset-Kontroll-Socket nicht erzeugen: %s"
|
||||||
|
|
||||||
#: ipset.c:233
|
#: ipset.c:233
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to update ipset %s: %s"
|
msgid "failed to update ipset %s: %s"
|
||||||
msgstr "kann die mtime nicht auf %s aktualisieren: %s"
|
msgstr "Aktualisierung von ipset %s fehlgeschlagen: %s"
|
||||||
|
|
||||||
#: dnssec.c:208
|
#: dnssec.c:208
|
||||||
#, fuzzy
|
|
||||||
msgid "system time considered valid, now checking DNSSEC signature timestamps."
|
msgid "system time considered valid, now checking DNSSEC signature timestamps."
|
||||||
msgstr "Prüfe jetzt DNSSEC Signatur-Zeitstempel"
|
msgstr "Prüfe jetzt DNSSEC Signatur-Zeitstempel."
|
||||||
|
|
||||||
#: blockdata.c:58
|
#: blockdata.c:58
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -2209,9 +2204,9 @@ msgid "error: cannot strlcpy table name %s"
|
|||||||
msgstr "Fehler: Kann den Tabellennamen %s nicht strlcpy"
|
msgstr "Fehler: Kann den Tabellennamen %s nicht strlcpy"
|
||||||
|
|
||||||
#: tables.c:101
|
#: tables.c:101
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "IPset: error:%s"
|
msgid "IPset: error:%s"
|
||||||
msgstr "DBus-Fehler: %s"
|
msgstr "IPset: Fehler: %s"
|
||||||
|
|
||||||
#: tables.c:108
|
#: tables.c:108
|
||||||
msgid "info: table created"
|
msgid "info: table created"
|
||||||
|
|||||||
+19
-16
@@ -103,7 +103,7 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
{
|
{
|
||||||
char *name = daemon->namebuff;
|
char *name = daemon->namebuff;
|
||||||
unsigned char *p, *ansp;
|
unsigned char *p, *ansp;
|
||||||
int qtype, qclass;
|
int qtype, qclass, rc;
|
||||||
int nameoffset, axfroffset = 0;
|
int nameoffset, axfroffset = 0;
|
||||||
int q, anscount = 0, authcount = 0;
|
int q, anscount = 0, authcount = 0;
|
||||||
struct crec *crecp;
|
struct crec *crecp;
|
||||||
@@ -283,11 +283,11 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (rec = daemon->mxnames; rec; rec = rec->next)
|
for (rec = daemon->mxnames; rec; rec = rec->next)
|
||||||
if (!rec->issrv && hostname_isequal(name, rec->name))
|
if (!rec->issrv && (rc = hostname_issubdomain(name, rec->name)))
|
||||||
{
|
{
|
||||||
nxdomain = 0;
|
nxdomain = 0;
|
||||||
|
|
||||||
if (qtype == T_MX)
|
if (rc == 2 && qtype == T_MX)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
log_query(F_CONFIG | F_RRNAME, name, NULL, "<MX>");
|
log_query(F_CONFIG | F_RRNAME, name, NULL, "<MX>");
|
||||||
@@ -298,11 +298,11 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (move = NULL, up = &daemon->mxnames, rec = daemon->mxnames; rec; rec = rec->next)
|
for (move = NULL, up = &daemon->mxnames, rec = daemon->mxnames; rec; rec = rec->next)
|
||||||
if (rec->issrv && hostname_isequal(name, rec->name))
|
if (rec->issrv && (rc = hostname_issubdomain(name, rec->name)))
|
||||||
{
|
{
|
||||||
nxdomain = 0;
|
nxdomain = 0;
|
||||||
|
|
||||||
if (qtype == T_SRV)
|
if (rc == 2 && qtype == T_SRV)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
log_query(F_CONFIG | F_RRNAME, name, NULL, "<SRV>");
|
log_query(F_CONFIG | F_RRNAME, name, NULL, "<SRV>");
|
||||||
@@ -333,13 +333,13 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (txt = daemon->rr; txt; txt = txt->next)
|
for (txt = daemon->rr; txt; txt = txt->next)
|
||||||
if (hostname_isequal(name, txt->name))
|
if ((rc = hostname_issubdomain(name, txt->name)))
|
||||||
{
|
{
|
||||||
nxdomain = 0;
|
nxdomain = 0;
|
||||||
if (txt->class == qtype)
|
if (rc == 2 && txt->class == qtype)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
log_query(F_CONFIG | F_RRNAME, name, NULL, "<RR>");
|
log_query(F_CONFIG | F_RRNAME, name, NULL, querystr(NULL, txt->class));
|
||||||
if (add_resource_record(header, limit, &trunc, nameoffset, &ansp, daemon->auth_ttl,
|
if (add_resource_record(header, limit, &trunc, nameoffset, &ansp, daemon->auth_ttl,
|
||||||
NULL, txt->class, C_IN, "t", txt->len, txt->txt))
|
NULL, txt->class, C_IN, "t", txt->len, txt->txt))
|
||||||
anscount++;
|
anscount++;
|
||||||
@@ -347,10 +347,10 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (txt = daemon->txt; txt; txt = txt->next)
|
for (txt = daemon->txt; txt; txt = txt->next)
|
||||||
if (txt->class == C_IN && hostname_isequal(name, txt->name))
|
if (txt->class == C_IN && (rc = hostname_issubdomain(name, txt->name)))
|
||||||
{
|
{
|
||||||
nxdomain = 0;
|
nxdomain = 0;
|
||||||
if (qtype == T_TXT)
|
if (rc == 2 && qtype == T_TXT)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
|
log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
|
||||||
@@ -361,10 +361,10 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (na = daemon->naptr; na; na = na->next)
|
for (na = daemon->naptr; na; na = na->next)
|
||||||
if (hostname_isequal(name, na->name))
|
if ((rc = hostname_issubdomain(name, na->name)))
|
||||||
{
|
{
|
||||||
nxdomain = 0;
|
nxdomain = 0;
|
||||||
if (qtype == T_NAPTR)
|
if (rc == 2 && qtype == T_NAPTR)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
log_query(F_CONFIG | F_RRNAME, name, NULL, "<NAPTR>");
|
log_query(F_CONFIG | F_RRNAME, name, NULL, "<NAPTR>");
|
||||||
@@ -384,13 +384,13 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (intr = daemon->int_names; intr; intr = intr->next)
|
for (intr = daemon->int_names; intr; intr = intr->next)
|
||||||
if (hostname_isequal(name, intr->name))
|
if ((rc = hostname_issubdomain(name, intr->name)))
|
||||||
{
|
{
|
||||||
struct addrlist *addrlist;
|
struct addrlist *addrlist;
|
||||||
|
|
||||||
nxdomain = 0;
|
nxdomain = 0;
|
||||||
|
|
||||||
if (flag)
|
if (rc == 2 && flag)
|
||||||
for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
|
for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
|
||||||
if (((addrlist->flags & ADDRLIST_IPV6) ? T_AAAA : T_A) == qtype &&
|
if (((addrlist->flags & ADDRLIST_IPV6) ? T_AAAA : T_A) == qtype &&
|
||||||
(local_query || filter_zone(zone, flag, &addrlist->addr)))
|
(local_query || filter_zone(zone, flag, &addrlist->addr)))
|
||||||
@@ -436,8 +436,9 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
if (sockaddr_isequal(peer_addr, &peers->addr))
|
if (sockaddr_isequal(peer_addr, &peers->addr))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Refuse all AXFR unless --auth-sec-servers is set */
|
/* Refuse all AXFR unless --auth-sec-servers or auth-peers is set */
|
||||||
if ((!peers && daemon->auth_peers) || !daemon->secondary_forward_server)
|
if ((!daemon->secondary_forward_server && !daemon->auth_peers) ||
|
||||||
|
(daemon->auth_peers && !peers))
|
||||||
{
|
{
|
||||||
if (peer_addr->sa.sa_family == AF_INET)
|
if (peer_addr->sa.sa_family == AF_INET)
|
||||||
inet_ntop(AF_INET, &peer_addr->in.sin_addr, daemon->addrbuff, ADDRSTRLEN);
|
inet_ntop(AF_INET, &peer_addr->in.sin_addr, daemon->addrbuff, ADDRSTRLEN);
|
||||||
@@ -566,6 +567,8 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
|
|
||||||
goto cname_restart;
|
goto cname_restart;
|
||||||
}
|
}
|
||||||
|
else if (cache_find_non_terminal(name, now))
|
||||||
|
nxdomain = 0;
|
||||||
|
|
||||||
log_query(flag | F_NEG | (nxdomain ? F_NXDOMAIN : 0) | F_FORWARD | F_AUTH, name, NULL, NULL);
|
log_query(flag | F_NEG | (nxdomain ? F_NXDOMAIN : 0) | F_FORWARD | F_AUTH, name, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ int iface_enumerate(int family, void *parm, int (*callback)())
|
|||||||
struct in6_ifreq ifr6;
|
struct in6_ifreq ifr6;
|
||||||
|
|
||||||
memset(&ifr6, 0, sizeof(ifr6));
|
memset(&ifr6, 0, sizeof(ifr6));
|
||||||
strncpy(ifr6.ifr_name, addrs->ifa_name, sizeof(ifr6.ifr_name));
|
safe_strncpy(ifr6.ifr_name, addrs->ifa_name, sizeof(ifr6.ifr_name));
|
||||||
|
|
||||||
ifr6.ifr_addr = *((struct sockaddr_in6 *) addrs->ifa_addr);
|
ifr6.ifr_addr = *((struct sockaddr_in6 *) addrs->ifa_addr);
|
||||||
if (fd != -1 && ioctl(fd, SIOCGIFAFLAG_IN6, &ifr6) != -1)
|
if (fd != -1 && ioctl(fd, SIOCGIFAFLAG_IN6, &ifr6) != -1)
|
||||||
|
|||||||
+305
-132
@@ -21,10 +21,12 @@ static struct crec *cache_head = NULL, *cache_tail = NULL, **hash_table = NULL;
|
|||||||
static struct crec *dhcp_spare = NULL;
|
static struct crec *dhcp_spare = NULL;
|
||||||
#endif
|
#endif
|
||||||
static struct crec *new_chain = NULL;
|
static struct crec *new_chain = NULL;
|
||||||
static int cache_inserted = 0, cache_live_freed = 0, insert_error;
|
static int insert_error;
|
||||||
static union bigname *big_free = NULL;
|
static union bigname *big_free = NULL;
|
||||||
static int bignames_left, hash_size;
|
static int bignames_left, hash_size;
|
||||||
|
|
||||||
|
static void make_non_terminals(struct crec *source);
|
||||||
|
|
||||||
/* type->string mapping: this is also used by the name-hash function as a mixing table. */
|
/* type->string mapping: this is also used by the name-hash function as a mixing table. */
|
||||||
static const struct {
|
static const struct {
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
@@ -68,7 +70,8 @@ static const struct {
|
|||||||
{ 252, "AXFR" },
|
{ 252, "AXFR" },
|
||||||
{ 253, "MAILB" },
|
{ 253, "MAILB" },
|
||||||
{ 254, "MAILA" },
|
{ 254, "MAILA" },
|
||||||
{ 255, "ANY" }
|
{ 255, "ANY" },
|
||||||
|
{ 257, "CAA" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void cache_free(struct crec *crecp);
|
static void cache_free(struct crec *crecp);
|
||||||
@@ -77,17 +80,20 @@ static void cache_link(struct crec *crecp);
|
|||||||
static void rehash(int size);
|
static void rehash(int size);
|
||||||
static void cache_hash(struct crec *crecp);
|
static void cache_hash(struct crec *crecp);
|
||||||
|
|
||||||
static unsigned int next_uid(void)
|
void next_uid(struct crec *crecp)
|
||||||
{
|
{
|
||||||
static unsigned int uid = 0;
|
static unsigned int uid = 0;
|
||||||
|
|
||||||
uid++;
|
if (crecp->uid == UID_NONE)
|
||||||
|
{
|
||||||
|
uid++;
|
||||||
|
|
||||||
/* uid == 0 used to indicate CNAME to interface name. */
|
/* uid == 0 used to indicate CNAME to interface name. */
|
||||||
if (uid == SRC_INTERFACE)
|
if (uid == UID_NONE)
|
||||||
uid++;
|
uid++;
|
||||||
|
|
||||||
return uid;
|
crecp->uid = uid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cache_init(void)
|
void cache_init(void)
|
||||||
@@ -105,7 +111,7 @@ void cache_init(void)
|
|||||||
{
|
{
|
||||||
cache_link(crecp);
|
cache_link(crecp);
|
||||||
crecp->flags = 0;
|
crecp->flags = 0;
|
||||||
crecp->uid = next_uid();
|
crecp->uid = UID_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +210,7 @@ static void cache_free(struct crec *crecp)
|
|||||||
{
|
{
|
||||||
crecp->flags &= ~F_FORWARD;
|
crecp->flags &= ~F_FORWARD;
|
||||||
crecp->flags &= ~F_REVERSE;
|
crecp->flags &= ~F_REVERSE;
|
||||||
crecp->uid = next_uid(); /* invalidate CNAMES pointing to this. */
|
crecp->uid = UID_NONE; /* invalidate CNAMES pointing to this. */
|
||||||
|
|
||||||
if (cache_tail)
|
if (cache_tail)
|
||||||
cache_tail->next = crecp;
|
cache_tail->next = crecp;
|
||||||
@@ -322,7 +328,8 @@ static int is_expired(time_t now, struct crec *crecp)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct crec *cache_scan_free(char *name, struct all_addr *addr, time_t now, unsigned short flags)
|
static struct crec *cache_scan_free(char *name, struct all_addr *addr, time_t now, unsigned short flags,
|
||||||
|
struct crec **target_crec, unsigned int *target_uid)
|
||||||
{
|
{
|
||||||
/* Scan and remove old entries.
|
/* Scan and remove old entries.
|
||||||
If (flags & F_FORWARD) then remove any forward entries for name and any expired
|
If (flags & F_FORWARD) then remove any forward entries for name and any expired
|
||||||
@@ -335,7 +342,10 @@ static struct crec *cache_scan_free(char *name, struct all_addr *addr, time_t no
|
|||||||
to a cache entry if the name exists in the cache as a HOSTS or DHCP entry (these are never deleted)
|
to a cache entry if the name exists in the cache as a HOSTS or DHCP entry (these are never deleted)
|
||||||
|
|
||||||
We take advantage of the fact that hash chains have stuff in the order <reverse>,<other>,<immortal>
|
We take advantage of the fact that hash chains have stuff in the order <reverse>,<other>,<immortal>
|
||||||
so that when we hit an entry which isn't reverse and is immortal, we're done. */
|
so that when we hit an entry which isn't reverse and is immortal, we're done.
|
||||||
|
|
||||||
|
If we free a crec which is a CNAME target, return the entry and uid in target_crec and target_uid.
|
||||||
|
This entry will get re-used with the same name, to preserve CNAMEs. */
|
||||||
|
|
||||||
struct crec *crecp, **up;
|
struct crec *crecp, **up;
|
||||||
|
|
||||||
@@ -343,17 +353,6 @@ static struct crec *cache_scan_free(char *name, struct all_addr *addr, time_t no
|
|||||||
{
|
{
|
||||||
for (up = hash_bucket(name), crecp = *up; crecp; crecp = crecp->hash_next)
|
for (up = hash_bucket(name), crecp = *up; crecp; crecp = crecp->hash_next)
|
||||||
{
|
{
|
||||||
if (is_expired(now, crecp) || is_outdated_cname_pointer(crecp))
|
|
||||||
{
|
|
||||||
*up = crecp->hash_next;
|
|
||||||
if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)))
|
|
||||||
{
|
|
||||||
cache_unlink(crecp);
|
|
||||||
cache_free(crecp);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((crecp->flags & F_FORWARD) && hostname_isequal(cache_get_name(crecp), name))
|
if ((crecp->flags & F_FORWARD) && hostname_isequal(cache_get_name(crecp), name))
|
||||||
{
|
{
|
||||||
/* Don't delete DNSSEC in favour of a CNAME, they can co-exist */
|
/* Don't delete DNSSEC in favour of a CNAME, they can co-exist */
|
||||||
@@ -363,6 +362,16 @@ static struct crec *cache_scan_free(char *name, struct all_addr *addr, time_t no
|
|||||||
if (crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG))
|
if (crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG))
|
||||||
return crecp;
|
return crecp;
|
||||||
*up = crecp->hash_next;
|
*up = crecp->hash_next;
|
||||||
|
/* If this record is for the name we're inserting and is the target
|
||||||
|
of a CNAME record. Make the new record for the same name, in the same
|
||||||
|
crec, with the same uid to avoid breaking the existing CNAME. */
|
||||||
|
if (crecp->uid != UID_NONE)
|
||||||
|
{
|
||||||
|
if (target_crec)
|
||||||
|
*target_crec = crecp;
|
||||||
|
if (target_uid)
|
||||||
|
*target_uid = crecp->uid;
|
||||||
|
}
|
||||||
cache_unlink(crecp);
|
cache_unlink(crecp);
|
||||||
cache_free(crecp);
|
cache_free(crecp);
|
||||||
continue;
|
continue;
|
||||||
@@ -381,6 +390,18 @@ static struct crec *cache_scan_free(char *name, struct all_addr *addr, time_t no
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_expired(now, crecp) || is_outdated_cname_pointer(crecp))
|
||||||
|
{
|
||||||
|
*up = crecp->hash_next;
|
||||||
|
if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)))
|
||||||
|
{
|
||||||
|
cache_unlink(crecp);
|
||||||
|
cache_free(crecp);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
up = &crecp->hash_next;
|
up = &crecp->hash_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,11 +468,12 @@ void cache_start_insert(void)
|
|||||||
struct crec *cache_insert(char *name, struct all_addr *addr,
|
struct crec *cache_insert(char *name, struct all_addr *addr,
|
||||||
time_t now, unsigned long ttl, unsigned short flags)
|
time_t now, unsigned long ttl, unsigned short flags)
|
||||||
{
|
{
|
||||||
struct crec *new;
|
struct crec *new, *target_crec = NULL;
|
||||||
union bigname *big_name = NULL;
|
union bigname *big_name = NULL;
|
||||||
int freed_all = flags & F_REVERSE;
|
int freed_all = flags & F_REVERSE;
|
||||||
int free_avail = 0;
|
int free_avail = 0;
|
||||||
|
unsigned int target_uid;
|
||||||
|
|
||||||
/* Don't log DNSSEC records here, done elsewhere */
|
/* Don't log DNSSEC records here, done elsewhere */
|
||||||
if (flags & (F_IPV4 | F_IPV6 | F_CNAME))
|
if (flags & (F_IPV4 | F_IPV6 | F_CNAME))
|
||||||
{
|
{
|
||||||
@@ -469,7 +491,7 @@ struct crec *cache_insert(char *name, struct all_addr *addr,
|
|||||||
|
|
||||||
/* First remove any expired entries and entries for the name/address we
|
/* First remove any expired entries and entries for the name/address we
|
||||||
are currently inserting. */
|
are currently inserting. */
|
||||||
if ((new = cache_scan_free(name, addr, now, flags)))
|
if ((new = cache_scan_free(name, addr, now, flags, &target_crec, &target_uid)))
|
||||||
{
|
{
|
||||||
/* We're trying to insert a record over one from
|
/* We're trying to insert a record over one from
|
||||||
/etc/hosts or DHCP, or other config. If the
|
/etc/hosts or DHCP, or other config. If the
|
||||||
@@ -493,81 +515,89 @@ struct crec *cache_insert(char *name, struct all_addr *addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now get a cache entry from the end of the LRU list */
|
/* Now get a cache entry from the end of the LRU list */
|
||||||
while (1) {
|
if (!target_crec)
|
||||||
if (!(new = cache_tail)) /* no entries left - cache is too small, bail */
|
while (1) {
|
||||||
{
|
if (!(new = cache_tail)) /* no entries left - cache is too small, bail */
|
||||||
insert_error = 1;
|
{
|
||||||
return NULL;
|
insert_error = 1;
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
/* End of LRU list is still in use: if we didn't scan all the hash
|
|
||||||
chains for expired entries do that now. If we already tried that
|
/* Free entry at end of LRU list, use it. */
|
||||||
then it's time to start spilling things. */
|
if (!(new->flags & (F_FORWARD | F_REVERSE)))
|
||||||
|
break;
|
||||||
if (new->flags & (F_FORWARD | F_REVERSE))
|
|
||||||
{
|
|
||||||
/* If free_avail set, we believe that an entry has been freed.
|
|
||||||
Bugs have been known to make this not true, resulting in
|
|
||||||
a tight loop here. If that happens, abandon the
|
|
||||||
insert. Once in this state, all inserts will probably fail. */
|
|
||||||
if (free_avail)
|
|
||||||
{
|
|
||||||
static int warned = 0;
|
|
||||||
if (!warned)
|
|
||||||
{
|
|
||||||
my_syslog(LOG_ERR, _("Internal error in cache."));
|
|
||||||
warned = 1;
|
|
||||||
}
|
|
||||||
insert_error = 1;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (freed_all)
|
|
||||||
{
|
|
||||||
struct all_addr free_addr = new->addr.addr;;
|
|
||||||
|
|
||||||
|
/* End of LRU list is still in use: if we didn't scan all the hash
|
||||||
|
chains for expired entries do that now. If we already tried that
|
||||||
|
then it's time to start spilling things. */
|
||||||
|
|
||||||
|
/* If free_avail set, we believe that an entry has been freed.
|
||||||
|
Bugs have been known to make this not true, resulting in
|
||||||
|
a tight loop here. If that happens, abandon the
|
||||||
|
insert. Once in this state, all inserts will probably fail. */
|
||||||
|
if (free_avail)
|
||||||
|
{
|
||||||
|
static int warned = 0;
|
||||||
|
if (!warned)
|
||||||
|
{
|
||||||
|
my_syslog(LOG_ERR, _("Internal error in cache."));
|
||||||
|
warned = 1;
|
||||||
|
}
|
||||||
|
insert_error = 1;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (freed_all)
|
||||||
|
{
|
||||||
|
struct all_addr free_addr = new->addr.addr;;
|
||||||
|
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
/* For DNSSEC records, addr holds class. */
|
/* For DNSSEC records, addr holds class. */
|
||||||
if (new->flags & (F_DS | F_DNSKEY))
|
if (new->flags & (F_DS | F_DNSKEY))
|
||||||
free_addr.addr.dnssec.class = new->uid;
|
free_addr.addr.dnssec.class = new->uid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free_avail = 1; /* Must be free space now. */
|
free_avail = 1; /* Must be free space now. */
|
||||||
cache_scan_free(cache_get_name(new), &free_addr, now, new->flags);
|
cache_scan_free(cache_get_name(new), &free_addr, now, new->flags, NULL, NULL);
|
||||||
cache_live_freed++;
|
daemon->metrics[METRIC_DNS_CACHE_LIVE_FREED]++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cache_scan_free(NULL, NULL, now, 0);
|
cache_scan_free(NULL, NULL, now, 0, NULL, NULL);
|
||||||
freed_all = 1;
|
freed_all = 1;
|
||||||
}
|
}
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
/* Check if we need to and can allocate extra memory for a long name.
|
||||||
/* Check if we need to and can allocate extra memory for a long name.
|
If that fails, give up now, always succeed for DNSSEC records. */
|
||||||
If that fails, give up now, always succeed for DNSSEC records. */
|
if (name && (strlen(name) > SMALLDNAME-1))
|
||||||
if (name && (strlen(name) > SMALLDNAME-1))
|
{
|
||||||
{
|
if (big_free)
|
||||||
if (big_free)
|
{
|
||||||
{
|
big_name = big_free;
|
||||||
big_name = big_free;
|
big_free = big_free->next;
|
||||||
big_free = big_free->next;
|
}
|
||||||
}
|
else if ((bignames_left == 0 && !(flags & (F_DS | F_DNSKEY))) ||
|
||||||
else if ((bignames_left == 0 && !(flags & (F_DS | F_DNSKEY))) ||
|
!(big_name = (union bigname *)whine_malloc(sizeof(union bigname))))
|
||||||
!(big_name = (union bigname *)whine_malloc(sizeof(union bigname))))
|
{
|
||||||
{
|
insert_error = 1;
|
||||||
insert_error = 1;
|
return NULL;
|
||||||
return NULL;
|
}
|
||||||
}
|
else if (bignames_left != 0)
|
||||||
else if (bignames_left != 0)
|
bignames_left--;
|
||||||
bignames_left--;
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Got the rest: finally grab entry. */
|
/* If we freed a cache entry for our name which was a CNAME target, use that.
|
||||||
cache_unlink(new);
|
and preserve the uid, so that existing CNAMES are not broken. */
|
||||||
break;
|
if (target_crec)
|
||||||
}
|
{
|
||||||
|
new = target_crec;
|
||||||
|
new->uid = target_uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Got the rest: finally grab entry. */
|
||||||
|
cache_unlink(new);
|
||||||
|
|
||||||
new->flags = flags;
|
new->flags = flags;
|
||||||
if (big_name)
|
if (big_name)
|
||||||
@@ -614,13 +644,27 @@ void cache_end_insert(void)
|
|||||||
{
|
{
|
||||||
cache_hash(new_chain);
|
cache_hash(new_chain);
|
||||||
cache_link(new_chain);
|
cache_link(new_chain);
|
||||||
cache_inserted++;
|
daemon->metrics[METRIC_DNS_CACHE_INSERTED]++;
|
||||||
}
|
}
|
||||||
new_chain = tmp;
|
new_chain = tmp;
|
||||||
}
|
}
|
||||||
new_chain = NULL;
|
new_chain = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cache_find_non_terminal(char *name, time_t now)
|
||||||
|
{
|
||||||
|
struct crec *crecp;
|
||||||
|
|
||||||
|
for (crecp = *hash_bucket(name); crecp; crecp = crecp->hash_next)
|
||||||
|
if (!is_outdated_cname_pointer(crecp) &&
|
||||||
|
!is_expired(now, crecp) &&
|
||||||
|
(crecp->flags & F_FORWARD) &&
|
||||||
|
hostname_isequal(name, cache_get_name(crecp)))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsigned int prot)
|
struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsigned int prot)
|
||||||
{
|
{
|
||||||
struct crec *ans;
|
struct crec *ans;
|
||||||
@@ -781,15 +825,18 @@ static void add_hosts_cname(struct crec *target)
|
|||||||
for (a = daemon->cnames; a; a = a->next)
|
for (a = daemon->cnames; a; a = a->next)
|
||||||
if (a->alias[1] != '*' &&
|
if (a->alias[1] != '*' &&
|
||||||
hostname_isequal(cache_get_name(target), a->target) &&
|
hostname_isequal(cache_get_name(target), a->target) &&
|
||||||
(crec = whine_malloc(sizeof(struct crec))))
|
(crec = whine_malloc(SIZEOF_POINTER_CREC)))
|
||||||
{
|
{
|
||||||
crec->flags = F_FORWARD | F_IMMORTAL | F_NAMEP | F_CONFIG | F_CNAME;
|
crec->flags = F_FORWARD | F_IMMORTAL | F_NAMEP | F_CONFIG | F_CNAME;
|
||||||
crec->ttd = a->ttl;
|
crec->ttd = a->ttl;
|
||||||
crec->name.namep = a->alias;
|
crec->name.namep = a->alias;
|
||||||
crec->addr.cname.target.cache = target;
|
crec->addr.cname.target.cache = target;
|
||||||
|
next_uid(target);
|
||||||
crec->addr.cname.uid = target->uid;
|
crec->addr.cname.uid = target->uid;
|
||||||
crec->uid = next_uid();
|
crec->uid = UID_NONE;
|
||||||
cache_hash(crec);
|
cache_hash(crec);
|
||||||
|
make_non_terminals(crec);
|
||||||
|
|
||||||
add_hosts_cname(crec); /* handle chains */
|
add_hosts_cname(crec); /* handle chains */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -861,6 +908,7 @@ static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrl
|
|||||||
cache->uid = index;
|
cache->uid = index;
|
||||||
memcpy(&cache->addr.addr, addr, addrlen);
|
memcpy(&cache->addr.addr, addr, addrlen);
|
||||||
cache_hash(cache);
|
cache_hash(cache);
|
||||||
|
make_non_terminals(cache);
|
||||||
|
|
||||||
/* don't need to do alias stuff for second and subsequent addresses. */
|
/* don't need to do alias stuff for second and subsequent addresses. */
|
||||||
if (!nameexists)
|
if (!nameexists)
|
||||||
@@ -981,8 +1029,7 @@ int read_hostsfile(char *filename, unsigned int index, int cache_size, struct cr
|
|||||||
{
|
{
|
||||||
/* If set, add a version of the name with a default domain appended */
|
/* If set, add a version of the name with a default domain appended */
|
||||||
if (option_bool(OPT_EXPAND) && domain_suffix && !fqdn &&
|
if (option_bool(OPT_EXPAND) && domain_suffix && !fqdn &&
|
||||||
(cache = whine_malloc(sizeof(struct crec) +
|
(cache = whine_malloc(SIZEOF_BARE_CREC + strlen(canon) + 2 + strlen(domain_suffix))))
|
||||||
strlen(canon)+2+strlen(domain_suffix)-SMALLDNAME)))
|
|
||||||
{
|
{
|
||||||
strcpy(cache->name.sname, canon);
|
strcpy(cache->name.sname, canon);
|
||||||
strcat(cache->name.sname, ".");
|
strcat(cache->name.sname, ".");
|
||||||
@@ -992,7 +1039,7 @@ int read_hostsfile(char *filename, unsigned int index, int cache_size, struct cr
|
|||||||
add_hosts_entry(cache, &addr, addrlen, index, rhash, hashsz);
|
add_hosts_entry(cache, &addr, addrlen, index, rhash, hashsz);
|
||||||
name_count++;
|
name_count++;
|
||||||
}
|
}
|
||||||
if ((cache = whine_malloc(sizeof(struct crec) + strlen(canon)+1-SMALLDNAME)))
|
if ((cache = whine_malloc(SIZEOF_BARE_CREC + strlen(canon) + 1)))
|
||||||
{
|
{
|
||||||
strcpy(cache->name.sname, canon);
|
strcpy(cache->name.sname, canon);
|
||||||
cache->flags = flags;
|
cache->flags = flags;
|
||||||
@@ -1031,7 +1078,8 @@ void cache_reload(void)
|
|||||||
struct ds_config *ds;
|
struct ds_config *ds;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cache_inserted = cache_live_freed = 0;
|
daemon->metrics[METRIC_DNS_CACHE_INSERTED] = 0;
|
||||||
|
daemon->metrics[METRIC_DNS_CACHE_LIVE_FREED] = 0;
|
||||||
|
|
||||||
for (i=0; i<hash_size; i++)
|
for (i=0; i<hash_size; i++)
|
||||||
for (cache = hash_table[i], up = &hash_table[i]; cache; cache = tmp)
|
for (cache = hash_table[i], up = &hash_table[i]; cache; cache = tmp)
|
||||||
@@ -1064,21 +1112,22 @@ void cache_reload(void)
|
|||||||
for (intr = daemon->int_names; intr; intr = intr->next)
|
for (intr = daemon->int_names; intr; intr = intr->next)
|
||||||
if (a->alias[1] != '*' &&
|
if (a->alias[1] != '*' &&
|
||||||
hostname_isequal(a->target, intr->name) &&
|
hostname_isequal(a->target, intr->name) &&
|
||||||
((cache = whine_malloc(sizeof(struct crec)))))
|
((cache = whine_malloc(SIZEOF_POINTER_CREC))))
|
||||||
{
|
{
|
||||||
cache->flags = F_FORWARD | F_NAMEP | F_CNAME | F_IMMORTAL | F_CONFIG;
|
cache->flags = F_FORWARD | F_NAMEP | F_CNAME | F_IMMORTAL | F_CONFIG;
|
||||||
cache->ttd = a->ttl;
|
cache->ttd = a->ttl;
|
||||||
cache->name.namep = a->alias;
|
cache->name.namep = a->alias;
|
||||||
cache->addr.cname.target.int_name = intr;
|
cache->addr.cname.target.int_name = intr;
|
||||||
cache->addr.cname.uid = SRC_INTERFACE;
|
cache->addr.cname.uid = SRC_INTERFACE;
|
||||||
cache->uid = next_uid();
|
cache->uid = UID_NONE;
|
||||||
cache_hash(cache);
|
cache_hash(cache);
|
||||||
|
make_non_terminals(cache);
|
||||||
add_hosts_cname(cache); /* handle chains */
|
add_hosts_cname(cache); /* handle chains */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
for (ds = daemon->ds; ds; ds = ds->next)
|
for (ds = daemon->ds; ds; ds = ds->next)
|
||||||
if ((cache = whine_malloc(sizeof(struct crec))) &&
|
if ((cache = whine_malloc(SIZEOF_POINTER_CREC)) &&
|
||||||
(cache->addr.ds.keydata = blockdata_alloc(ds->digest, ds->digestlen)))
|
(cache->addr.ds.keydata = blockdata_alloc(ds->digest, ds->digestlen)))
|
||||||
{
|
{
|
||||||
cache->flags = F_FORWARD | F_IMMORTAL | F_DS | F_CONFIG | F_NAMEP;
|
cache->flags = F_FORWARD | F_IMMORTAL | F_DS | F_CONFIG | F_NAMEP;
|
||||||
@@ -1090,6 +1139,7 @@ void cache_reload(void)
|
|||||||
cache->addr.ds.digest = ds->digest_type;
|
cache->addr.ds.digest = ds->digest_type;
|
||||||
cache->uid = ds->class;
|
cache->uid = ds->class;
|
||||||
cache_hash(cache);
|
cache_hash(cache);
|
||||||
|
make_non_terminals(cache);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1104,7 +1154,7 @@ void cache_reload(void)
|
|||||||
for (nl = hr->names; nl; nl = nl->next)
|
for (nl = hr->names; nl; nl = nl->next)
|
||||||
{
|
{
|
||||||
if (hr->addr.s_addr != 0 &&
|
if (hr->addr.s_addr != 0 &&
|
||||||
(cache = whine_malloc(sizeof(struct crec))))
|
(cache = whine_malloc(SIZEOF_POINTER_CREC)))
|
||||||
{
|
{
|
||||||
cache->name.namep = nl->name;
|
cache->name.namep = nl->name;
|
||||||
cache->ttd = hr->ttl;
|
cache->ttd = hr->ttl;
|
||||||
@@ -1113,7 +1163,7 @@ void cache_reload(void)
|
|||||||
}
|
}
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
if (!IN6_IS_ADDR_UNSPECIFIED(&hr->addr6) &&
|
if (!IN6_IS_ADDR_UNSPECIFIED(&hr->addr6) &&
|
||||||
(cache = whine_malloc(sizeof(struct crec))))
|
(cache = whine_malloc(SIZEOF_POINTER_CREC)))
|
||||||
{
|
{
|
||||||
cache->name.namep = nl->name;
|
cache->name.namep = nl->name;
|
||||||
cache->ttd = hr->ttl;
|
cache->ttd = hr->ttl;
|
||||||
@@ -1190,7 +1240,7 @@ static void add_dhcp_cname(struct crec *target, time_t ttd)
|
|||||||
if ((aliasc = dhcp_spare))
|
if ((aliasc = dhcp_spare))
|
||||||
dhcp_spare = dhcp_spare->next;
|
dhcp_spare = dhcp_spare->next;
|
||||||
else /* need new one */
|
else /* need new one */
|
||||||
aliasc = whine_malloc(sizeof(struct crec));
|
aliasc = whine_malloc(SIZEOF_POINTER_CREC);
|
||||||
|
|
||||||
if (aliasc)
|
if (aliasc)
|
||||||
{
|
{
|
||||||
@@ -1201,9 +1251,11 @@ static void add_dhcp_cname(struct crec *target, time_t ttd)
|
|||||||
aliasc->ttd = ttd;
|
aliasc->ttd = ttd;
|
||||||
aliasc->name.namep = a->alias;
|
aliasc->name.namep = a->alias;
|
||||||
aliasc->addr.cname.target.cache = target;
|
aliasc->addr.cname.target.cache = target;
|
||||||
|
next_uid(target);
|
||||||
aliasc->addr.cname.uid = target->uid;
|
aliasc->addr.cname.uid = target->uid;
|
||||||
aliasc->uid = next_uid();
|
aliasc->uid = UID_NONE;
|
||||||
cache_hash(aliasc);
|
cache_hash(aliasc);
|
||||||
|
make_non_terminals(aliasc);
|
||||||
add_dhcp_cname(aliasc, ttd);
|
add_dhcp_cname(aliasc, ttd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1243,7 +1295,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
|
|||||||
}
|
}
|
||||||
else if (!(crec->flags & F_DHCP))
|
else if (!(crec->flags & F_DHCP))
|
||||||
{
|
{
|
||||||
cache_scan_free(host_name, NULL, 0, crec->flags & (flags | F_CNAME | F_FORWARD));
|
cache_scan_free(host_name, NULL, 0, crec->flags & (flags | F_CNAME | F_FORWARD), NULL, NULL);
|
||||||
/* scan_free deletes all addresses associated with name */
|
/* scan_free deletes all addresses associated with name */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1270,7 +1322,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
|
|||||||
if (crec->flags & F_NEG)
|
if (crec->flags & F_NEG)
|
||||||
{
|
{
|
||||||
flags |= F_REVERSE;
|
flags |= F_REVERSE;
|
||||||
cache_scan_free(NULL, (struct all_addr *)host_address, 0, flags);
|
cache_scan_free(NULL, (struct all_addr *)host_address, 0, flags, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1279,7 +1331,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
|
|||||||
if ((crec = dhcp_spare))
|
if ((crec = dhcp_spare))
|
||||||
dhcp_spare = dhcp_spare->next;
|
dhcp_spare = dhcp_spare->next;
|
||||||
else /* need new one */
|
else /* need new one */
|
||||||
crec = whine_malloc(sizeof(struct crec));
|
crec = whine_malloc(SIZEOF_POINTER_CREC);
|
||||||
|
|
||||||
if (crec) /* malloc may fail */
|
if (crec) /* malloc may fail */
|
||||||
{
|
{
|
||||||
@@ -1290,14 +1342,108 @@ void cache_add_dhcp_entry(char *host_name, int prot,
|
|||||||
crec->ttd = ttd;
|
crec->ttd = ttd;
|
||||||
crec->addr.addr = *host_address;
|
crec->addr.addr = *host_address;
|
||||||
crec->name.namep = host_name;
|
crec->name.namep = host_name;
|
||||||
crec->uid = next_uid();
|
crec->uid = UID_NONE;
|
||||||
cache_hash(crec);
|
cache_hash(crec);
|
||||||
|
make_non_terminals(crec);
|
||||||
|
|
||||||
add_dhcp_cname(crec, ttd);
|
add_dhcp_cname(crec, ttd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Called when we put a local or DHCP name into the cache.
|
||||||
|
Creates empty cache entries for subnames (ie,
|
||||||
|
for three.two.one, for two.one and one), without
|
||||||
|
F_IPV4 or F_IPV6 or F_CNAME set. These convert
|
||||||
|
NXDOMAIN answers to NoData ones. */
|
||||||
|
static void make_non_terminals(struct crec *source)
|
||||||
|
{
|
||||||
|
char *name = cache_get_name(source);
|
||||||
|
struct crec *crecp, *tmp, **up;
|
||||||
|
int type = F_HOSTS | F_CONFIG;
|
||||||
|
#ifdef HAVE_DHCP
|
||||||
|
if (source->flags & F_DHCP)
|
||||||
|
type = F_DHCP;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* First delete any empty entries for our new real name. Note that
|
||||||
|
we only delete empty entries deriving from DHCP for a new DHCP-derived
|
||||||
|
entry and vice-versa for HOSTS and CONFIG. This ensures that
|
||||||
|
non-terminals from DHCP go when we reload DHCP and
|
||||||
|
for HOSTS/CONFIG when we re-read. */
|
||||||
|
for (up = hash_bucket(name), crecp = *up; crecp; crecp = tmp)
|
||||||
|
{
|
||||||
|
tmp = crecp->hash_next;
|
||||||
|
|
||||||
|
if (!is_outdated_cname_pointer(crecp) &&
|
||||||
|
(crecp->flags & F_FORWARD) &&
|
||||||
|
(crecp->flags & type) &&
|
||||||
|
!(crecp->flags & (F_IPV4 | F_IPV6 | F_CNAME | F_DNSKEY | F_DS)) &&
|
||||||
|
hostname_isequal(name, cache_get_name(crecp)))
|
||||||
|
{
|
||||||
|
*up = crecp->hash_next;
|
||||||
|
#ifdef HAVE_DHCP
|
||||||
|
if (type & F_DHCP)
|
||||||
|
{
|
||||||
|
crecp->next = dhcp_spare;
|
||||||
|
dhcp_spare = crecp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
free(crecp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
up = &crecp->hash_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((name = strchr(name, '.')))
|
||||||
|
{
|
||||||
|
name++;
|
||||||
|
|
||||||
|
/* Look for one existing, don't need another */
|
||||||
|
for (crecp = *hash_bucket(name); crecp; crecp = crecp->hash_next)
|
||||||
|
if (!is_outdated_cname_pointer(crecp) &&
|
||||||
|
(crecp->flags & F_FORWARD) &&
|
||||||
|
(crecp->flags & type) &&
|
||||||
|
hostname_isequal(name, cache_get_name(crecp)))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (crecp)
|
||||||
|
{
|
||||||
|
/* If the new name expires later, transfer that time to
|
||||||
|
empty non-terminal entry. */
|
||||||
|
if (!(crecp->flags & F_IMMORTAL))
|
||||||
|
{
|
||||||
|
if (source->flags & F_IMMORTAL)
|
||||||
|
crecp->flags |= F_IMMORTAL;
|
||||||
|
else if (difftime(crecp->ttd, source->ttd) < 0)
|
||||||
|
crecp->ttd = source->ttd;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP
|
||||||
|
if ((source->flags & F_DHCP) && dhcp_spare)
|
||||||
|
{
|
||||||
|
crecp = dhcp_spare;
|
||||||
|
dhcp_spare = dhcp_spare->next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
crecp = whine_malloc(SIZEOF_POINTER_CREC);
|
||||||
|
|
||||||
|
if (crecp)
|
||||||
|
{
|
||||||
|
crecp->flags = (source->flags | F_NAMEP) & ~(F_IPV4 | F_IPV6 | F_CNAME | F_DNSKEY | F_DS | F_REVERSE);
|
||||||
|
crecp->ttd = source->ttd;
|
||||||
|
crecp->name.namep = name;
|
||||||
|
|
||||||
|
cache_hash(crecp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NO_ID
|
#ifndef NO_ID
|
||||||
int cache_make_stat(struct txt_record *t)
|
int cache_make_stat(struct txt_record *t)
|
||||||
{
|
{
|
||||||
@@ -1319,24 +1465,24 @@ int cache_make_stat(struct txt_record *t)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TXT_STAT_INSERTS:
|
case TXT_STAT_INSERTS:
|
||||||
sprintf(buff+1, "%d", cache_inserted);
|
sprintf(buff+1, "%d", daemon->metrics[METRIC_DNS_CACHE_INSERTED]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TXT_STAT_EVICTIONS:
|
case TXT_STAT_EVICTIONS:
|
||||||
sprintf(buff+1, "%d", cache_live_freed);
|
sprintf(buff+1, "%d", daemon->metrics[METRIC_DNS_CACHE_LIVE_FREED]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TXT_STAT_MISSES:
|
case TXT_STAT_MISSES:
|
||||||
sprintf(buff+1, "%u", daemon->queries_forwarded);
|
sprintf(buff+1, "%u", daemon->metrics[METRIC_DNS_QUERIES_FORWARDED]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TXT_STAT_HITS:
|
case TXT_STAT_HITS:
|
||||||
sprintf(buff+1, "%u", daemon->local_answer);
|
sprintf(buff+1, "%u", daemon->metrics[METRIC_DNS_LOCAL_ANSWERED]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_AUTH
|
#ifdef HAVE_AUTH
|
||||||
case TXT_STAT_AUTH:
|
case TXT_STAT_AUTH:
|
||||||
sprintf(buff+1, "%u", daemon->auth_answer);
|
sprintf(buff+1, "%u", daemon->metrics[METRIC_DNS_AUTH_ANSWERED]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1413,15 +1559,14 @@ static char *sanitise(char *name)
|
|||||||
void dump_cache(time_t now)
|
void dump_cache(time_t now)
|
||||||
{
|
{
|
||||||
struct server *serv, *serv1;
|
struct server *serv, *serv1;
|
||||||
char *t = "";
|
|
||||||
|
|
||||||
my_syslog(LOG_INFO, _("time %lu"), (unsigned long)now);
|
my_syslog(LOG_INFO, _("time %lu"), (unsigned long)now);
|
||||||
my_syslog(LOG_INFO, _("cache size %d, %d/%d cache insertions re-used unexpired cache entries."),
|
my_syslog(LOG_INFO, _("cache size %d, %d/%d cache insertions re-used unexpired cache entries."),
|
||||||
daemon->cachesize, cache_live_freed, cache_inserted);
|
daemon->cachesize, daemon->metrics[METRIC_DNS_CACHE_LIVE_FREED], daemon->metrics[METRIC_DNS_CACHE_INSERTED]);
|
||||||
my_syslog(LOG_INFO, _("queries forwarded %u, queries answered locally %u"),
|
my_syslog(LOG_INFO, _("queries forwarded %u, queries answered locally %u"),
|
||||||
daemon->queries_forwarded, daemon->local_answer);
|
daemon->metrics[METRIC_DNS_QUERIES_FORWARDED], daemon->metrics[METRIC_DNS_LOCAL_ANSWERED]);
|
||||||
#ifdef HAVE_AUTH
|
#ifdef HAVE_AUTH
|
||||||
my_syslog(LOG_INFO, _("queries for authoritative zones %u"), daemon->auth_answer);
|
my_syslog(LOG_INFO, _("queries for authoritative zones %u"), daemon->metrics[METRIC_DNS_AUTH_ANSWERED]);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
blockdata_report();
|
blockdata_report();
|
||||||
@@ -1459,6 +1604,7 @@ void dump_cache(time_t now)
|
|||||||
for (i=0; i<hash_size; i++)
|
for (i=0; i<hash_size; i++)
|
||||||
for (cache = hash_table[i]; cache; cache = cache->hash_next)
|
for (cache = hash_table[i]; cache; cache = cache->hash_next)
|
||||||
{
|
{
|
||||||
|
char *t = " ";
|
||||||
char *a = daemon->addrbuff, *p = daemon->namebuff, *n = cache_get_name(cache);
|
char *a = daemon->addrbuff, *p = daemon->namebuff, *n = cache_get_name(cache);
|
||||||
*a = 0;
|
*a = 0;
|
||||||
if (strlen(n) == 0 && !(cache->flags & F_REVERSE))
|
if (strlen(n) == 0 && !(cache->flags & F_REVERSE))
|
||||||
@@ -1559,9 +1705,13 @@ char *querystr(char *desc, unsigned short type)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
len += 3; /* braces, terminator */
|
if (desc)
|
||||||
len += strlen(desc);
|
{
|
||||||
|
len += 2; /* braces */
|
||||||
|
len += strlen(desc);
|
||||||
|
}
|
||||||
|
len++; /* terminator */
|
||||||
|
|
||||||
if (!buff || bufflen < len)
|
if (!buff || bufflen < len)
|
||||||
{
|
{
|
||||||
if (buff)
|
if (buff)
|
||||||
@@ -1575,12 +1725,22 @@ char *querystr(char *desc, unsigned short type)
|
|||||||
|
|
||||||
if (buff)
|
if (buff)
|
||||||
{
|
{
|
||||||
if (types)
|
if (desc)
|
||||||
sprintf(buff, "%s[%s]", desc, types);
|
{
|
||||||
|
if (types)
|
||||||
|
sprintf(buff, "%s[%s]", desc, types);
|
||||||
|
else
|
||||||
|
sprintf(buff, "%s[type=%d]", desc, type);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sprintf(buff, "%s[type=%d]", desc, type);
|
{
|
||||||
|
if (types)
|
||||||
|
sprintf(buff, "<%s>", types);
|
||||||
|
else
|
||||||
|
sprintf(buff, "type=%d", type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return buff ? buff : "";
|
return buff ? buff : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1598,6 +1758,19 @@ void log_query(unsigned int flags, char *name, struct all_addr *addr, char *arg)
|
|||||||
{
|
{
|
||||||
if (flags & F_KEYTAG)
|
if (flags & F_KEYTAG)
|
||||||
sprintf(daemon->addrbuff, arg, addr->addr.log.keytag, addr->addr.log.algo, addr->addr.log.digest);
|
sprintf(daemon->addrbuff, arg, addr->addr.log.keytag, addr->addr.log.algo, addr->addr.log.digest);
|
||||||
|
else if (flags & F_RCODE)
|
||||||
|
{
|
||||||
|
unsigned int rcode = addr->addr.rcode.rcode;
|
||||||
|
|
||||||
|
if (rcode == SERVFAIL)
|
||||||
|
dest = "SERVFAIL";
|
||||||
|
else if (rcode == REFUSED)
|
||||||
|
dest = "REFUSED";
|
||||||
|
else if (rcode == NOTIMP)
|
||||||
|
dest = "not implemented";
|
||||||
|
else
|
||||||
|
sprintf(daemon->addrbuff, "%u", rcode);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
|
|||||||
+17
-2
@@ -94,6 +94,9 @@ HAVE_DBUS
|
|||||||
support some methods to allow (re)configuration of the upstream DNS
|
support some methods to allow (re)configuration of the upstream DNS
|
||||||
servers via DBus.
|
servers via DBus.
|
||||||
|
|
||||||
|
HAVE_UBUS
|
||||||
|
define this if you want to link against libubus
|
||||||
|
|
||||||
HAVE_IDN
|
HAVE_IDN
|
||||||
define this if you want international domain name 2003 support.
|
define this if you want international domain name 2003 support.
|
||||||
|
|
||||||
@@ -117,6 +120,9 @@ HAVE_AUTH
|
|||||||
HAVE_DNSSEC
|
HAVE_DNSSEC
|
||||||
include DNSSEC validator.
|
include DNSSEC validator.
|
||||||
|
|
||||||
|
HAVE_DUMPFILE
|
||||||
|
include code to dump packets to a libpcap-format file for debugging.
|
||||||
|
|
||||||
HAVE_LOOP
|
HAVE_LOOP
|
||||||
include functionality to probe for and remove DNS forwarding loops.
|
include functionality to probe for and remove DNS forwarding loops.
|
||||||
|
|
||||||
@@ -132,6 +138,7 @@ NO_DHCP6
|
|||||||
NO_SCRIPT
|
NO_SCRIPT
|
||||||
NO_LARGEFILE
|
NO_LARGEFILE
|
||||||
NO_AUTH
|
NO_AUTH
|
||||||
|
NO_DUMPFILE
|
||||||
NO_INOTIFY
|
NO_INOTIFY
|
||||||
these are available to explicitly disable compile time options which would
|
these are available to explicitly disable compile time options which would
|
||||||
otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
|
otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
|
||||||
@@ -164,6 +171,7 @@ RESOLVFILE
|
|||||||
#define HAVE_AUTH
|
#define HAVE_AUTH
|
||||||
#define HAVE_IPSET
|
#define HAVE_IPSET
|
||||||
#define HAVE_LOOP
|
#define HAVE_LOOP
|
||||||
|
#define HAVE_DUMPFILE
|
||||||
|
|
||||||
/* Build options which require external libraries.
|
/* Build options which require external libraries.
|
||||||
|
|
||||||
@@ -363,6 +371,10 @@ HAVE_SOCKADDR_SA_LEN
|
|||||||
#undef HAVE_LOOP
|
#undef HAVE_LOOP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_DUMPFILE
|
||||||
|
#undef HAVE_DUMPFILE
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_LINUX_NETWORK) && !defined(NO_INOTIFY)
|
#if defined (HAVE_LINUX_NETWORK) && !defined(NO_INOTIFY)
|
||||||
#define HAVE_INOTIFY
|
#define HAVE_INOTIFY
|
||||||
#endif
|
#endif
|
||||||
@@ -451,8 +463,11 @@ static char *compile_opts =
|
|||||||
#ifndef HAVE_INOTIFY
|
#ifndef HAVE_INOTIFY
|
||||||
"no-"
|
"no-"
|
||||||
#endif
|
#endif
|
||||||
"inotify";
|
"inotify "
|
||||||
|
#ifndef HAVE_DUMPFILE
|
||||||
|
"no-"
|
||||||
|
#endif
|
||||||
|
"dumpfile";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+31
@@ -85,6 +85,9 @@ const char* introspection_xml_template =
|
|||||||
" <arg name=\"success\" type=\"b\" direction=\"out\"/>\n"
|
" <arg name=\"success\" type=\"b\" direction=\"out\"/>\n"
|
||||||
" </method>\n"
|
" </method>\n"
|
||||||
#endif
|
#endif
|
||||||
|
" <method name=\"GetMetrics\">\n"
|
||||||
|
" <arg name=\"metrics\" direction=\"out\" type=\"a{su}\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
" </interface>\n"
|
" </interface>\n"
|
||||||
"</node>\n";
|
"</node>\n";
|
||||||
|
|
||||||
@@ -613,6 +616,30 @@ static DBusMessage *dbus_del_lease(DBusMessage* message)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static DBusMessage *dbus_get_metrics(DBusMessage* message)
|
||||||
|
{
|
||||||
|
DBusMessage *reply = dbus_message_new_method_return(message);
|
||||||
|
DBusMessageIter array, dict, iter;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
dbus_message_iter_init_append(reply, &iter);
|
||||||
|
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{su}", &array);
|
||||||
|
|
||||||
|
for (i = 0; i < __METRIC_MAX; i++) {
|
||||||
|
const char *key = get_metric_name(i);
|
||||||
|
dbus_uint32_t value = daemon->metrics[i];
|
||||||
|
|
||||||
|
dbus_message_iter_open_container(&array, DBUS_TYPE_DICT_ENTRY, NULL, &dict);
|
||||||
|
dbus_message_iter_append_basic(&dict, DBUS_TYPE_STRING, &key);
|
||||||
|
dbus_message_iter_append_basic(&dict, DBUS_TYPE_UINT32, &value);
|
||||||
|
dbus_message_iter_close_container(&array, &dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_iter_close_container(&iter, &array);
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
DBusHandlerResult message_handler(DBusConnection *connection,
|
DBusHandlerResult message_handler(DBusConnection *connection,
|
||||||
DBusMessage *message,
|
DBusMessage *message,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
@@ -680,6 +707,10 @@ DBusHandlerResult message_handler(DBusConnection *connection,
|
|||||||
reply = dbus_del_lease(message);
|
reply = dbus_del_lease(message);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else if (strcmp(method, "GetMetrics") == 0)
|
||||||
|
{
|
||||||
|
reply = dbus_get_metrics(message);
|
||||||
|
}
|
||||||
else if (strcmp(method, "ClearCache") == 0)
|
else if (strcmp(method, "ClearCache") == 0)
|
||||||
clear_cache = 1;
|
clear_cache = 1;
|
||||||
else
|
else
|
||||||
|
|||||||
+4
-1
@@ -485,8 +485,11 @@ char *whichdevice(void)
|
|||||||
|
|
||||||
void bindtodevice(char *device, int fd)
|
void bindtodevice(char *device, int fd)
|
||||||
{
|
{
|
||||||
|
size_t len = strlen(device)+1;
|
||||||
|
if (len > IFNAMSIZ)
|
||||||
|
len = IFNAMSIZ;
|
||||||
/* only allowed by root. */
|
/* only allowed by root. */
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, device, IFNAMSIZ) == -1 &&
|
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, device, len) == -1 &&
|
||||||
errno != EPERM)
|
errno != EPERM)
|
||||||
die(_("failed to set SO_BINDTODEVICE on DHCP socket: %s"), NULL, EC_BADNET);
|
die(_("failed to set SO_BINDTODEVICE on DHCP socket: %s"), NULL, EC_BADNET);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -232,7 +232,7 @@ void dhcp_packet(time_t now, int pxe_fd)
|
|||||||
|
|
||||||
#ifdef HAVE_LINUX_NETWORK
|
#ifdef HAVE_LINUX_NETWORK
|
||||||
/* ARP fiddling uses original interface even if we pretend to use a different one. */
|
/* ARP fiddling uses original interface even if we pretend to use a different one. */
|
||||||
strncpy(arp_req.arp_dev, ifr.ifr_name, 16);
|
safe_strncpy(arp_req.arp_dev, ifr.ifr_name, sizeof(arp_req.arp_dev));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If the interface on which the DHCP request was received is an
|
/* If the interface on which the DHCP request was received is an
|
||||||
@@ -255,7 +255,7 @@ void dhcp_packet(time_t now, int pxe_fd)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy(ifr.ifr_name, bridge->iface, IF_NAMESIZE);
|
safe_strncpy(ifr.ifr_name, bridge->iface, sizeof(ifr.ifr_name));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -279,7 +279,7 @@ void dhcp_packet(time_t now, int pxe_fd)
|
|||||||
is_relay_reply = 1;
|
is_relay_reply = 1;
|
||||||
iov.iov_len = sz;
|
iov.iov_len = sz;
|
||||||
#ifdef HAVE_LINUX_NETWORK
|
#ifdef HAVE_LINUX_NETWORK
|
||||||
strncpy(arp_req.arp_dev, ifr.ifr_name, 16);
|
safe_strncpy(arp_req.arp_dev, ifr.ifr_name, sizeof(arp_req.arp_dev));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -678,7 +678,7 @@ struct ping_result *do_icmp_ping(time_t now, struct in_addr addr, unsigned int h
|
|||||||
if ((count >= max) || option_bool(OPT_NO_PING) || loopback)
|
if ((count >= max) || option_bool(OPT_NO_PING) || loopback)
|
||||||
{
|
{
|
||||||
/* overloaded, or configured not to check, loopback interface, return "not in use" */
|
/* overloaded, or configured not to check, loopback interface, return "not in use" */
|
||||||
dummy.hash = 0;
|
dummy.hash = hash;
|
||||||
return &dummy;
|
return &dummy;
|
||||||
}
|
}
|
||||||
else if (icmp_ping(addr))
|
else if (icmp_ping(addr))
|
||||||
@@ -988,8 +988,7 @@ char *host_from_dns(struct in_addr addr)
|
|||||||
if (!legal_hostname(hostname))
|
if (!legal_hostname(hostname))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
strncpy(daemon->dhcp_buff, hostname, 256);
|
safe_strncpy(daemon->dhcp_buff, hostname, 256);
|
||||||
daemon->dhcp_buff[255] = 0;
|
|
||||||
strip_hostname(daemon->dhcp_buff);
|
strip_hostname(daemon->dhcp_buff);
|
||||||
|
|
||||||
return daemon->dhcp_buff;
|
return daemon->dhcp_buff;
|
||||||
|
|||||||
+30
-14
@@ -640,13 +640,20 @@ static int construct_worker(struct in6_addr *local, int prefix,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (template = daemon->dhcp6; template; template = template->next)
|
for (template = daemon->dhcp6; template; template = template->next)
|
||||||
if (!(template->flags & CONTEXT_TEMPLATE))
|
if (!(template->flags & (CONTEXT_TEMPLATE | CONTEXT_CONSTRUCTED)))
|
||||||
{
|
{
|
||||||
/* non-template entries, just fill in interface and local addresses */
|
/* non-template entries, just fill in interface and local addresses */
|
||||||
if (prefix <= template->prefix &&
|
if (prefix <= template->prefix &&
|
||||||
is_same_net6(local, &template->start6, template->prefix) &&
|
is_same_net6(local, &template->start6, template->prefix) &&
|
||||||
is_same_net6(local, &template->end6, template->prefix))
|
is_same_net6(local, &template->end6, template->prefix))
|
||||||
{
|
{
|
||||||
|
/* First time found, do fast RA. */
|
||||||
|
if (template->if_index != if_index || !IN6_ARE_ADDR_EQUAL(&template->local6, local))
|
||||||
|
{
|
||||||
|
ra_start_unsolicited(param->now, template);
|
||||||
|
param->newone = 1;
|
||||||
|
}
|
||||||
|
|
||||||
template->if_index = if_index;
|
template->if_index = if_index;
|
||||||
template->local6 = *local;
|
template->local6 = *local;
|
||||||
}
|
}
|
||||||
@@ -661,24 +668,33 @@ static int construct_worker(struct in6_addr *local, int prefix,
|
|||||||
setaddr6part(&end6, addr6part(&template->end6));
|
setaddr6part(&end6, addr6part(&template->end6));
|
||||||
|
|
||||||
for (context = daemon->dhcp6; context; context = context->next)
|
for (context = daemon->dhcp6; context; context = context->next)
|
||||||
if ((context->flags & CONTEXT_CONSTRUCTED) &&
|
if (!(context->flags & CONTEXT_TEMPLATE) &&
|
||||||
IN6_ARE_ADDR_EQUAL(&start6, &context->start6) &&
|
IN6_ARE_ADDR_EQUAL(&start6, &context->start6) &&
|
||||||
IN6_ARE_ADDR_EQUAL(&end6, &context->end6))
|
IN6_ARE_ADDR_EQUAL(&end6, &context->end6))
|
||||||
{
|
{
|
||||||
int flags = context->flags;
|
/* If there's an absolute address context covering this address
|
||||||
context->flags &= ~(CONTEXT_GC | CONTEXT_OLD);
|
then don't construct one as well. */
|
||||||
if (flags & CONTEXT_OLD)
|
if (!(context->flags & CONTEXT_CONSTRUCTED))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (context->if_index == if_index)
|
||||||
{
|
{
|
||||||
/* address went, now it's back */
|
int cflags = context->flags;
|
||||||
log_context(AF_INET6, context);
|
context->flags &= ~(CONTEXT_GC | CONTEXT_OLD);
|
||||||
/* fast RAs for a while */
|
if (cflags & CONTEXT_OLD)
|
||||||
ra_start_unsolicited(param->now, context);
|
{
|
||||||
param->newone = 1;
|
/* address went, now it's back, and on the same interface */
|
||||||
/* Add address to name again */
|
log_context(AF_INET6, context);
|
||||||
if (context->flags & CONTEXT_RA_NAME)
|
/* fast RAs for a while */
|
||||||
param->newname = 1;
|
ra_start_unsolicited(param->now, context);
|
||||||
|
param->newone = 1;
|
||||||
|
/* Add address to name again */
|
||||||
|
if (context->flags & CONTEXT_RA_NAME)
|
||||||
|
param->newname = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context && (context = whine_malloc(sizeof (struct dhcp_context))))
|
if (!context && (context = whine_malloc(sizeof (struct dhcp_context))))
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
#define T_AXFR 252
|
#define T_AXFR 252
|
||||||
#define T_MAILB 253
|
#define T_MAILB 253
|
||||||
#define T_ANY 255
|
#define T_ANY 255
|
||||||
|
#define T_CAA 257
|
||||||
|
|
||||||
#define EDNS0_OPTION_MAC 65001 /* dyndns.org temporary assignment */
|
#define EDNS0_OPTION_MAC 65001 /* dyndns.org temporary assignment */
|
||||||
#define EDNS0_OPTION_CLIENT_SUBNET 8 /* IANA */
|
#define EDNS0_OPTION_CLIENT_SUBNET 8 /* IANA */
|
||||||
|
|||||||
+56
-11
@@ -216,7 +216,7 @@ int main (int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_AUTH
|
#ifndef HAVE_AUTH
|
||||||
if (daemon->authserver)
|
if (daemon->auth_zones)
|
||||||
die(_("authoritative DNS not available: set HAVE_AUTH in src/config.h"), NULL, EC_BADCONF);
|
die(_("authoritative DNS not available: set HAVE_AUTH in src/config.h"), NULL, EC_BADCONF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -225,18 +225,30 @@ int main (int argc, char **argv)
|
|||||||
die(_("loop detection not available: set HAVE_LOOP in src/config.h"), NULL, EC_BADCONF);
|
die(_("loop detection not available: set HAVE_LOOP in src/config.h"), NULL, EC_BADCONF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_UBUS
|
||||||
|
if (option_bool(OPT_UBUS))
|
||||||
|
die(_("Ubus not available: set HAVE_UBUS in src/config.h"), NULL, EC_BADCONF);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (daemon->max_port < daemon->min_port)
|
if (daemon->max_port < daemon->min_port)
|
||||||
die(_("max_port cannot be smaller than min_port"), NULL, EC_BADCONF);
|
die(_("max_port cannot be smaller than min_port"), NULL, EC_BADCONF);
|
||||||
|
|
||||||
now = dnsmasq_time();
|
now = dnsmasq_time();
|
||||||
|
|
||||||
/* Create a serial at startup if not configured. */
|
if (daemon->auth_zones)
|
||||||
if (daemon->authinterface && daemon->soa_sn == 0)
|
{
|
||||||
|
if (!daemon->authserver)
|
||||||
|
die(_("--auth-server required when an auth zone is defined."), NULL, EC_BADCONF);
|
||||||
|
|
||||||
|
/* Create a serial at startup if not configured. */
|
||||||
#ifdef HAVE_BROKEN_RTC
|
#ifdef HAVE_BROKEN_RTC
|
||||||
die(_("zone serial must be configured in --auth-soa"), NULL, EC_BADCONF);
|
if (daemon->soa_sn == 0)
|
||||||
|
die(_("zone serial must be configured in --auth-soa"), NULL, EC_BADCONF);
|
||||||
#else
|
#else
|
||||||
daemon->soa_sn = now;
|
if (daemon->soa_sn == 0)
|
||||||
|
daemon->soa_sn = now;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
if (daemon->dhcp6)
|
if (daemon->dhcp6)
|
||||||
@@ -366,7 +378,16 @@ int main (int argc, char **argv)
|
|||||||
else
|
else
|
||||||
daemon->inotifyfd = -1;
|
daemon->inotifyfd = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (daemon->dump_file)
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
dump_init();
|
||||||
|
else
|
||||||
|
daemon->dumpfd = -1;
|
||||||
|
#else
|
||||||
|
die(_("Packet dumps not available: set HAVE_DUMP in src/config.h"), NULL, EC_BADCONF);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (option_bool(OPT_DBUS))
|
if (option_bool(OPT_DBUS))
|
||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
{
|
{
|
||||||
@@ -731,7 +752,11 @@ int main (int argc, char **argv)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (daemon->cachesize != 0)
|
if (daemon->cachesize != 0)
|
||||||
my_syslog(LOG_INFO, _("started, version %s cachesize %d"), VERSION, daemon->cachesize);
|
{
|
||||||
|
my_syslog(LOG_INFO, _("started, version %s cachesize %d"), VERSION, daemon->cachesize);
|
||||||
|
if (daemon->cachesize > 10000)
|
||||||
|
my_syslog(LOG_WARNING, _("cache size greater than 10000 may cause performance issues, and is unlikely to be useful."));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
my_syslog(LOG_INFO, _("started, version %s cache disabled"), VERSION);
|
my_syslog(LOG_INFO, _("started, version %s cache disabled"), VERSION);
|
||||||
|
|
||||||
@@ -758,7 +783,8 @@ int main (int argc, char **argv)
|
|||||||
if (option_bool(OPT_DNSSEC_VALID))
|
if (option_bool(OPT_DNSSEC_VALID))
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
struct ds_config *ds;
|
||||||
|
|
||||||
/* Delay creating the timestamp file until here, after we've changed user, so that
|
/* Delay creating the timestamp file until here, after we've changed user, so that
|
||||||
it has the correct owner to allow updating the mtime later.
|
it has the correct owner to allow updating the mtime later.
|
||||||
This means we have to report fatal errors via the pipe. */
|
This means we have to report fatal errors via the pipe. */
|
||||||
@@ -779,6 +805,10 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (rc == 1)
|
if (rc == 1)
|
||||||
my_syslog(LOG_INFO, _("DNSSEC signature timestamps not checked until system time valid"));
|
my_syslog(LOG_INFO, _("DNSSEC signature timestamps not checked until system time valid"));
|
||||||
|
|
||||||
|
for (ds = daemon->ds; ds; ds = ds->next)
|
||||||
|
my_syslog(LOG_INFO, _("configured with trust anchor for %s keytag %u"),
|
||||||
|
ds->name[0] == 0 ? "<root>" : ds->name, ds->keytag);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -929,8 +959,13 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
set_dbus_listeners();
|
set_dbus_listeners();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UBUS
|
||||||
|
if (option_bool(OPT_UBUS))
|
||||||
|
set_ubus_listeners();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DHCP
|
#ifdef HAVE_DHCP
|
||||||
if (daemon->dhcp || daemon->relay4)
|
if (daemon->dhcp || daemon->relay4)
|
||||||
{
|
{
|
||||||
@@ -1060,7 +1095,12 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
check_dbus_listeners();
|
check_dbus_listeners();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UBUS
|
||||||
|
if (option_bool(OPT_UBUS))
|
||||||
|
check_ubus_listeners();
|
||||||
|
#endif
|
||||||
|
|
||||||
check_dns_listeners(now);
|
check_dns_listeners(now);
|
||||||
|
|
||||||
#ifdef HAVE_TFTP
|
#ifdef HAVE_TFTP
|
||||||
@@ -1424,6 +1464,11 @@ static void async_event(int pipe, time_t now)
|
|||||||
|
|
||||||
if (daemon->runfile)
|
if (daemon->runfile)
|
||||||
unlink(daemon->runfile);
|
unlink(daemon->runfile);
|
||||||
|
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
if (daemon->dumpfd != -1)
|
||||||
|
close(daemon->dumpfd);
|
||||||
|
#endif
|
||||||
|
|
||||||
my_syslog(LOG_INFO, _("exiting on receipt of SIGTERM"));
|
my_syslog(LOG_INFO, _("exiting on receipt of SIGTERM"));
|
||||||
flush_log();
|
flush_log();
|
||||||
|
|||||||
+72
-8
@@ -42,6 +42,12 @@
|
|||||||
# define __EXTENSIONS__
|
# define __EXTENSIONS__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__clang__)
|
||||||
|
#define ATTRIBUTE_NORETURN __attribute__ ((noreturn))
|
||||||
|
#else
|
||||||
|
#define ATTRIBUTE_NORETURN
|
||||||
|
#endif
|
||||||
|
|
||||||
/* get these before config.h for IPv6 stuff... */
|
/* get these before config.h for IPv6 stuff... */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@@ -57,6 +63,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ip6addr.h"
|
#include "ip6addr.h"
|
||||||
|
#include "metrics.h"
|
||||||
|
|
||||||
typedef unsigned char u8;
|
typedef unsigned char u8;
|
||||||
typedef unsigned short u16;
|
typedef unsigned short u16;
|
||||||
@@ -119,6 +126,9 @@ typedef unsigned long long u64;
|
|||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
#include <netinet/in_systm.h>
|
#include <netinet/in_systm.h>
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
#include <netinet/ip6.h>
|
||||||
|
#endif
|
||||||
#include <netinet/ip_icmp.h>
|
#include <netinet/ip_icmp.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
@@ -251,7 +261,8 @@ struct event_desc {
|
|||||||
#define OPT_MAC_HEX 55
|
#define OPT_MAC_HEX 55
|
||||||
#define OPT_TFTP_APREF_MAC 56
|
#define OPT_TFTP_APREF_MAC 56
|
||||||
#define OPT_RAPID_COMMIT 57
|
#define OPT_RAPID_COMMIT 57
|
||||||
#define OPT_LAST 58
|
#define OPT_UBUS 58
|
||||||
|
#define OPT_LAST 59
|
||||||
|
|
||||||
/* extra flags for my_syslog, we use a couple of facilities since they are known
|
/* extra flags for my_syslog, we use a couple of facilities since they are known
|
||||||
not to occupy the same bits as priorities, no matter how syslog.h is set up. */
|
not to occupy the same bits as priorities, no matter how syslog.h is set up. */
|
||||||
@@ -268,7 +279,11 @@ struct all_addr {
|
|||||||
/* for log_query */
|
/* for log_query */
|
||||||
struct {
|
struct {
|
||||||
unsigned short keytag, algo, digest;
|
unsigned short keytag, algo, digest;
|
||||||
} log;
|
} log;
|
||||||
|
/* for log_query */
|
||||||
|
struct {
|
||||||
|
unsigned int rcode;
|
||||||
|
} rcode;
|
||||||
/* for cache_insert of DNSKEY, DS */
|
/* for cache_insert of DNSKEY, DS */
|
||||||
struct {
|
struct {
|
||||||
unsigned short class, type;
|
unsigned short class, type;
|
||||||
@@ -427,6 +442,9 @@ struct crec {
|
|||||||
} name;
|
} name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SIZEOF_BARE_CREC (sizeof(struct crec) - SMALLDNAME)
|
||||||
|
#define SIZEOF_POINTER_CREC (sizeof(struct crec) + sizeof(char *) - SMALLDNAME)
|
||||||
|
|
||||||
#define F_IMMORTAL (1u<<0)
|
#define F_IMMORTAL (1u<<0)
|
||||||
#define F_NAMEP (1u<<1)
|
#define F_NAMEP (1u<<1)
|
||||||
#define F_REVERSE (1u<<2)
|
#define F_REVERSE (1u<<2)
|
||||||
@@ -459,9 +477,14 @@ struct crec {
|
|||||||
#define F_IPSET (1u<<26)
|
#define F_IPSET (1u<<26)
|
||||||
#define F_NOEXTRA (1u<<27)
|
#define F_NOEXTRA (1u<<27)
|
||||||
#define F_SERVFAIL (1u<<28)
|
#define F_SERVFAIL (1u<<28)
|
||||||
|
#define F_RCODE (1u<<29)
|
||||||
|
|
||||||
|
#define UID_NONE 0
|
||||||
/* Values of uid in crecs with F_CONFIG bit set. */
|
/* Values of uid in crecs with F_CONFIG bit set. */
|
||||||
#define SRC_INTERFACE 0
|
/* cname to uid SRC_INTERFACE are to interface names,
|
||||||
|
so use UID_NONE for that to eliminate clashes with
|
||||||
|
any other uid */
|
||||||
|
#define SRC_INTERFACE UID_NONE
|
||||||
#define SRC_CONFIG 1
|
#define SRC_CONFIG 1
|
||||||
#define SRC_HOSTS 2
|
#define SRC_HOSTS 2
|
||||||
#define SRC_AH 3
|
#define SRC_AH 3
|
||||||
@@ -593,6 +616,16 @@ struct hostsfile {
|
|||||||
unsigned int index; /* matches to cache entries for logging */
|
unsigned int index; /* matches to cache entries for logging */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* packet-dump flags */
|
||||||
|
#define DUMP_QUERY 0x0001
|
||||||
|
#define DUMP_REPLY 0x0002
|
||||||
|
#define DUMP_UP_QUERY 0x0004
|
||||||
|
#define DUMP_UP_REPLY 0x0008
|
||||||
|
#define DUMP_SEC_QUERY 0x0010
|
||||||
|
#define DUMP_SEC_REPLY 0x0020
|
||||||
|
#define DUMP_BOGUS 0x0040
|
||||||
|
#define DUMP_SEC_BOGUS 0x0080
|
||||||
|
|
||||||
|
|
||||||
/* DNSSEC status values. */
|
/* DNSSEC status values. */
|
||||||
#define STAT_SECURE 1
|
#define STAT_SECURE 1
|
||||||
@@ -798,6 +831,13 @@ struct dhcp_boot {
|
|||||||
struct dhcp_boot *next;
|
struct dhcp_boot *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct dhcp_match_name {
|
||||||
|
char *name;
|
||||||
|
int wildcard;
|
||||||
|
struct dhcp_netid *netid;
|
||||||
|
struct dhcp_match_name *next;
|
||||||
|
};
|
||||||
|
|
||||||
struct pxe_service {
|
struct pxe_service {
|
||||||
unsigned short CSA, type;
|
unsigned short CSA, type;
|
||||||
char *menu, *basename, *sname;
|
char *menu, *basename, *sname;
|
||||||
@@ -990,6 +1030,7 @@ extern struct daemon {
|
|||||||
struct ra_interface *ra_interfaces;
|
struct ra_interface *ra_interfaces;
|
||||||
struct dhcp_config *dhcp_conf;
|
struct dhcp_config *dhcp_conf;
|
||||||
struct dhcp_opt *dhcp_opts, *dhcp_match, *dhcp_opts6, *dhcp_match6;
|
struct dhcp_opt *dhcp_opts, *dhcp_match, *dhcp_opts6, *dhcp_match6;
|
||||||
|
struct dhcp_match_name *dhcp_name_match;
|
||||||
struct dhcp_vendor *dhcp_vendors;
|
struct dhcp_vendor *dhcp_vendors;
|
||||||
struct dhcp_mac *dhcp_macs;
|
struct dhcp_mac *dhcp_macs;
|
||||||
struct dhcp_boot *boot_config;
|
struct dhcp_boot *boot_config;
|
||||||
@@ -1015,14 +1056,15 @@ extern struct daemon {
|
|||||||
unsigned int duid_enterprise, duid_config_len;
|
unsigned int duid_enterprise, duid_config_len;
|
||||||
unsigned char *duid_config;
|
unsigned char *duid_config;
|
||||||
char *dbus_name;
|
char *dbus_name;
|
||||||
|
char *dump_file;
|
||||||
|
int dump_mask;
|
||||||
unsigned long soa_sn, soa_refresh, soa_retry, soa_expiry;
|
unsigned long soa_sn, soa_refresh, soa_retry, soa_expiry;
|
||||||
|
u32 metrics[__METRIC_MAX];
|
||||||
#ifdef OPTION6_PREFIX_CLASS
|
#ifdef OPTION6_PREFIX_CLASS
|
||||||
struct prefix_class *prefix_classes;
|
struct prefix_class *prefix_classes;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
struct ds_config *ds;
|
struct ds_config *ds;
|
||||||
int dnssec_no_time_check;
|
|
||||||
int back_to_the_future;
|
|
||||||
char *timestamp_file;
|
char *timestamp_file;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1035,8 +1077,9 @@ extern struct daemon {
|
|||||||
char *workspacename; /* ditto */
|
char *workspacename; /* ditto */
|
||||||
char *rr_status; /* flags for individual RRs */
|
char *rr_status; /* flags for individual RRs */
|
||||||
int rr_status_sz;
|
int rr_status_sz;
|
||||||
|
int dnssec_no_time_check;
|
||||||
|
int back_to_the_future;
|
||||||
#endif
|
#endif
|
||||||
unsigned int local_answer, queries_forwarded, auth_answer;
|
|
||||||
struct frec *frec_list;
|
struct frec *frec_list;
|
||||||
struct serverfd *sfds;
|
struct serverfd *sfds;
|
||||||
struct irec *interfaces;
|
struct irec *interfaces;
|
||||||
@@ -1089,13 +1132,19 @@ extern struct daemon {
|
|||||||
char *addrbuff;
|
char *addrbuff;
|
||||||
char *addrbuff2; /* only allocated when OPT_EXTRALOG */
|
char *addrbuff2; /* only allocated when OPT_EXTRALOG */
|
||||||
|
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
/* file for packet dumps. */
|
||||||
|
int dumpfd;
|
||||||
|
#endif
|
||||||
} *daemon;
|
} *daemon;
|
||||||
|
|
||||||
/* cache.c */
|
/* cache.c */
|
||||||
void cache_init(void);
|
void cache_init(void);
|
||||||
|
void next_uid(struct crec *crecp);
|
||||||
void log_query(unsigned int flags, char *name, struct all_addr *addr, char *arg);
|
void log_query(unsigned int flags, char *name, struct all_addr *addr, char *arg);
|
||||||
char *record_source(unsigned int index);
|
char *record_source(unsigned int index);
|
||||||
char *querystr(char *desc, unsigned short type);
|
char *querystr(char *desc, unsigned short type);
|
||||||
|
int cache_find_non_terminal(char *name, time_t now);
|
||||||
struct crec *cache_find_by_addr(struct crec *crecp,
|
struct crec *cache_find_by_addr(struct crec *crecp,
|
||||||
struct all_addr *addr, time_t now,
|
struct all_addr *addr, time_t now,
|
||||||
unsigned int prot);
|
unsigned int prot);
|
||||||
@@ -1178,7 +1227,7 @@ int in_zone(struct auth_zone *zone, char *name, char **cut);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* dnssec.c */
|
/* dnssec.c */
|
||||||
size_t dnssec_generate_query(struct dns_header *header, unsigned char *end, char *name, int class, int type, union mysockaddr *addr, int edns_pktsz);
|
size_t dnssec_generate_query(struct dns_header *header, unsigned char *end, char *name, int class, int type, int edns_pktsz);
|
||||||
int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class);
|
int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class);
|
||||||
int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class);
|
int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class);
|
||||||
int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int *class,
|
int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int *class,
|
||||||
@@ -1206,11 +1255,13 @@ int legal_hostname(char *name);
|
|||||||
char *canonicalise(char *in, int *nomem);
|
char *canonicalise(char *in, int *nomem);
|
||||||
unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit);
|
unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit);
|
||||||
void *safe_malloc(size_t size);
|
void *safe_malloc(size_t size);
|
||||||
|
void safe_strncpy(char *dest, const char *src, size_t size);
|
||||||
void safe_pipe(int *fd, int read_noblock);
|
void safe_pipe(int *fd, int read_noblock);
|
||||||
void *whine_malloc(size_t size);
|
void *whine_malloc(size_t size);
|
||||||
int sa_len(union mysockaddr *addr);
|
int sa_len(union mysockaddr *addr);
|
||||||
int sockaddr_isequal(union mysockaddr *s1, union mysockaddr *s2);
|
int sockaddr_isequal(union mysockaddr *s1, union mysockaddr *s2);
|
||||||
int hostname_isequal(const char *a, const char *b);
|
int hostname_isequal(const char *a, const char *b);
|
||||||
|
int hostname_issubdomain(char *a, char *b);
|
||||||
time_t dnsmasq_time(void);
|
time_t dnsmasq_time(void);
|
||||||
int netmask_length(struct in_addr mask);
|
int netmask_length(struct in_addr mask);
|
||||||
int is_same_net(struct in_addr a, struct in_addr b, struct in_addr mask);
|
int is_same_net(struct in_addr a, struct in_addr b, struct in_addr mask);
|
||||||
@@ -1234,7 +1285,7 @@ int wildcard_match(const char* wildcard, const char* match);
|
|||||||
int wildcard_matchn(const char* wildcard, const char* match, int num);
|
int wildcard_matchn(const char* wildcard, const char* match, int num);
|
||||||
|
|
||||||
/* log.c */
|
/* log.c */
|
||||||
void die(char *message, char *arg1, int exit_code);
|
void die(char *message, char *arg1, int exit_code) ATTRIBUTE_NORETURN;
|
||||||
int log_start(struct passwd *ent_pw, int errfd);
|
int log_start(struct passwd *ent_pw, int errfd);
|
||||||
int log_reopen(char *log_file);
|
int log_reopen(char *log_file);
|
||||||
|
|
||||||
@@ -1416,6 +1467,13 @@ void emit_dbus_signal(int action, struct dhcp_lease *lease, char *hostname);
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* ubus.c */
|
||||||
|
#ifdef HAVE_UBUS
|
||||||
|
void set_ubus_listeners(void);
|
||||||
|
void check_ubus_listeners(void);
|
||||||
|
void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ipset.c */
|
/* ipset.c */
|
||||||
#ifdef HAVE_IPSET
|
#ifdef HAVE_IPSET
|
||||||
void ipset_init(void);
|
void ipset_init(void);
|
||||||
@@ -1583,3 +1641,9 @@ int check_source(struct dns_header *header, size_t plen, unsigned char *pseudohe
|
|||||||
/* arp.c */
|
/* arp.c */
|
||||||
int find_mac(union mysockaddr *addr, unsigned char *mac, int lazy, time_t now);
|
int find_mac(union mysockaddr *addr, unsigned char *mac, int lazy, time_t now);
|
||||||
int do_arp_script_run(void);
|
int do_arp_script_run(void);
|
||||||
|
|
||||||
|
/* dump.c */
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
void dump_init(void);
|
||||||
|
void dump_packet(int mask, void *packet, size_t len, union mysockaddr *src, union mysockaddr *dst);
|
||||||
|
#endif
|
||||||
+7
-20
@@ -876,12 +876,7 @@ int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char
|
|||||||
|
|
||||||
if (rc == STAT_INSECURE)
|
if (rc == STAT_INSECURE)
|
||||||
{
|
{
|
||||||
static int reported = 0;
|
my_syslog(LOG_WARNING, _("Insecure DS reply received, do upstream DNS servers support DNSSEC?"));
|
||||||
if (!reported)
|
|
||||||
{
|
|
||||||
reported = 1;
|
|
||||||
my_syslog(LOG_WARNING, _("Insecure DS reply received, do upstream DNS servers support DNSSEC?"));
|
|
||||||
}
|
|
||||||
rc = STAT_BOGUS;
|
rc = STAT_BOGUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1766,7 +1761,7 @@ int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, ch
|
|||||||
|
|
||||||
unsigned char *ans_start, *p1, *p2;
|
unsigned char *ans_start, *p1, *p2;
|
||||||
int type1, class1, rdlen1 = 0, type2, class2, rdlen2, qclass, qtype, targetidx;
|
int type1, class1, rdlen1 = 0, type2, class2, rdlen2, qclass, qtype, targetidx;
|
||||||
int i, j, rc;
|
int i, j, rc = STAT_INSECURE;
|
||||||
int secure = STAT_SECURE;
|
int secure = STAT_SECURE;
|
||||||
|
|
||||||
/* extend rr_status if necessary */
|
/* extend rr_status if necessary */
|
||||||
@@ -1840,10 +1835,10 @@ int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, ch
|
|||||||
|
|
||||||
for (p1 = ans_start, i = 0; i < ntohs(header->ancount) + ntohs(header->nscount); i++)
|
for (p1 = ans_start, i = 0; i < ntohs(header->ancount) + ntohs(header->nscount); i++)
|
||||||
{
|
{
|
||||||
if (i != 0 && !ADD_RDLEN(header, p1, plen, rdlen1))
|
if (i != 0 && !ADD_RDLEN(header, p1, plen, rdlen1))
|
||||||
return STAT_BOGUS;
|
return STAT_BOGUS;
|
||||||
|
|
||||||
if (!extract_name(header, plen, &p1, name, 1, 10))
|
if (!extract_name(header, plen, &p1, name, 1, 10))
|
||||||
return STAT_BOGUS; /* bad packet */
|
return STAT_BOGUS; /* bad packet */
|
||||||
|
|
||||||
GETSHORT(type1, p1);
|
GETSHORT(type1, p1);
|
||||||
@@ -2031,19 +2026,11 @@ int dnskey_keytag(int alg, int flags, unsigned char *key, int keylen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t dnssec_generate_query(struct dns_header *header, unsigned char *end, char *name, int class,
|
size_t dnssec_generate_query(struct dns_header *header, unsigned char *end, char *name, int class,
|
||||||
int type, union mysockaddr *addr, int edns_pktsz)
|
int type, int edns_pktsz)
|
||||||
{
|
{
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
char *types = querystr("dnssec-query", type);
|
|
||||||
size_t ret;
|
size_t ret;
|
||||||
|
|
||||||
if (addr->sa.sa_family == AF_INET)
|
|
||||||
log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, name, (struct all_addr *)&addr->in.sin_addr, types);
|
|
||||||
#ifdef HAVE_IPV6
|
|
||||||
else
|
|
||||||
log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, name, (struct all_addr *)&addr->in6.sin6_addr, types);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
header->qdcount = htons(1);
|
header->qdcount = htons(1);
|
||||||
header->ancount = htons(0);
|
header->ancount = htons(0);
|
||||||
header->nscount = htons(0);
|
header->nscount = htons(0);
|
||||||
|
|||||||
+211
@@ -0,0 +1,211 @@
|
|||||||
|
/* dnsmasq is Copyright (c) 2000-2018 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
|
||||||
|
the Free Software Foundation; version 2 dated June, 1991, or
|
||||||
|
(at your option) version 3 dated 29 June, 2007.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dnsmasq.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
|
||||||
|
static u32 packet_count;
|
||||||
|
|
||||||
|
/* https://wiki.wireshark.org/Development/LibpcapFileFormat */
|
||||||
|
struct pcap_hdr_s {
|
||||||
|
u32 magic_number; /* magic number */
|
||||||
|
u16 version_major; /* major version number */
|
||||||
|
u16 version_minor; /* minor version number */
|
||||||
|
u32 thiszone; /* GMT to local correction */
|
||||||
|
u32 sigfigs; /* accuracy of timestamps */
|
||||||
|
u32 snaplen; /* max length of captured packets, in octets */
|
||||||
|
u32 network; /* data link type */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcaprec_hdr_s {
|
||||||
|
u32 ts_sec; /* timestamp seconds */
|
||||||
|
u32 ts_usec; /* timestamp microseconds */
|
||||||
|
u32 incl_len; /* number of octets of packet saved in file */
|
||||||
|
u32 orig_len; /* actual length of packet */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void dump_init(void)
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
struct pcap_hdr_s header;
|
||||||
|
struct pcaprec_hdr_s pcap_header;
|
||||||
|
|
||||||
|
packet_count = 0;
|
||||||
|
|
||||||
|
if (stat(daemon->dump_file, &buf) == -1)
|
||||||
|
{
|
||||||
|
/* doesn't exist, create and add header */
|
||||||
|
header.magic_number = 0xa1b2c3d4;
|
||||||
|
header.version_major = 2;
|
||||||
|
header.version_minor = 4;
|
||||||
|
header.thiszone = 0;
|
||||||
|
header.sigfigs = 0;
|
||||||
|
header.snaplen = daemon->edns_pktsz + 200; /* slop for IP/UDP headers */
|
||||||
|
header.network = 101; /* DLT_RAW http://www.tcpdump.org/linktypes.html */
|
||||||
|
|
||||||
|
if (errno != ENOENT ||
|
||||||
|
(daemon->dumpfd = creat(daemon->dump_file, S_IRUSR | S_IWUSR)) == -1 ||
|
||||||
|
!read_write(daemon->dumpfd, (void *)&header, sizeof(header), 0))
|
||||||
|
die(_("cannot create %s: %s"), daemon->dump_file, EC_FILE);
|
||||||
|
}
|
||||||
|
else if ((daemon->dumpfd = open(daemon->dump_file, O_APPEND | O_RDWR)) == -1 ||
|
||||||
|
!read_write(daemon->dumpfd, (void *)&header, sizeof(header), 1))
|
||||||
|
die(_("cannot access %s: %s"), daemon->dump_file, EC_FILE);
|
||||||
|
else if (header.magic_number != 0xa1b2c3d4)
|
||||||
|
die(_("bad header in %s"), daemon->dump_file, EC_FILE);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* count existing records */
|
||||||
|
while (read_write(daemon->dumpfd, (void *)&pcap_header, sizeof(pcap_header), 1))
|
||||||
|
{
|
||||||
|
lseek(daemon->dumpfd, pcap_header.incl_len, SEEK_CUR);
|
||||||
|
packet_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dump_packet(int mask, void *packet, size_t len, union mysockaddr *src, union mysockaddr *dst)
|
||||||
|
{
|
||||||
|
struct ip ip;
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
struct ip6_hdr ip6;
|
||||||
|
int family;
|
||||||
|
#endif
|
||||||
|
struct udphdr {
|
||||||
|
u16 uh_sport; /* source port */
|
||||||
|
u16 uh_dport; /* destination port */
|
||||||
|
u16 uh_ulen; /* udp length */
|
||||||
|
u16 uh_sum; /* udp checksum */
|
||||||
|
} udp;
|
||||||
|
struct pcaprec_hdr_s pcap_header;
|
||||||
|
struct timeval time;
|
||||||
|
u32 i, sum;
|
||||||
|
void *iphdr;
|
||||||
|
size_t ipsz;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (daemon->dumpfd == -1 || !(mask & daemon->dump_mask))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* So wireshark can Id the packet. */
|
||||||
|
udp.uh_sport = udp.uh_dport = htons(NAMESERVER_PORT);
|
||||||
|
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
if (src)
|
||||||
|
family = src->sa.sa_family;
|
||||||
|
else
|
||||||
|
family = dst->sa.sa_family;
|
||||||
|
|
||||||
|
if (family == AF_INET6)
|
||||||
|
{
|
||||||
|
iphdr = &ip6;
|
||||||
|
ipsz = sizeof(ip6);
|
||||||
|
memset(&ip6, 0, sizeof(ip6));
|
||||||
|
|
||||||
|
ip6.ip6_vfc = 6 << 4;
|
||||||
|
ip6.ip6_plen = htons(sizeof(struct udphdr) + len);
|
||||||
|
ip6.ip6_nxt = IPPROTO_UDP;
|
||||||
|
ip6.ip6_hops = 64;
|
||||||
|
|
||||||
|
if (src)
|
||||||
|
{
|
||||||
|
memcpy(&ip6.ip6_src, &src->in6.sin6_addr, IN6ADDRSZ);
|
||||||
|
udp.uh_sport = src->in6.sin6_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dst)
|
||||||
|
{
|
||||||
|
memcpy(&ip6.ip6_dst, &dst->in6.sin6_addr, IN6ADDRSZ);
|
||||||
|
udp.uh_dport = dst->in6.sin6_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* start UDP checksum */
|
||||||
|
for (sum = 0, i = 0; i < IN6ADDRSZ; i++)
|
||||||
|
sum += ((u16 *)&ip6.ip6_src)[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
iphdr = &ip;
|
||||||
|
ipsz = sizeof(ip);
|
||||||
|
memset(&ip, 0, sizeof(ip));
|
||||||
|
|
||||||
|
ip.ip_v = IPVERSION;
|
||||||
|
ip.ip_hl = sizeof(struct ip) / 4;
|
||||||
|
ip.ip_len = htons(sizeof(struct ip) + sizeof(struct udphdr) + len);
|
||||||
|
ip.ip_ttl = IPDEFTTL;
|
||||||
|
ip.ip_p = IPPROTO_UDP;
|
||||||
|
|
||||||
|
if (src)
|
||||||
|
{
|
||||||
|
ip.ip_src = src->in.sin_addr;
|
||||||
|
udp.uh_sport = src->in.sin_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dst)
|
||||||
|
{
|
||||||
|
ip.ip_dst = dst->in.sin_addr;
|
||||||
|
udp.uh_dport = dst->in.sin_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
ip.ip_sum = 0;
|
||||||
|
for (sum = 0, i = 0; i < sizeof(struct ip) / 2; i++)
|
||||||
|
sum += ((u16 *)&ip)[i];
|
||||||
|
while (sum >> 16)
|
||||||
|
sum = (sum & 0xffff) + (sum >> 16);
|
||||||
|
ip.ip_sum = (sum == 0xffff) ? sum : ~sum;
|
||||||
|
|
||||||
|
/* start UDP checksum */
|
||||||
|
sum = ip.ip_src.s_addr & 0xffff;
|
||||||
|
sum += (ip.ip_src.s_addr >> 16) & 0xffff;
|
||||||
|
sum += ip.ip_dst.s_addr & 0xffff;
|
||||||
|
sum += (ip.ip_dst.s_addr >> 16) & 0xffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len & 1)
|
||||||
|
((unsigned char *)packet)[len] = 0; /* for checksum, in case length is odd. */
|
||||||
|
|
||||||
|
udp.uh_sum = 0;
|
||||||
|
udp.uh_ulen = htons(sizeof(struct udphdr) + len);
|
||||||
|
sum += htons(IPPROTO_UDP);
|
||||||
|
sum += htons(sizeof(struct udphdr) + len);
|
||||||
|
for (i = 0; i < sizeof(struct udphdr)/2; i++)
|
||||||
|
sum += ((u16 *)&udp)[i];
|
||||||
|
for (i = 0; i < (len + 1) / 2; i++)
|
||||||
|
sum += ((u16 *)packet)[i];
|
||||||
|
while (sum >> 16)
|
||||||
|
sum = (sum & 0xffff) + (sum >> 16);
|
||||||
|
udp.uh_sum = (sum == 0xffff) ? sum : ~sum;
|
||||||
|
|
||||||
|
rc = gettimeofday(&time, NULL);
|
||||||
|
pcap_header.ts_sec = time.tv_sec;
|
||||||
|
pcap_header.ts_usec = time.tv_usec;
|
||||||
|
pcap_header.incl_len = pcap_header.orig_len = ipsz + sizeof(udp) + len;
|
||||||
|
|
||||||
|
if (rc == -1 ||
|
||||||
|
!read_write(daemon->dumpfd, (void *)&pcap_header, sizeof(pcap_header), 0) ||
|
||||||
|
!read_write(daemon->dumpfd, iphdr, ipsz, 0) ||
|
||||||
|
!read_write(daemon->dumpfd, (void *)&udp, sizeof(udp), 0) ||
|
||||||
|
!read_write(daemon->dumpfd, (void *)packet, len, 0))
|
||||||
|
my_syslog(LOG_ERR, _("failed to write packet dump"));
|
||||||
|
else
|
||||||
|
my_syslog(LOG_INFO, _("dumping UDP packet %u mask 0x%04x"), ++packet_count, mask);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
+216
-63
@@ -118,6 +118,7 @@ static unsigned int search_servers(time_t now, struct all_addr **addrpp, unsigne
|
|||||||
unsigned int matchlen = 0;
|
unsigned int matchlen = 0;
|
||||||
struct server *serv;
|
struct server *serv;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
static struct all_addr zero;
|
||||||
|
|
||||||
for (serv = daemon->servers; serv; serv=serv->next)
|
for (serv = daemon->servers; serv; serv=serv->next)
|
||||||
if (qtype == F_DNSSECOK && !(serv->flags & SERV_DO_DNSSEC))
|
if (qtype == F_DNSSECOK && !(serv->flags & SERV_DO_DNSSEC))
|
||||||
@@ -129,9 +130,16 @@ static unsigned int search_servers(time_t now, struct all_addr **addrpp, unsigne
|
|||||||
*type = SERV_FOR_NODOTS;
|
*type = SERV_FOR_NODOTS;
|
||||||
if (serv->flags & SERV_NO_ADDR)
|
if (serv->flags & SERV_NO_ADDR)
|
||||||
flags = F_NXDOMAIN;
|
flags = F_NXDOMAIN;
|
||||||
else if (serv->flags & SERV_LITERAL_ADDRESS)
|
else if (serv->flags & SERV_LITERAL_ADDRESS)
|
||||||
{
|
{
|
||||||
if (sflag & qtype)
|
/* literal address = '#' -> return all-zero address for IPv4 and IPv6 */
|
||||||
|
if ((serv->flags & SERV_USE_RESOLV) && (qtype & (F_IPV6 | F_IPV4)))
|
||||||
|
{
|
||||||
|
memset(&zero, 0, sizeof(zero));
|
||||||
|
flags = qtype;
|
||||||
|
*addrpp = &zero;
|
||||||
|
}
|
||||||
|
else if (sflag & qtype)
|
||||||
{
|
{
|
||||||
flags = sflag;
|
flags = sflag;
|
||||||
if (serv->addr.sa.sa_family == AF_INET)
|
if (serv->addr.sa.sa_family == AF_INET)
|
||||||
@@ -184,7 +192,14 @@ static unsigned int search_servers(time_t now, struct all_addr **addrpp, unsigne
|
|||||||
flags = F_NXDOMAIN;
|
flags = F_NXDOMAIN;
|
||||||
else if (serv->flags & SERV_LITERAL_ADDRESS)
|
else if (serv->flags & SERV_LITERAL_ADDRESS)
|
||||||
{
|
{
|
||||||
if (sflag & qtype)
|
/* literal address = '#' -> return all-zero address for IPv4 and IPv6 */
|
||||||
|
if ((serv->flags & SERV_USE_RESOLV) && (qtype & (F_IPV6 | F_IPV4)))
|
||||||
|
{
|
||||||
|
memset(&zero, 0, sizeof(zero));
|
||||||
|
flags = qtype;
|
||||||
|
*addrpp = &zero;
|
||||||
|
}
|
||||||
|
else if (sflag & qtype)
|
||||||
{
|
{
|
||||||
flags = sflag;
|
flags = sflag;
|
||||||
if (serv->addr.sa.sa_family == AF_INET)
|
if (serv->addr.sa.sa_family == AF_INET)
|
||||||
@@ -214,12 +229,18 @@ static unsigned int search_servers(time_t now, struct all_addr **addrpp, unsigne
|
|||||||
|
|
||||||
if (flags)
|
if (flags)
|
||||||
{
|
{
|
||||||
int logflags = 0;
|
if (flags == F_NXDOMAIN || flags == F_NOERR)
|
||||||
|
log_query(flags | qtype | F_NEG | F_CONFIG | F_FORWARD, qdomain, NULL, NULL);
|
||||||
if (flags == F_NXDOMAIN || flags == F_NOERR)
|
else
|
||||||
logflags = F_NEG | qtype;
|
{
|
||||||
|
/* handle F_IPV4 and F_IPV6 set on ANY query to 0.0.0.0/:: domain. */
|
||||||
log_query(logflags | flags | F_CONFIG | F_FORWARD, qdomain, *addrpp, NULL);
|
if (flags & F_IPV4)
|
||||||
|
log_query((flags | F_CONFIG | F_FORWARD) & ~F_IPV6, qdomain, *addrpp, NULL);
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
if (flags & F_IPV6)
|
||||||
|
log_query((flags | F_CONFIG | F_FORWARD) & ~F_IPV4, qdomain, *addrpp, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ((*type) & SERV_USE_RESOLV)
|
else if ((*type) & SERV_USE_RESOLV)
|
||||||
{
|
{
|
||||||
@@ -246,9 +267,9 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
unsigned int crc = questions_crc(header, plen, daemon->namebuff);
|
unsigned int crc = questions_crc(header, plen, daemon->namebuff);
|
||||||
void *hash = &crc;
|
void *hash = &crc;
|
||||||
#endif
|
#endif
|
||||||
unsigned int gotname = extract_request(header, plen, daemon->namebuff, NULL);
|
unsigned int gotname = extract_request(header, plen, daemon->namebuff, NULL);
|
||||||
|
unsigned char *oph = find_pseudoheader(header, plen, NULL, NULL, NULL, NULL);
|
||||||
(void)do_bit;
|
(void)do_bit;
|
||||||
|
|
||||||
/* may be no servers available. */
|
/* may be no servers available. */
|
||||||
if (forward || (hash && (forward = lookup_frec_by_sender(ntohs(header->id), udpaddr, hash))))
|
if (forward || (hash && (forward = lookup_frec_by_sender(ntohs(header->id), udpaddr, hash))))
|
||||||
@@ -298,9 +319,9 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
fd = forward->rfd4->fd;
|
fd = forward->rfd4->fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (retry_send( sendto(fd, (char *)header, plen, 0,
|
while (retry_send(sendto(fd, (char *)header, plen, 0,
|
||||||
&forward->sentto->addr.sa,
|
&forward->sentto->addr.sa,
|
||||||
sa_len(&forward->sentto->addr))));
|
sa_len(&forward->sentto->addr))));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -399,7 +420,6 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
struct server *firstsentto = start;
|
struct server *firstsentto = start;
|
||||||
int subnet, forwarded = 0;
|
int subnet, forwarded = 0;
|
||||||
size_t edns0_len;
|
size_t edns0_len;
|
||||||
unsigned char *oph = find_pseudoheader(header, plen, NULL, NULL, NULL, NULL);
|
|
||||||
unsigned char *pheader;
|
unsigned char *pheader;
|
||||||
|
|
||||||
/* If a query is retried, use the log_id for the retry when logging the answer. */
|
/* If a query is retried, use the log_id for the retry when logging the answer. */
|
||||||
@@ -508,6 +528,10 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
|
|
||||||
if (errno == 0)
|
if (errno == 0)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
dump_packet(DUMP_UP_QUERY, (void *)header, plen, NULL, &start->addr);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Keep info in case we want to re-send this packet */
|
/* Keep info in case we want to re-send this packet */
|
||||||
daemon->srv_save = start;
|
daemon->srv_save = start;
|
||||||
daemon->packet_len = plen;
|
daemon->packet_len = plen;
|
||||||
@@ -550,6 +574,8 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
if (udpfd != -1)
|
if (udpfd != -1)
|
||||||
{
|
{
|
||||||
plen = setup_reply(header, plen, addrp, flags, daemon->local_ttl);
|
plen = setup_reply(header, plen, addrp, flags, daemon->local_ttl);
|
||||||
|
if (oph)
|
||||||
|
plen = add_pseudoheader(header, plen, ((unsigned char *) header) + PACKETSZ, daemon->edns_pktsz, 0, NULL, 0, do_bit, 0);
|
||||||
send_from(udpfd, option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND), (char *)header, plen, udpaddr, dst_addr, dst_iface);
|
send_from(udpfd, option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND), (char *)header, plen, udpaddr, dst_addr, dst_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,6 +589,7 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
|
|||||||
unsigned char *pheader, *sizep;
|
unsigned char *pheader, *sizep;
|
||||||
char **sets = 0;
|
char **sets = 0;
|
||||||
int munged = 0, is_sign;
|
int munged = 0, is_sign;
|
||||||
|
unsigned int rcode = RCODE(header);
|
||||||
size_t plen;
|
size_t plen;
|
||||||
|
|
||||||
(void)ad_reqd;
|
(void)ad_reqd;
|
||||||
@@ -593,6 +620,9 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
|
|||||||
|
|
||||||
if ((pheader = find_pseudoheader(header, n, &plen, &sizep, &is_sign, NULL)))
|
if ((pheader = find_pseudoheader(header, n, &plen, &sizep, &is_sign, NULL)))
|
||||||
{
|
{
|
||||||
|
/* Get extended RCODE. */
|
||||||
|
rcode |= sizep[2] << 4;
|
||||||
|
|
||||||
if (check_subnet && !check_source(header, plen, pheader, query_source))
|
if (check_subnet && !check_source(header, plen, pheader, query_source))
|
||||||
{
|
{
|
||||||
my_syslog(LOG_WARNING, _("discarding DNS reply: subnet option mismatch"));
|
my_syslog(LOG_WARNING, _("discarding DNS reply: subnet option mismatch"));
|
||||||
@@ -641,11 +671,20 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
|
|||||||
if (!is_sign && !option_bool(OPT_DNSSEC_PROXY))
|
if (!is_sign && !option_bool(OPT_DNSSEC_PROXY))
|
||||||
header->hb4 &= ~HB4_AD;
|
header->hb4 &= ~HB4_AD;
|
||||||
|
|
||||||
if (OPCODE(header) != QUERY || (RCODE(header) != NOERROR && RCODE(header) != NXDOMAIN))
|
if (OPCODE(header) != QUERY)
|
||||||
return resize_packet(header, n, pheader, plen);
|
return resize_packet(header, n, pheader, plen);
|
||||||
|
|
||||||
|
if (rcode != NOERROR && rcode != NXDOMAIN)
|
||||||
|
{
|
||||||
|
struct all_addr a;
|
||||||
|
a.addr.rcode.rcode = rcode;
|
||||||
|
log_query(F_UPSTREAM | F_RCODE, "error", &a, NULL);
|
||||||
|
|
||||||
|
return resize_packet(header, n, pheader, plen);
|
||||||
|
}
|
||||||
|
|
||||||
/* Complain loudly if the upstream server is non-recursive. */
|
/* Complain loudly if the upstream server is non-recursive. */
|
||||||
if (!(header->hb4 & HB4_RA) && RCODE(header) == NOERROR &&
|
if (!(header->hb4 & HB4_RA) && rcode == NOERROR &&
|
||||||
server && !(server->flags & SERV_WARNED_RECURSIVE))
|
server && !(server->flags & SERV_WARNED_RECURSIVE))
|
||||||
{
|
{
|
||||||
prettyprint_addr(&server->addr, daemon->namebuff);
|
prettyprint_addr(&server->addr, daemon->namebuff);
|
||||||
@@ -654,7 +693,7 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
|
|||||||
server->flags |= SERV_WARNED_RECURSIVE;
|
server->flags |= SERV_WARNED_RECURSIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (daemon->bogus_addr && RCODE(header) != NXDOMAIN &&
|
if (daemon->bogus_addr && rcode != NXDOMAIN &&
|
||||||
check_for_bogus_wildcard(header, n, daemon->namebuff, daemon->bogus_addr, now))
|
check_for_bogus_wildcard(header, n, daemon->namebuff, daemon->bogus_addr, now))
|
||||||
{
|
{
|
||||||
munged = 1;
|
munged = 1;
|
||||||
@@ -666,7 +705,7 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
|
|||||||
{
|
{
|
||||||
int doctored = 0;
|
int doctored = 0;
|
||||||
|
|
||||||
if (RCODE(header) == NXDOMAIN &&
|
if (rcode == NXDOMAIN &&
|
||||||
extract_request(header, n, daemon->namebuff, NULL) &&
|
extract_request(header, n, daemon->namebuff, NULL) &&
|
||||||
check_for_local_domain(daemon->namebuff, now))
|
check_for_local_domain(daemon->namebuff, now))
|
||||||
{
|
{
|
||||||
@@ -756,7 +795,7 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
header = (struct dns_header *)daemon->packet;
|
header = (struct dns_header *)daemon->packet;
|
||||||
|
|
||||||
if (n < (int)sizeof(struct dns_header) || !(header->hb3 & HB3_QR))
|
if (n < (int)sizeof(struct dns_header) || !(header->hb3 & HB3_QR))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -783,6 +822,11 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
if (!(forward = lookup_frec(ntohs(header->id), hash)))
|
if (!(forward = lookup_frec(ntohs(header->id), hash)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
dump_packet((forward->flags & (FREC_DNSKEY_QUERY | FREC_DS_QUERY)) ? DUMP_SEC_REPLY : DUMP_UP_REPLY,
|
||||||
|
(void *)header, n, &serveraddr, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* log_query gets called indirectly all over the place, so
|
/* log_query gets called indirectly all over the place, so
|
||||||
pass these in global variables - sorry. */
|
pass these in global variables - sorry. */
|
||||||
daemon->log_display_id = forward->log_id;
|
daemon->log_display_id = forward->log_id;
|
||||||
@@ -794,7 +838,7 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
|
|
||||||
/* Note: if we send extra options in the EDNS0 header, we can't recreate
|
/* Note: if we send extra options in the EDNS0 header, we can't recreate
|
||||||
the query from the reply. */
|
the query from the reply. */
|
||||||
if (RCODE(header) == REFUSED &&
|
if ((RCODE(header) == REFUSED || RCODE(header) == SERVFAIL) &&
|
||||||
forward->forwardall == 0 &&
|
forward->forwardall == 0 &&
|
||||||
!(forward->flags & FREC_HAS_EXTRADATA))
|
!(forward->flags & FREC_HAS_EXTRADATA))
|
||||||
/* for broken servers, attempt to send to another one. */
|
/* for broken servers, attempt to send to another one. */
|
||||||
@@ -803,6 +847,70 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
size_t plen;
|
size_t plen;
|
||||||
int is_sign;
|
int is_sign;
|
||||||
|
|
||||||
|
#ifdef HAVE_DNSSEC
|
||||||
|
/* For DNSSEC originated queries, just retry the query to the same server. */
|
||||||
|
if (forward->flags & (FREC_DNSKEY_QUERY | FREC_DS_QUERY))
|
||||||
|
{
|
||||||
|
struct server *start;
|
||||||
|
|
||||||
|
blockdata_retrieve(forward->stash, forward->stash_len, (void *)header);
|
||||||
|
plen = forward->stash_len;
|
||||||
|
|
||||||
|
forward->forwardall = 2; /* only retry once */
|
||||||
|
start = forward->sentto;
|
||||||
|
|
||||||
|
/* for non-domain specific servers, see if we can find another to try. */
|
||||||
|
if ((forward->sentto->flags & SERV_TYPE) == 0)
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (!(start = start->next))
|
||||||
|
start = daemon->servers;
|
||||||
|
if (start == forward->sentto)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ((start->flags & SERV_TYPE) == 0 &&
|
||||||
|
(start->flags & SERV_DO_DNSSEC))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (start->sfd)
|
||||||
|
fd = start->sfd->fd;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
if (start->addr.sa.sa_family == AF_INET6)
|
||||||
|
{
|
||||||
|
/* may have changed family */
|
||||||
|
if (!forward->rfd6)
|
||||||
|
forward->rfd6 = allocate_rfd(AF_INET6);
|
||||||
|
fd = forward->rfd6->fd;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/* may have changed family */
|
||||||
|
if (!forward->rfd4)
|
||||||
|
forward->rfd4 = allocate_rfd(AF_INET);
|
||||||
|
fd = forward->rfd4->fd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (retry_send(sendto(fd, (char *)header, plen, 0,
|
||||||
|
&start->addr.sa,
|
||||||
|
sa_len(&start->addr))));
|
||||||
|
|
||||||
|
if (start->addr.sa.sa_family == AF_INET)
|
||||||
|
log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, "retry", (struct all_addr *)&start->addr.in.sin_addr, "dnssec");
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
else
|
||||||
|
log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (struct all_addr *)&start->addr.in6.sin6_addr, "dnssec");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* In strict order mode, there must be a server later in the chain
|
/* In strict order mode, there must be a server later in the chain
|
||||||
left to send to, otherwise without the forwardall mechanism,
|
left to send to, otherwise without the forwardall mechanism,
|
||||||
code further on will cycle around the list forwever if they
|
code further on will cycle around the list forwever if they
|
||||||
@@ -921,6 +1029,11 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
status = dnssec_validate_reply(now, header, n, daemon->namebuff, daemon->keyname, &forward->class,
|
status = dnssec_validate_reply(now, header, n, daemon->namebuff, daemon->keyname, &forward->class,
|
||||||
!option_bool(OPT_DNSSEC_IGN_NS) && (server->flags & SERV_DO_DNSSEC),
|
!option_bool(OPT_DNSSEC_IGN_NS) && (server->flags & SERV_DO_DNSSEC),
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
if (status == STAT_BOGUS)
|
||||||
|
dump_packet((forward->flags & (FREC_DNSKEY_QUERY | FREC_DS_QUERY)) ? DUMP_SEC_BOGUS : DUMP_BOGUS,
|
||||||
|
header, (size_t)n, &serveraddr, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Can't validate, as we're missing key data. Put this
|
/* Can't validate, as we're missing key data. Put this
|
||||||
@@ -945,7 +1058,7 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
status = STAT_ABANDONED;
|
status = STAT_ABANDONED;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int fd, type = SERV_DO_DNSSEC;
|
int querytype, fd, type = SERV_DO_DNSSEC;
|
||||||
struct frec *next = new->next;
|
struct frec *next = new->next;
|
||||||
char *domain;
|
char *domain;
|
||||||
|
|
||||||
@@ -963,7 +1076,7 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (type == (start->flags & (SERV_TYPE | SERV_DO_DNSSEC)) &&
|
if (type == (start->flags & (SERV_TYPE | SERV_DO_DNSSEC)) &&
|
||||||
(type != SERV_HAS_DOMAIN || hostname_isequal(domain, start->domain)) &&
|
((type & SERV_TYPE) != SERV_HAS_DOMAIN || hostname_isequal(domain, start->domain)) &&
|
||||||
!(start->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
|
!(start->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
|
||||||
{
|
{
|
||||||
new_server = start;
|
new_server = start;
|
||||||
@@ -989,7 +1102,8 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
new->rfd6 = NULL;
|
new->rfd6 = NULL;
|
||||||
#endif
|
#endif
|
||||||
new->flags &= ~(FREC_DNSKEY_QUERY | FREC_DS_QUERY);
|
new->flags &= ~(FREC_DNSKEY_QUERY | FREC_DS_QUERY | FREC_HAS_EXTRADATA);
|
||||||
|
new->forwardall = 0;
|
||||||
|
|
||||||
new->dependent = forward; /* to find query awaiting new one. */
|
new->dependent = forward; /* to find query awaiting new one. */
|
||||||
forward->blocking_query = new; /* for garbage cleaning */
|
forward->blocking_query = new; /* for garbage cleaning */
|
||||||
@@ -997,15 +1111,26 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
if (status == STAT_NEED_KEY)
|
if (status == STAT_NEED_KEY)
|
||||||
{
|
{
|
||||||
new->flags |= FREC_DNSKEY_QUERY;
|
new->flags |= FREC_DNSKEY_QUERY;
|
||||||
nn = dnssec_generate_query(header, ((unsigned char *) header) + server->edns_pktsz,
|
querytype = T_DNSKEY;
|
||||||
daemon->keyname, forward->class, T_DNSKEY, &server->addr, server->edns_pktsz);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new->flags |= FREC_DS_QUERY;
|
new->flags |= FREC_DS_QUERY;
|
||||||
nn = dnssec_generate_query(header,((unsigned char *) header) + server->edns_pktsz,
|
querytype = T_DS;
|
||||||
daemon->keyname, forward->class, T_DS, &server->addr, server->edns_pktsz);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nn = dnssec_generate_query(header,((unsigned char *) header) + server->edns_pktsz,
|
||||||
|
daemon->keyname, forward->class, querytype, server->edns_pktsz);
|
||||||
|
|
||||||
|
if (server->addr.sa.sa_family == AF_INET)
|
||||||
|
log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, daemon->keyname, (struct all_addr *)&(server->addr.in.sin_addr),
|
||||||
|
querystr("dnssec-query", querytype));
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
else
|
||||||
|
log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, daemon->keyname, (struct all_addr *)&(server->addr.in6.sin6_addr),
|
||||||
|
querystr("dnssec-query", querytype));
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((hash = hash_questions(header, nn, daemon->namebuff)))
|
if ((hash = hash_questions(header, nn, daemon->namebuff)))
|
||||||
memcpy(new->hash, hash, HASH_SIZE);
|
memcpy(new->hash, hash, HASH_SIZE);
|
||||||
new->new_id = get_id();
|
new->new_id = get_id();
|
||||||
@@ -1047,6 +1172,11 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(unsigned int));
|
setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(unsigned int));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
dump_packet(DUMP_SEC_QUERY, (void *)header, (size_t)nn, NULL, &server->addr);
|
||||||
|
#endif
|
||||||
|
|
||||||
while (retry_send(sendto(fd, (char *)header, nn, 0,
|
while (retry_send(sendto(fd, (char *)header, nn, 0,
|
||||||
&server->addr.sa,
|
&server->addr.sa,
|
||||||
sa_len(&server->addr))));
|
sa_len(&server->addr))));
|
||||||
@@ -1090,7 +1220,7 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
if (status == STAT_BOGUS && extract_request(header, n, daemon->namebuff, NULL))
|
if (status == STAT_BOGUS && extract_request(header, n, daemon->namebuff, NULL))
|
||||||
domain = daemon->namebuff;
|
domain = daemon->namebuff;
|
||||||
|
|
||||||
log_query(F_KEYTAG | F_SECSTAT, domain, NULL, result);
|
log_query(F_SECSTAT, domain, NULL, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == STAT_SECURE)
|
if (status == STAT_SECURE)
|
||||||
@@ -1101,8 +1231,8 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
bogusanswer = 1;
|
bogusanswer = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* restore CD bit to the value in the query */
|
/* restore CD bit to the value in the query */
|
||||||
if (forward->flags & FREC_CHECKING_DISABLED)
|
if (forward->flags & FREC_CHECKING_DISABLED)
|
||||||
header->hb4 |= HB4_CD;
|
header->hb4 |= HB4_CD;
|
||||||
@@ -1128,6 +1258,11 @@ void reply_query(int fd, int family, time_t now)
|
|||||||
nn = resize_packet(header, nn, NULL, 0);
|
nn = resize_packet(header, nn, NULL, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
dump_packet(DUMP_REPLY, daemon->packet, (size_t)nn, NULL, &forward->source);
|
||||||
|
#endif
|
||||||
|
|
||||||
send_from(forward->fd, option_bool(OPT_NOWILD) || option_bool (OPT_CLEVERBIND), daemon->packet, nn,
|
send_from(forward->fd, option_bool(OPT_NOWILD) || option_bool (OPT_CLEVERBIND), daemon->packet, nn,
|
||||||
&forward->source, &forward->dest, forward->iface);
|
&forward->source, &forward->dest, forward->iface);
|
||||||
}
|
}
|
||||||
@@ -1381,7 +1516,11 @@ void receive_query(struct listener *listen, time_t now)
|
|||||||
pass these in global variables - sorry. */
|
pass these in global variables - sorry. */
|
||||||
daemon->log_display_id = ++daemon->log_id;
|
daemon->log_display_id = ++daemon->log_id;
|
||||||
daemon->log_source_addr = &source_addr;
|
daemon->log_source_addr = &source_addr;
|
||||||
|
|
||||||
|
#ifdef HAVE_DUMPFILE
|
||||||
|
dump_packet(DUMP_QUERY, daemon->packet, (size_t)n, &source_addr, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (extract_request(header, (size_t)n, daemon->namebuff, &type))
|
if (extract_request(header, (size_t)n, daemon->namebuff, &type))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_AUTH
|
#ifdef HAVE_AUTH
|
||||||
@@ -1447,7 +1586,7 @@ void receive_query(struct listener *listen, time_t now)
|
|||||||
{
|
{
|
||||||
send_from(listen->fd, option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND),
|
send_from(listen->fd, option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND),
|
||||||
(char *)header, m, &source_addr, &dst_addr, if_index);
|
(char *)header, m, &source_addr, &dst_addr, if_index);
|
||||||
daemon->auth_answer++;
|
daemon->metrics[METRIC_DNS_AUTH_ANSWERED]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1465,13 +1604,13 @@ void receive_query(struct listener *listen, time_t now)
|
|||||||
{
|
{
|
||||||
send_from(listen->fd, option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND),
|
send_from(listen->fd, option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND),
|
||||||
(char *)header, m, &source_addr, &dst_addr, if_index);
|
(char *)header, m, &source_addr, &dst_addr, if_index);
|
||||||
daemon->local_answer++;
|
daemon->metrics[METRIC_DNS_LOCAL_ANSWERED]++;
|
||||||
}
|
}
|
||||||
else if (forward_query(listen->fd, &source_addr, &dst_addr, if_index,
|
else if (forward_query(listen->fd, &source_addr, &dst_addr, if_index,
|
||||||
header, (size_t)n, now, NULL, ad_reqd, do_bit))
|
header, (size_t)n, now, NULL, ad_reqd, do_bit))
|
||||||
daemon->queries_forwarded++;
|
daemon->metrics[METRIC_DNS_QUERIES_FORWARDED]++;
|
||||||
else
|
else
|
||||||
daemon->local_answer++;
|
daemon->metrics[METRIC_DNS_LOCAL_ANSWERED]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1525,9 +1664,9 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
|
|||||||
new_status = STAT_ABANDONED;
|
new_status = STAT_ABANDONED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m = dnssec_generate_query(new_header, ((unsigned char *) new_header) + 65536, keyname, class,
|
m = dnssec_generate_query(new_header, ((unsigned char *) new_header) + 65536, keyname, class,
|
||||||
new_status == STAT_NEED_KEY ? T_DNSKEY : T_DS, &server->addr, server->edns_pktsz);
|
new_status == STAT_NEED_KEY ? T_DNSKEY : T_DS, server->edns_pktsz);
|
||||||
|
|
||||||
*length = htons(m);
|
*length = htons(m);
|
||||||
|
|
||||||
@@ -1560,30 +1699,30 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
|
|||||||
(type == SERV_HAS_DOMAIN && !hostname_isequal(domain, server->domain)) ||
|
(type == SERV_HAS_DOMAIN && !hostname_isequal(domain, server->domain)) ||
|
||||||
(server->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
|
(server->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
/* may need to make new connection. */
|
/* may need to make new connection. */
|
||||||
if (server->tcpfd == -1)
|
if (server->tcpfd == -1)
|
||||||
{
|
{
|
||||||
if ((server->tcpfd = socket(server->addr.sa.sa_family, SOCK_STREAM, 0)) == -1)
|
if ((server->tcpfd = socket(server->addr.sa.sa_family, SOCK_STREAM, 0)) == -1)
|
||||||
continue; /* No good, next server */
|
continue; /* No good, next server */
|
||||||
|
|
||||||
#ifdef HAVE_CONNTRACK
|
#ifdef HAVE_CONNTRACK
|
||||||
/* Copy connection mark of incoming query to outgoing connection. */
|
/* Copy connection mark of incoming query to outgoing connection. */
|
||||||
if (have_mark)
|
if (have_mark)
|
||||||
setsockopt(server->tcpfd, SOL_SOCKET, SO_MARK, &mark, sizeof(unsigned int));
|
setsockopt(server->tcpfd, SOL_SOCKET, SO_MARK, &mark, sizeof(unsigned int));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!local_bind(server->tcpfd, &server->source_addr, server->interface, 0, 1) ||
|
if (!local_bind(server->tcpfd, &server->source_addr, server->interface, 0, 1) ||
|
||||||
connect(server->tcpfd, &server->addr.sa, sa_len(&server->addr)) == -1)
|
connect(server->tcpfd, &server->addr.sa, sa_len(&server->addr)) == -1)
|
||||||
{
|
{
|
||||||
close(server->tcpfd);
|
close(server->tcpfd);
|
||||||
server->tcpfd = -1;
|
server->tcpfd = -1;
|
||||||
continue; /* No good, next server */
|
continue; /* No good, next server */
|
||||||
}
|
}
|
||||||
|
|
||||||
server->flags &= ~SERV_GOT_TCP;
|
server->flags &= ~SERV_GOT_TCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!read_write(server->tcpfd, packet, m + sizeof(u16), 0) ||
|
if (!read_write(server->tcpfd, packet, m + sizeof(u16), 0) ||
|
||||||
!read_write(server->tcpfd, &c1, 1, 1) ||
|
!read_write(server->tcpfd, &c1, 1, 1) ||
|
||||||
@@ -1600,6 +1739,16 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
|
|||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (server->addr.sa.sa_family == AF_INET)
|
||||||
|
log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, keyname, (struct all_addr *)&(server->addr.in.sin_addr),
|
||||||
|
querystr("dnssec-query", new_status == STAT_NEED_KEY ? T_DNSKEY : T_DS));
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
else
|
||||||
|
log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, keyname, (struct all_addr *)&(server->addr.in6.sin6_addr),
|
||||||
|
querystr("dnssec-query", new_status == STAT_NEED_KEY ? T_DNSKEY : T_DS));
|
||||||
|
#endif
|
||||||
|
|
||||||
server->flags |= SERV_GOT_TCP;
|
server->flags |= SERV_GOT_TCP;
|
||||||
|
|
||||||
@@ -1948,7 +2097,7 @@ unsigned char *tcp_request(int confd, time_t now,
|
|||||||
if (status == STAT_BOGUS && extract_request(header, m, daemon->namebuff, NULL))
|
if (status == STAT_BOGUS && extract_request(header, m, daemon->namebuff, NULL))
|
||||||
domain = daemon->namebuff;
|
domain = daemon->namebuff;
|
||||||
|
|
||||||
log_query(F_KEYTAG | F_SECSTAT, domain, NULL, result);
|
log_query(F_SECSTAT, domain, NULL, result);
|
||||||
|
|
||||||
if (status == STAT_BOGUS)
|
if (status == STAT_BOGUS)
|
||||||
{
|
{
|
||||||
@@ -1998,7 +2147,11 @@ unsigned char *tcp_request(int confd, time_t now,
|
|||||||
|
|
||||||
/* In case of local answer or no connections made. */
|
/* In case of local answer or no connections made. */
|
||||||
if (m == 0)
|
if (m == 0)
|
||||||
m = setup_reply(header, (unsigned int)size, addrp, flags, daemon->local_ttl);
|
{
|
||||||
|
m = setup_reply(header, (unsigned int)size, addrp, flags, daemon->local_ttl);
|
||||||
|
if (have_pseudoheader)
|
||||||
|
m = add_pseudoheader(header, m, ((unsigned char *) header) + 65536, daemon->edns_pktsz, 0, NULL, 0, do_bit, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-3
@@ -87,7 +87,7 @@ static int read_leases(time_t now, FILE *leasestream)
|
|||||||
if ((lease = lease6_allocate(&addr.addr.addr6, lease_type)))
|
if ((lease = lease6_allocate(&addr.addr.addr6, lease_type)))
|
||||||
{
|
{
|
||||||
lease_set_iaid(lease, strtoul(s, NULL, 10));
|
lease_set_iaid(lease, strtoul(s, NULL, 10));
|
||||||
domain = get_domain6((struct in6_addr *)lease->hwaddr);
|
domain = get_domain6(&lease->addr6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -555,7 +555,9 @@ void lease_prune(struct dhcp_lease *target, time_t now)
|
|||||||
file_dirty = 1;
|
file_dirty = 1;
|
||||||
if (lease->hostname)
|
if (lease->hostname)
|
||||||
dns_dirty = 1;
|
dns_dirty = 1;
|
||||||
|
|
||||||
|
daemon->metrics[lease->addr.s_addr ? METRIC_LEASES_PRUNED_4 : METRIC_LEASES_PRUNED_6]++;
|
||||||
|
|
||||||
*up = lease->next; /* unlink */
|
*up = lease->next; /* unlink */
|
||||||
|
|
||||||
/* Put on old_leases list 'till we
|
/* Put on old_leases list 'till we
|
||||||
@@ -773,7 +775,10 @@ struct dhcp_lease *lease4_allocate(struct in_addr addr)
|
|||||||
{
|
{
|
||||||
struct dhcp_lease *lease = lease_allocate();
|
struct dhcp_lease *lease = lease_allocate();
|
||||||
if (lease)
|
if (lease)
|
||||||
lease->addr = addr;
|
{
|
||||||
|
lease->addr = addr;
|
||||||
|
daemon->metrics[METRIC_LEASES_ALLOCATED_4]++;
|
||||||
|
}
|
||||||
|
|
||||||
return lease;
|
return lease;
|
||||||
}
|
}
|
||||||
@@ -788,6 +793,8 @@ struct dhcp_lease *lease6_allocate(struct in6_addr *addrp, int lease_type)
|
|||||||
lease->addr6 = *addrp;
|
lease->addr6 = *addrp;
|
||||||
lease->flags |= lease_type;
|
lease->flags |= lease_type;
|
||||||
lease->iaid = 0;
|
lease->iaid = 0;
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_LEASES_ALLOCATED_6]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lease;
|
return lease;
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ static void log_write(void)
|
|||||||
logaddr.sun_len = sizeof(logaddr) - sizeof(logaddr.sun_path) + strlen(_PATH_LOG) + 1;
|
logaddr.sun_len = sizeof(logaddr) - sizeof(logaddr.sun_path) + strlen(_PATH_LOG) + 1;
|
||||||
#endif
|
#endif
|
||||||
logaddr.sun_family = AF_UNIX;
|
logaddr.sun_family = AF_UNIX;
|
||||||
strncpy(logaddr.sun_path, _PATH_LOG, sizeof(logaddr.sun_path));
|
safe_strncpy(logaddr.sun_path, _PATH_LOG, sizeof(logaddr.sun_path));
|
||||||
|
|
||||||
/* Got connection back? try again. */
|
/* Got connection back? try again. */
|
||||||
if (connect(log_fd, (struct sockaddr *)&logaddr, sizeof(logaddr)) != -1)
|
if (connect(log_fd, (struct sockaddr *)&logaddr, sizeof(logaddr)) != -1)
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/* dnsmasq is Copyright (c) 2000-2018 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
|
||||||
|
the Free Software Foundation; version 2 dated June, 1991, or
|
||||||
|
(at your option) version 3 dated 29 June, 2007.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dnsmasq.h"
|
||||||
|
|
||||||
|
const char * metric_names[] = {
|
||||||
|
"dns_cache_inserted",
|
||||||
|
"dns_cache_live_freed",
|
||||||
|
"dns_queries_forwarded",
|
||||||
|
"dns_auth_answered",
|
||||||
|
"dns_local_answered",
|
||||||
|
"bootp",
|
||||||
|
"pxe",
|
||||||
|
"dhcp_ack",
|
||||||
|
"dhcp_decline",
|
||||||
|
"dhcp_discover",
|
||||||
|
"dhcp_inform",
|
||||||
|
"dhcp_nak",
|
||||||
|
"dhcp_offer",
|
||||||
|
"dhcp_release",
|
||||||
|
"dhcp_request",
|
||||||
|
"noanswer",
|
||||||
|
"leases_allocated_4",
|
||||||
|
"leases_pruned_4",
|
||||||
|
"leases_allocated_6",
|
||||||
|
"leases_pruned_6",
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* get_metric_name(int i) {
|
||||||
|
return metric_names[i];
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/* dnsmasq is Copyright (c) 2000-2018 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
|
||||||
|
the Free Software Foundation; version 2 dated June, 1991, or
|
||||||
|
(at your option) version 3 dated 29 June, 2007.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* If you modify this list, please keep the labels in metrics.c in sync. */
|
||||||
|
enum {
|
||||||
|
METRIC_DNS_CACHE_INSERTED,
|
||||||
|
METRIC_DNS_CACHE_LIVE_FREED,
|
||||||
|
METRIC_DNS_QUERIES_FORWARDED,
|
||||||
|
METRIC_DNS_AUTH_ANSWERED,
|
||||||
|
METRIC_DNS_LOCAL_ANSWERED,
|
||||||
|
METRIC_BOOTP,
|
||||||
|
METRIC_PXE,
|
||||||
|
METRIC_DHCPACK,
|
||||||
|
METRIC_DHCPDECLINE,
|
||||||
|
METRIC_DHCPDISCOVER,
|
||||||
|
METRIC_DHCPINFORM,
|
||||||
|
METRIC_DHCPNAK,
|
||||||
|
METRIC_DHCPOFFER,
|
||||||
|
METRIC_DHCPRELEASE,
|
||||||
|
METRIC_DHCPREQUEST,
|
||||||
|
METRIC_NOANSWER,
|
||||||
|
METRIC_LEASES_ALLOCATED_4,
|
||||||
|
METRIC_LEASES_PRUNED_4,
|
||||||
|
METRIC_LEASES_ALLOCATED_6,
|
||||||
|
METRIC_LEASES_PRUNED_6,
|
||||||
|
|
||||||
|
__METRIC_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* get_metric_name(int);
|
||||||
+3
-3
@@ -149,10 +149,10 @@ int iface_enumerate(int family, void *parm, int (*callback)())
|
|||||||
struct rtgenmsg g;
|
struct rtgenmsg g;
|
||||||
} req;
|
} req;
|
||||||
|
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
memset(&addr, 0, sizeof(addr));
|
||||||
|
|
||||||
addr.nl_family = AF_NETLINK;
|
addr.nl_family = AF_NETLINK;
|
||||||
addr.nl_pad = 0;
|
|
||||||
addr.nl_groups = 0;
|
|
||||||
addr.nl_pid = 0; /* address to kernel */
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
if (family == AF_UNSPEC)
|
if (family == AF_UNSPEC)
|
||||||
|
|||||||
+6
-6
@@ -29,7 +29,7 @@ int indextoname(int fd, int index, char *name)
|
|||||||
if (ioctl(fd, SIOCGIFNAME, &ifr) == -1)
|
if (ioctl(fd, SIOCGIFNAME, &ifr) == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
strncpy(name, ifr.ifr_name, IF_NAMESIZE);
|
safe_strncpy(name, ifr.ifr_name, IF_NAMESIZE);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -82,12 +82,12 @@ int indextoname(int fd, int index, char *name)
|
|||||||
for (i = lifc.lifc_len / sizeof(struct lifreq); i; i--, lifrp++)
|
for (i = lifc.lifc_len / sizeof(struct lifreq); i; i--, lifrp++)
|
||||||
{
|
{
|
||||||
struct lifreq lifr;
|
struct lifreq lifr;
|
||||||
strncpy(lifr.lifr_name, lifrp->lifr_name, IF_NAMESIZE);
|
safe_strncpy(lifr.lifr_name, lifrp->lifr_name, IF_NAMESIZE);
|
||||||
if (ioctl(fd, SIOCGLIFINDEX, &lifr) < 0)
|
if (ioctl(fd, SIOCGLIFINDEX, &lifr) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (lifr.lifr_index == index) {
|
if (lifr.lifr_index == index) {
|
||||||
strncpy(name, lifr.lifr_name, IF_NAMESIZE);
|
safe_strncpy(name, lifr.lifr_name, IF_NAMESIZE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ int loopback_exception(int fd, int family, struct all_addr *addr, char *name)
|
|||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
struct irec *iface;
|
struct irec *iface;
|
||||||
|
|
||||||
strncpy(ifr.ifr_name, name, IF_NAMESIZE);
|
safe_strncpy(ifr.ifr_name, name, IF_NAMESIZE);
|
||||||
if (ioctl(fd, SIOCGIFFLAGS, &ifr) != -1 &&
|
if (ioctl(fd, SIOCGIFFLAGS, &ifr) != -1 &&
|
||||||
ifr.ifr_flags & IFF_LOOPBACK)
|
ifr.ifr_flags & IFF_LOOPBACK)
|
||||||
{
|
{
|
||||||
@@ -1286,7 +1286,7 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(sfd->interface, intname);
|
safe_strncpy(sfd->interface, intname, sizeof(sfd->interface));
|
||||||
sfd->source_addr = *addr;
|
sfd->source_addr = *addr;
|
||||||
sfd->next = daemon->sfds;
|
sfd->next = daemon->sfds;
|
||||||
sfd->ifindex = ifindex;
|
sfd->ifindex = ifindex;
|
||||||
@@ -1458,7 +1458,7 @@ void add_update_server(int flags,
|
|||||||
serv->flags |= SERV_HAS_DOMAIN;
|
serv->flags |= SERV_HAS_DOMAIN;
|
||||||
|
|
||||||
if (interface)
|
if (interface)
|
||||||
strcpy(serv->interface, interface);
|
safe_strncpy(serv->interface, interface, sizeof(serv->interface));
|
||||||
if (addr)
|
if (addr)
|
||||||
serv->addr = *addr;
|
serv->addr = *addr;
|
||||||
if (source_addr)
|
if (source_addr)
|
||||||
|
|||||||
+135
-75
@@ -161,6 +161,11 @@ struct myoption {
|
|||||||
#define LOPT_TFTP_MTU 349
|
#define LOPT_TFTP_MTU 349
|
||||||
#define LOPT_REPLY_DELAY 350
|
#define LOPT_REPLY_DELAY 350
|
||||||
#define LOPT_RAPID_COMMIT 351
|
#define LOPT_RAPID_COMMIT 351
|
||||||
|
#define LOPT_DUMPFILE 352
|
||||||
|
#define LOPT_DUMPMASK 353
|
||||||
|
#define LOPT_UBUS 354
|
||||||
|
#define LOPT_NAME_MATCH 355
|
||||||
|
#define LOPT_CAA 356
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
static const struct option opts[] =
|
static const struct option opts[] =
|
||||||
@@ -229,8 +234,10 @@ static const struct myoption opts[] =
|
|||||||
{ "srv-host", 1, 0, 'W' },
|
{ "srv-host", 1, 0, 'W' },
|
||||||
{ "localise-queries", 0, 0, 'y' },
|
{ "localise-queries", 0, 0, 'y' },
|
||||||
{ "txt-record", 1, 0, 'Y' },
|
{ "txt-record", 1, 0, 'Y' },
|
||||||
|
{ "caa-record", 1, 0 , LOPT_CAA },
|
||||||
{ "dns-rr", 1, 0, LOPT_RR },
|
{ "dns-rr", 1, 0, LOPT_RR },
|
||||||
{ "enable-dbus", 2, 0, '1' },
|
{ "enable-dbus", 2, 0, '1' },
|
||||||
|
{ "enable-ubus", 0, 0, LOPT_UBUS },
|
||||||
{ "bootp-dynamic", 2, 0, '3' },
|
{ "bootp-dynamic", 2, 0, '3' },
|
||||||
{ "dhcp-mac", 1, 0, '4' },
|
{ "dhcp-mac", 1, 0, '4' },
|
||||||
{ "no-ping", 0, 0, '5' },
|
{ "no-ping", 0, 0, '5' },
|
||||||
@@ -269,7 +276,8 @@ static const struct myoption opts[] =
|
|||||||
{ "stop-dns-rebind", 0, 0, LOPT_REBIND },
|
{ "stop-dns-rebind", 0, 0, LOPT_REBIND },
|
||||||
{ "rebind-domain-ok", 1, 0, LOPT_NO_REBIND },
|
{ "rebind-domain-ok", 1, 0, LOPT_NO_REBIND },
|
||||||
{ "all-servers", 0, 0, LOPT_NOLAST },
|
{ "all-servers", 0, 0, LOPT_NOLAST },
|
||||||
{ "dhcp-match", 1, 0, LOPT_MATCH },
|
{ "dhcp-match", 1, 0, LOPT_MATCH },
|
||||||
|
{ "dhcp-name-match", 1, 0, LOPT_NAME_MATCH },
|
||||||
{ "dhcp-broadcast", 2, 0, LOPT_BROADCAST },
|
{ "dhcp-broadcast", 2, 0, LOPT_BROADCAST },
|
||||||
{ "neg-ttl", 1, 0, LOPT_NEGTTL },
|
{ "neg-ttl", 1, 0, LOPT_NEGTTL },
|
||||||
{ "max-ttl", 1, 0, LOPT_MAXTTL },
|
{ "max-ttl", 1, 0, LOPT_MAXTTL },
|
||||||
@@ -327,6 +335,8 @@ static const struct myoption opts[] =
|
|||||||
{ "dhcp-ttl", 1, 0 , LOPT_DHCPTTL },
|
{ "dhcp-ttl", 1, 0 , LOPT_DHCPTTL },
|
||||||
{ "dhcp-reply-delay", 1, 0, LOPT_REPLY_DELAY },
|
{ "dhcp-reply-delay", 1, 0, LOPT_REPLY_DELAY },
|
||||||
{ "dhcp-rapid-commit", 0, 0, LOPT_RAPID_COMMIT },
|
{ "dhcp-rapid-commit", 0, 0, LOPT_RAPID_COMMIT },
|
||||||
|
{ "dumpfile", 1, 0, LOPT_DUMPFILE },
|
||||||
|
{ "dumpmask", 1, 0, LOPT_DUMPMASK },
|
||||||
{ NULL, 0, 0, 0 }
|
{ NULL, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -416,6 +426,7 @@ static struct {
|
|||||||
{ 'z', OPT_NOWILD, NULL, gettext_noop("Bind only to interfaces in use."), NULL },
|
{ 'z', OPT_NOWILD, NULL, gettext_noop("Bind only to interfaces in use."), NULL },
|
||||||
{ 'Z', OPT_ETHERS, NULL, gettext_noop("Read DHCP static host information from %s."), ETHERSFILE },
|
{ 'Z', OPT_ETHERS, NULL, gettext_noop("Read DHCP static host information from %s."), ETHERSFILE },
|
||||||
{ '1', ARG_ONE, "[=<busname>]", gettext_noop("Enable the DBus interface for setting upstream servers, etc."), NULL },
|
{ '1', ARG_ONE, "[=<busname>]", gettext_noop("Enable the DBus interface for setting upstream servers, etc."), NULL },
|
||||||
|
{ LOPT_UBUS, OPT_UBUS, NULL, gettext_noop("Enable the UBus interface."), NULL },
|
||||||
{ '2', ARG_DUP, "<interface>", gettext_noop("Do not provide DHCP on this interface, only provide DNS."), NULL },
|
{ '2', ARG_DUP, "<interface>", gettext_noop("Do not provide DHCP on this interface, only provide DNS."), NULL },
|
||||||
{ '3', ARG_DUP, "[=tag:<tag>]...", gettext_noop("Enable dynamic address allocation for bootp."), NULL },
|
{ '3', ARG_DUP, "[=tag:<tag>]...", gettext_noop("Enable dynamic address allocation for bootp."), NULL },
|
||||||
{ '4', ARG_DUP, "set:<tag>,<mac address>", gettext_noop("Map MAC address (with wildcards) to option set."), NULL },
|
{ '4', ARG_DUP, "set:<tag>,<mac address>", gettext_noop("Map MAC address (with wildcards) to option set."), NULL },
|
||||||
@@ -449,6 +460,7 @@ static struct {
|
|||||||
{ LOPT_NO_REBIND, ARG_DUP, "/<domain>/", gettext_noop("Inhibit DNS-rebind protection on this domain."), NULL },
|
{ LOPT_NO_REBIND, ARG_DUP, "/<domain>/", gettext_noop("Inhibit DNS-rebind protection on this domain."), NULL },
|
||||||
{ LOPT_NOLAST, OPT_ALL_SERVERS, NULL, gettext_noop("Always perform DNS queries to all servers."), NULL },
|
{ LOPT_NOLAST, OPT_ALL_SERVERS, NULL, gettext_noop("Always perform DNS queries to all servers."), NULL },
|
||||||
{ LOPT_MATCH, ARG_DUP, "set:<tag>,<optspec>", gettext_noop("Set tag if client includes matching option in request."), NULL },
|
{ LOPT_MATCH, ARG_DUP, "set:<tag>,<optspec>", gettext_noop("Set tag if client includes matching option in request."), NULL },
|
||||||
|
{ LOPT_NAME_MATCH, ARG_DUP, "set:<tag>,<string>[*]", gettext_noop("Set tag if client provides given name."), NULL },
|
||||||
{ LOPT_ALTPORT, ARG_ONE, "[=<ports>]", gettext_noop("Use alternative ports for DHCP."), NULL },
|
{ LOPT_ALTPORT, ARG_ONE, "[=<ports>]", gettext_noop("Use alternative ports for DHCP."), NULL },
|
||||||
{ LOPT_NAPTR, ARG_DUP, "<name>,<naptr>", gettext_noop("Specify NAPTR DNS record."), NULL },
|
{ LOPT_NAPTR, ARG_DUP, "<name>,<naptr>", gettext_noop("Specify NAPTR DNS record."), NULL },
|
||||||
{ LOPT_MINPORT, ARG_ONE, "<port>", gettext_noop("Specify lowest port available for DNS query transmission."), NULL },
|
{ LOPT_MINPORT, ARG_ONE, "<port>", gettext_noop("Specify lowest port available for DNS query transmission."), NULL },
|
||||||
@@ -471,6 +483,7 @@ static struct {
|
|||||||
{ LOPT_RA, OPT_RA, NULL, gettext_noop("Send router-advertisements for interfaces doing DHCPv6"), NULL },
|
{ LOPT_RA, OPT_RA, NULL, gettext_noop("Send router-advertisements for interfaces doing DHCPv6"), NULL },
|
||||||
{ LOPT_DUID, ARG_ONE, "<enterprise>,<duid>", gettext_noop("Specify DUID_EN-type DHCPv6 server DUID"), NULL },
|
{ LOPT_DUID, ARG_ONE, "<enterprise>,<duid>", gettext_noop("Specify DUID_EN-type DHCPv6 server DUID"), NULL },
|
||||||
{ LOPT_HOST_REC, ARG_DUP, "<name>,<address>[,<ttl>]", gettext_noop("Specify host (A/AAAA and PTR) records"), NULL },
|
{ LOPT_HOST_REC, ARG_DUP, "<name>,<address>[,<ttl>]", gettext_noop("Specify host (A/AAAA and PTR) records"), NULL },
|
||||||
|
{ LOPT_CAA, ARG_DUP, "<name>,<flags>,<tag>,<value>", gettext_noop("Specify certification authority authorization record"), NULL },
|
||||||
{ LOPT_RR, ARG_DUP, "<name>,<RR-number>,[<data>]", gettext_noop("Specify arbitrary DNS resource record"), NULL },
|
{ LOPT_RR, ARG_DUP, "<name>,<RR-number>,[<data>]", gettext_noop("Specify arbitrary DNS resource record"), NULL },
|
||||||
{ LOPT_CLVERBIND, OPT_CLEVERBIND, NULL, gettext_noop("Bind to interfaces in use - check for new interfaces"), NULL },
|
{ LOPT_CLVERBIND, OPT_CLEVERBIND, NULL, gettext_noop("Bind to interfaces in use - check for new interfaces"), NULL },
|
||||||
{ LOPT_AUTHSERV, ARG_ONE, "<NS>,<interface>", gettext_noop("Export local names to global DNS"), NULL },
|
{ LOPT_AUTHSERV, ARG_ONE, "<NS>,<interface>", gettext_noop("Export local names to global DNS"), NULL },
|
||||||
@@ -500,6 +513,8 @@ static struct {
|
|||||||
{ LOPT_DHCPTTL, ARG_ONE, "<ttl>", gettext_noop("Set TTL in DNS responses with DHCP-derived addresses."), NULL },
|
{ LOPT_DHCPTTL, ARG_ONE, "<ttl>", gettext_noop("Set TTL in DNS responses with DHCP-derived addresses."), NULL },
|
||||||
{ LOPT_REPLY_DELAY, ARG_ONE, "<integer>", gettext_noop("Delay DHCP replies for at least number of seconds."), NULL },
|
{ LOPT_REPLY_DELAY, ARG_ONE, "<integer>", gettext_noop("Delay DHCP replies for at least number of seconds."), NULL },
|
||||||
{ LOPT_RAPID_COMMIT, OPT_RAPID_COMMIT, NULL, gettext_noop("Enables DHCPv4 Rapid Commit option."), NULL },
|
{ LOPT_RAPID_COMMIT, OPT_RAPID_COMMIT, NULL, gettext_noop("Enables DHCPv4 Rapid Commit option."), NULL },
|
||||||
|
{ LOPT_DUMPFILE, ARG_ONE, "<path>", gettext_noop("Path to debug packet dump file"), NULL },
|
||||||
|
{ LOPT_DUMPMASK, ARG_ONE, "<hex>", gettext_noop("Mask which packets to dump"), NULL },
|
||||||
{ 0, 0, NULL, NULL, NULL }
|
{ 0, 0, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -795,7 +810,7 @@ char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_a
|
|||||||
if (interface_opt)
|
if (interface_opt)
|
||||||
{
|
{
|
||||||
#if defined(SO_BINDTODEVICE)
|
#if defined(SO_BINDTODEVICE)
|
||||||
strncpy(interface, interface_opt, IF_NAMESIZE - 1);
|
safe_strncpy(interface, interface_opt, IF_NAMESIZE);
|
||||||
#else
|
#else
|
||||||
return _("interface binding not supported");
|
return _("interface binding not supported");
|
||||||
#endif
|
#endif
|
||||||
@@ -824,7 +839,7 @@ char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_a
|
|||||||
return _("interface can only be specified once");
|
return _("interface can only be specified once");
|
||||||
|
|
||||||
source_addr->in.sin_addr.s_addr = INADDR_ANY;
|
source_addr->in.sin_addr.s_addr = INADDR_ANY;
|
||||||
strncpy(interface, source, IF_NAMESIZE - 1);
|
safe_strncpy(interface, source, IF_NAMESIZE);
|
||||||
#else
|
#else
|
||||||
return _("interface binding not supported");
|
return _("interface binding not supported");
|
||||||
#endif
|
#endif
|
||||||
@@ -859,7 +874,7 @@ char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_a
|
|||||||
return _("interface can only be specified once");
|
return _("interface can only be specified once");
|
||||||
|
|
||||||
source_addr->in6.sin6_addr = in6addr_any;
|
source_addr->in6.sin6_addr = in6addr_any;
|
||||||
strncpy(interface, source, IF_NAMESIZE - 1);
|
safe_strncpy(interface, source, IF_NAMESIZE);
|
||||||
#else
|
#else
|
||||||
return _("interface binding not supported");
|
return _("interface binding not supported");
|
||||||
#endif
|
#endif
|
||||||
@@ -1740,7 +1755,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'x': /* --pid-file */
|
case 'x': /* --pid-file */
|
||||||
daemon->runfile = opt_string_alloc(arg);
|
daemon->runfile = opt_string_alloc(arg);
|
||||||
break;
|
break;
|
||||||
@@ -1811,6 +1826,14 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
ret_err(_("bad MX target"));
|
ret_err(_("bad MX target"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LOPT_DUMPFILE: /* --dumpfile */
|
||||||
|
daemon->dump_file = opt_string_alloc(arg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LOPT_DUMPMASK: /* --dumpmask */
|
||||||
|
daemon->dump_mask = strtol(arg, NULL, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_DHCP
|
#ifdef HAVE_DHCP
|
||||||
case 'l': /* --dhcp-leasefile */
|
case 'l': /* --dhcp-leasefile */
|
||||||
daemon->lease_file = opt_string_alloc(arg);
|
daemon->lease_file = opt_string_alloc(arg);
|
||||||
@@ -1878,47 +1901,43 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_AUTH
|
|
||||||
case LOPT_AUTHSERV: /* --auth-server */
|
case LOPT_AUTHSERV: /* --auth-server */
|
||||||
if (!(comma = split(arg)))
|
comma = split(arg);
|
||||||
ret_err(gen_err);
|
|
||||||
|
|
||||||
daemon->authserver = opt_string_alloc(arg);
|
daemon->authserver = opt_string_alloc(arg);
|
||||||
arg = comma;
|
|
||||||
do {
|
while ((arg = comma))
|
||||||
struct iname *new = opt_malloc(sizeof(struct iname));
|
{
|
||||||
comma = split(arg);
|
struct iname *new = opt_malloc(sizeof(struct iname));
|
||||||
new->name = NULL;
|
comma = split(arg);
|
||||||
unhide_metas(arg);
|
new->name = NULL;
|
||||||
if (inet_pton(AF_INET, arg, &new->addr.in.sin_addr) > 0)
|
unhide_metas(arg);
|
||||||
new->addr.sa.sa_family = AF_INET;
|
if (inet_pton(AF_INET, arg, &new->addr.in.sin_addr) > 0)
|
||||||
|
new->addr.sa.sa_family = AF_INET;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
else if (inet_pton(AF_INET6, arg, &new->addr.in6.sin6_addr) > 0)
|
else if (inet_pton(AF_INET6, arg, &new->addr.in6.sin6_addr) > 0)
|
||||||
new->addr.sa.sa_family = AF_INET6;
|
new->addr.sa.sa_family = AF_INET6;
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *fam = split_chr(arg, '/');
|
char *fam = split_chr(arg, '/');
|
||||||
new->name = opt_string_alloc(arg);
|
new->name = opt_string_alloc(arg);
|
||||||
new->addr.sa.sa_family = 0;
|
new->addr.sa.sa_family = 0;
|
||||||
if (fam)
|
if (fam)
|
||||||
{
|
{
|
||||||
if (strcmp(fam, "4") == 0)
|
if (strcmp(fam, "4") == 0)
|
||||||
new->addr.sa.sa_family = AF_INET;
|
new->addr.sa.sa_family = AF_INET;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
else if (strcmp(fam, "6") == 0)
|
else if (strcmp(fam, "6") == 0)
|
||||||
new->addr.sa.sa_family = AF_INET6;
|
new->addr.sa.sa_family = AF_INET6;
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
ret_err(gen_err);
|
ret_err(gen_err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new->next = daemon->authinterface;
|
new->next = daemon->authinterface;
|
||||||
daemon->authinterface = new;
|
daemon->authinterface = new;
|
||||||
|
};
|
||||||
arg = comma;
|
|
||||||
} while (arg);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2054,7 +2073,6 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case 's': /* --domain */
|
case 's': /* --domain */
|
||||||
case LOPT_SYNTH: /* --synth-domain */
|
case LOPT_SYNTH: /* --synth-domain */
|
||||||
@@ -2215,7 +2233,9 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
char *star;
|
char *star;
|
||||||
new->next = daemon->synth_domains;
|
new->next = daemon->synth_domains;
|
||||||
daemon->synth_domains = new;
|
daemon->synth_domains = new;
|
||||||
if ((star = strrchr(new->prefix, '*')) && *(star+1) == 0)
|
if (new->prefix &&
|
||||||
|
(star = strrchr(new->prefix, '*'))
|
||||||
|
&& *(star+1) == 0)
|
||||||
{
|
{
|
||||||
*star = 0;
|
*star = 0;
|
||||||
new->indexed = 1;
|
new->indexed = 1;
|
||||||
@@ -2403,7 +2423,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
if (strcmp(arg, "#") == 0)
|
if (strcmp(arg, "#") == 0)
|
||||||
domain = "";
|
domain = "";
|
||||||
else if (strlen (arg) != 0 && !(domain = canonicalise_opt(arg)))
|
else if (strlen (arg) != 0 && !(domain = canonicalise_opt(arg)))
|
||||||
option = '?';
|
ret_err(gen_err);
|
||||||
serv = opt_malloc(sizeof(struct server));
|
serv = opt_malloc(sizeof(struct server));
|
||||||
memset(serv, 0, sizeof(struct server));
|
memset(serv, 0, sizeof(struct server));
|
||||||
serv->next = newlist;
|
serv->next = newlist;
|
||||||
@@ -2445,11 +2465,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(arg, "#") == 0)
|
else if (strcmp(arg, "#") == 0)
|
||||||
{
|
newlist->flags |= SERV_USE_RESOLV; /* treat in ordinary way */
|
||||||
newlist->flags |= SERV_USE_RESOLV; /* treat in ordinary way */
|
|
||||||
if (newlist->flags & SERV_LITERAL_ADDRESS)
|
|
||||||
ret_err(gen_err);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *err = parse_server(arg, &newlist->addr, &newlist->source_addr, newlist->interface, &newlist->flags);
|
char *err = parse_server(arg, &newlist->addr, &newlist->source_addr, newlist->interface, &newlist->flags);
|
||||||
@@ -2535,7 +2551,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
if (strcmp(arg, "#") == 0 || !*arg)
|
if (strcmp(arg, "#") == 0 || !*arg)
|
||||||
domain = "";
|
domain = "";
|
||||||
else if (strlen(arg) != 0 && !(domain = canonicalise_opt(arg)))
|
else if (strlen(arg) != 0 && !(domain = canonicalise_opt(arg)))
|
||||||
option = '?';
|
ret_err(gen_err);
|
||||||
ipsets->next = opt_malloc(sizeof(struct ipsets));
|
ipsets->next = opt_malloc(sizeof(struct ipsets));
|
||||||
ipsets = ipsets->next;
|
ipsets = ipsets->next;
|
||||||
memset(ipsets, 0, sizeof(struct ipsets));
|
memset(ipsets, 0, sizeof(struct ipsets));
|
||||||
@@ -2550,13 +2566,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
memset(ipsets, 0, sizeof(struct ipsets));
|
memset(ipsets, 0, sizeof(struct ipsets));
|
||||||
ipsets->domain = "";
|
ipsets->domain = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arg || !*arg)
|
if (!arg || !*arg)
|
||||||
{
|
ret_err(gen_err);
|
||||||
option = '?';
|
|
||||||
break;
|
for (size = 2, end = arg; *end; ++end)
|
||||||
}
|
|
||||||
size = 2;
|
|
||||||
for (end = arg; *end; ++end)
|
|
||||||
if (*end == ',')
|
if (*end == ',')
|
||||||
++size;
|
++size;
|
||||||
|
|
||||||
@@ -2589,8 +2603,6 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
|
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
size = 0;
|
size = 0;
|
||||||
else if (size > 10000)
|
|
||||||
size = 10000;
|
|
||||||
|
|
||||||
daemon->cachesize = size;
|
daemon->cachesize = size;
|
||||||
}
|
}
|
||||||
@@ -2786,12 +2798,6 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
memset (new, 0, sizeof(*new));
|
memset (new, 0, sizeof(*new));
|
||||||
new->lease_time = DEFLEASE;
|
new->lease_time = DEFLEASE;
|
||||||
|
|
||||||
if (!arg)
|
|
||||||
{
|
|
||||||
option = '?';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
for (cp = arg; *cp; cp++)
|
for (cp = arg; *cp; cp++)
|
||||||
@@ -3280,7 +3286,33 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
option == LOPT_FORCE ? DHOPT_FORCE :
|
option == LOPT_FORCE ? DHOPT_FORCE :
|
||||||
(option == LOPT_MATCH ? DHOPT_MATCH :
|
(option == LOPT_MATCH ? DHOPT_MATCH :
|
||||||
(option == LOPT_OPTS ? DHOPT_BANK : 0)));
|
(option == LOPT_OPTS ? DHOPT_BANK : 0)));
|
||||||
|
|
||||||
|
case LOPT_NAME_MATCH: /* --dhcp-name-match */
|
||||||
|
{
|
||||||
|
struct dhcp_match_name *new = opt_malloc(sizeof(struct dhcp_match_name));
|
||||||
|
struct dhcp_netid *id = opt_malloc(sizeof(struct dhcp_netid));
|
||||||
|
ssize_t len;
|
||||||
|
|
||||||
|
if (!(comma = split(arg)) || (len = strlen(comma)) == 0)
|
||||||
|
ret_err(gen_err);
|
||||||
|
|
||||||
|
new->wildcard = 0;
|
||||||
|
new->netid = id;
|
||||||
|
id->net = opt_string_alloc(set_prefix(arg));
|
||||||
|
|
||||||
|
if (comma[len-1] == '*')
|
||||||
|
{
|
||||||
|
comma[len-1] = 0;
|
||||||
|
new->wildcard = 1;
|
||||||
|
}
|
||||||
|
new->name = opt_string_alloc(comma);
|
||||||
|
|
||||||
|
new->next = daemon->dhcp_name_match;
|
||||||
|
daemon->dhcp_name_match = new;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'M': /* --dhcp-boot */
|
case 'M': /* --dhcp-boot */
|
||||||
{
|
{
|
||||||
struct dhcp_netid *id = NULL;
|
struct dhcp_netid *id = NULL;
|
||||||
@@ -3793,11 +3825,9 @@ err:
|
|||||||
|
|
||||||
if ((k < 2) ||
|
if ((k < 2) ||
|
||||||
(!(inet_pton(AF_INET, a[0], &new->in) > 0)) ||
|
(!(inet_pton(AF_INET, a[0], &new->in) > 0)) ||
|
||||||
(!(inet_pton(AF_INET, a[1], &new->out) > 0)))
|
(!(inet_pton(AF_INET, a[1], &new->out) > 0)) ||
|
||||||
option = '?';
|
(k == 3 && !inet_pton(AF_INET, a[2], &new->mask)))
|
||||||
|
ret_err(_("missing address in alias"));
|
||||||
if (k == 3 && !inet_pton(AF_INET, a[2], &new->mask))
|
|
||||||
option = '?';
|
|
||||||
|
|
||||||
if (dash &&
|
if (dash &&
|
||||||
(!(inet_pton(AF_INET, dash, &new->end) > 0) ||
|
(!(inet_pton(AF_INET, dash, &new->end) > 0) ||
|
||||||
@@ -3969,7 +3999,7 @@ err:
|
|||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
new->txt=opt_malloc(len);
|
new->txt = opt_malloc(len);
|
||||||
new->len = len;
|
new->len = len;
|
||||||
memcpy(new->txt, data, len);
|
memcpy(new->txt, data, len);
|
||||||
}
|
}
|
||||||
@@ -3977,6 +4007,37 @@ err:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LOPT_CAA: /* --caa-record */
|
||||||
|
{
|
||||||
|
struct txt_record *new;
|
||||||
|
char *tag, *value;
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
comma = split(arg);
|
||||||
|
tag = split(comma);
|
||||||
|
value = split(tag);
|
||||||
|
|
||||||
|
new = opt_malloc(sizeof(struct txt_record));
|
||||||
|
new->next = daemon->rr;
|
||||||
|
daemon->rr = new;
|
||||||
|
|
||||||
|
if (!atoi_check(comma, &flags) || !tag || !value || !(new->name = canonicalise_opt(arg)))
|
||||||
|
ret_err(_("bad CAA record"));
|
||||||
|
|
||||||
|
unhide_metas(tag);
|
||||||
|
unhide_metas(value);
|
||||||
|
|
||||||
|
new->len = strlen(tag) + strlen(value) + 2;
|
||||||
|
new->txt = opt_malloc(new->len);
|
||||||
|
new->txt[0] = flags;
|
||||||
|
new->txt[1] = strlen(tag);
|
||||||
|
memcpy(&new->txt[2], tag, strlen(tag));
|
||||||
|
memcpy(&new->txt[2 + strlen(tag)], value, strlen(value));
|
||||||
|
new->class = T_CAA;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'Y': /* --txt-record */
|
case 'Y': /* --txt-record */
|
||||||
{
|
{
|
||||||
struct txt_record *new;
|
struct txt_record *new;
|
||||||
@@ -4135,11 +4196,11 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
case LOPT_DNSSEC_STAMP:
|
case LOPT_DNSSEC_STAMP: /* --dnssec-timestamp */
|
||||||
daemon->timestamp_file = opt_string_alloc(arg);
|
daemon->timestamp_file = opt_string_alloc(arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOPT_DNSSEC_CHECK:
|
case LOPT_DNSSEC_CHECK: /* --dnssec-check-unsigned */
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
if (strcmp(arg, "no") == 0)
|
if (strcmp(arg, "no") == 0)
|
||||||
@@ -4149,7 +4210,7 @@ err:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOPT_TRUST_ANCHOR:
|
case LOPT_TRUST_ANCHOR: /* --trust-anchor */
|
||||||
{
|
{
|
||||||
struct ds_config *new = opt_malloc(sizeof(struct ds_config));
|
struct ds_config *new = opt_malloc(sizeof(struct ds_config));
|
||||||
char *cp, *cp1, *keyhex, *digest, *algo = NULL;
|
char *cp, *cp1, *keyhex, *digest, *algo = NULL;
|
||||||
@@ -4334,7 +4395,7 @@ static void read_file(char *file, FILE *f, int hard_opt)
|
|||||||
if (errmess)
|
if (errmess)
|
||||||
strcpy(daemon->namebuff, errmess);
|
strcpy(daemon->namebuff, errmess);
|
||||||
|
|
||||||
if (errmess || !one_opt(option, arg, buff, _("error"), 0, hard_opt == LOPT_REV_SERV))
|
if (errmess || !one_opt(option, arg, daemon->namebuff, _("error"), 0, hard_opt == LOPT_REV_SERV))
|
||||||
{
|
{
|
||||||
sprintf(daemon->namebuff + strlen(daemon->namebuff), _(" at line %d of %s"), lineno, file);
|
sprintf(daemon->namebuff + strlen(daemon->namebuff), _(" at line %d of %s"), lineno, file);
|
||||||
if (hard_opt != 0)
|
if (hard_opt != 0)
|
||||||
@@ -4738,8 +4799,7 @@ void read_opts(int argc, char **argv, char *compile_opts)
|
|||||||
argbuf_size = strlen(optarg) + 1;
|
argbuf_size = strlen(optarg) + 1;
|
||||||
argbuf = opt_malloc(argbuf_size);
|
argbuf = opt_malloc(argbuf_size);
|
||||||
}
|
}
|
||||||
strncpy(argbuf, optarg, argbuf_size);
|
safe_strncpy(argbuf, optarg, argbuf_size);
|
||||||
argbuf[argbuf_size-1] = 0;
|
|
||||||
arg = argbuf;
|
arg = argbuf;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+52
-41
@@ -788,6 +788,7 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
|
|||||||
newc->addr.cname.uid = 1;
|
newc->addr.cname.uid = 1;
|
||||||
if (cpp)
|
if (cpp)
|
||||||
{
|
{
|
||||||
|
next_uid(newc);
|
||||||
cpp->addr.cname.target.cache = newc;
|
cpp->addr.cname.target.cache = newc;
|
||||||
cpp->addr.cname.uid = newc->uid;
|
cpp->addr.cname.uid = newc->uid;
|
||||||
}
|
}
|
||||||
@@ -844,6 +845,7 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
|
|||||||
newc = cache_insert(name, &addr, now, attl, flags | F_FORWARD | secflag);
|
newc = cache_insert(name, &addr, now, attl, flags | F_FORWARD | secflag);
|
||||||
if (newc && cpp)
|
if (newc && cpp)
|
||||||
{
|
{
|
||||||
|
next_uid(newc);
|
||||||
cpp->addr.cname.target.cache = newc;
|
cpp->addr.cname.target.cache = newc;
|
||||||
cpp->addr.cname.uid = newc->uid;
|
cpp->addr.cname.uid = newc->uid;
|
||||||
}
|
}
|
||||||
@@ -870,6 +872,7 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
|
|||||||
newc = cache_insert(name, NULL, now, ttl ? ttl : cttl, F_FORWARD | F_NEG | flags | (secure ? F_DNSSECOK : 0));
|
newc = cache_insert(name, NULL, now, ttl ? ttl : cttl, F_FORWARD | F_NEG | flags | (secure ? F_DNSSECOK : 0));
|
||||||
if (newc && cpp)
|
if (newc && cpp)
|
||||||
{
|
{
|
||||||
|
next_uid(newc);
|
||||||
cpp->addr.cname.target.cache = newc;
|
cpp->addr.cname.target.cache = newc;
|
||||||
cpp->addr.cname.uid = newc->uid;
|
cpp->addr.cname.uid = newc->uid;
|
||||||
}
|
}
|
||||||
@@ -926,12 +929,11 @@ unsigned int extract_request(struct dns_header *header, size_t qlen, char *name,
|
|||||||
return F_QUERY;
|
return F_QUERY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t setup_reply(struct dns_header *header, size_t qlen,
|
size_t setup_reply(struct dns_header *header, size_t qlen,
|
||||||
struct all_addr *addrp, unsigned int flags, unsigned long ttl)
|
struct all_addr *addrp, unsigned int flags, unsigned long ttl)
|
||||||
{
|
{
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
|
|
||||||
if (!(p = skip_questions(header, qlen)))
|
if (!(p = skip_questions(header, qlen)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -948,66 +950,75 @@ size_t setup_reply(struct dns_header *header, size_t qlen,
|
|||||||
else if (flags == F_NXDOMAIN)
|
else if (flags == F_NXDOMAIN)
|
||||||
SET_RCODE(header, NXDOMAIN);
|
SET_RCODE(header, NXDOMAIN);
|
||||||
else if (flags == F_SERVFAIL)
|
else if (flags == F_SERVFAIL)
|
||||||
SET_RCODE(header, SERVFAIL);
|
|
||||||
else if (flags == F_IPV4)
|
|
||||||
{ /* we know the address */
|
|
||||||
SET_RCODE(header, NOERROR);
|
|
||||||
header->ancount = htons(1);
|
|
||||||
header->hb3 |= HB3_AA;
|
|
||||||
add_resource_record(header, NULL, NULL, sizeof(struct dns_header), &p, ttl, NULL, T_A, C_IN, "4", addrp);
|
|
||||||
}
|
|
||||||
#ifdef HAVE_IPV6
|
|
||||||
else if (flags == F_IPV6)
|
|
||||||
{
|
{
|
||||||
SET_RCODE(header, NOERROR);
|
struct all_addr a;
|
||||||
header->ancount = htons(1);
|
a.addr.rcode.rcode = SERVFAIL;
|
||||||
header->hb3 |= HB3_AA;
|
log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
|
||||||
add_resource_record(header, NULL, NULL, sizeof(struct dns_header), &p, ttl, NULL, T_AAAA, C_IN, "6", addrp);
|
SET_RCODE(header, SERVFAIL);
|
||||||
}
|
}
|
||||||
|
else if (flags & ( F_IPV4 | F_IPV6))
|
||||||
|
{
|
||||||
|
if (flags & F_IPV4)
|
||||||
|
{ /* we know the address */
|
||||||
|
SET_RCODE(header, NOERROR);
|
||||||
|
header->ancount = htons(1);
|
||||||
|
header->hb3 |= HB3_AA;
|
||||||
|
add_resource_record(header, NULL, NULL, sizeof(struct dns_header), &p, ttl, NULL, T_A, C_IN, "4", addrp);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
if (flags & F_IPV6)
|
||||||
|
{
|
||||||
|
SET_RCODE(header, NOERROR);
|
||||||
|
header->ancount = htons(ntohs(header->ancount) + 1);
|
||||||
|
header->hb3 |= HB3_AA;
|
||||||
|
add_resource_record(header, NULL, NULL, sizeof(struct dns_header), &p, ttl, NULL, T_AAAA, C_IN, "6", addrp);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
else /* nowhere to forward to */
|
else /* nowhere to forward to */
|
||||||
SET_RCODE(header, REFUSED);
|
{
|
||||||
|
struct all_addr a;
|
||||||
|
a.addr.rcode.rcode = REFUSED;
|
||||||
|
log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
|
||||||
|
SET_RCODE(header, REFUSED);
|
||||||
|
}
|
||||||
|
|
||||||
return p - (unsigned char *)header;
|
return p - (unsigned char *)header;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if name matches local names ie from /etc/hosts or DHCP or local mx names. */
|
/* check if name matches local names ie from /etc/hosts or DHCP or local mx names. */
|
||||||
int check_for_local_domain(char *name, time_t now)
|
int check_for_local_domain(char *name, time_t now)
|
||||||
{
|
{
|
||||||
struct crec *crecp;
|
|
||||||
struct mx_srv_record *mx;
|
struct mx_srv_record *mx;
|
||||||
struct txt_record *txt;
|
struct txt_record *txt;
|
||||||
struct interface_name *intr;
|
struct interface_name *intr;
|
||||||
struct ptr_record *ptr;
|
struct ptr_record *ptr;
|
||||||
struct naptr *naptr;
|
struct naptr *naptr;
|
||||||
|
|
||||||
/* Note: the call to cache_find_by_name is intended to find any record which matches
|
|
||||||
ie A, AAAA, CNAME. */
|
|
||||||
|
|
||||||
if ((crecp = cache_find_by_name(NULL, name, now, F_IPV4 | F_IPV6 | F_CNAME | F_NO_RR)) &&
|
|
||||||
(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
for (naptr = daemon->naptr; naptr; naptr = naptr->next)
|
for (naptr = daemon->naptr; naptr; naptr = naptr->next)
|
||||||
if (hostname_isequal(name, naptr->name))
|
if (hostname_issubdomain(name, naptr->name))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (mx = daemon->mxnames; mx; mx = mx->next)
|
for (mx = daemon->mxnames; mx; mx = mx->next)
|
||||||
if (hostname_isequal(name, mx->name))
|
if (hostname_issubdomain(name, mx->name))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (txt = daemon->txt; txt; txt = txt->next)
|
for (txt = daemon->txt; txt; txt = txt->next)
|
||||||
if (hostname_isequal(name, txt->name))
|
if (hostname_issubdomain(name, txt->name))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (intr = daemon->int_names; intr; intr = intr->next)
|
for (intr = daemon->int_names; intr; intr = intr->next)
|
||||||
if (hostname_isequal(name, intr->name))
|
if (hostname_issubdomain(name, intr->name))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (ptr = daemon->ptr; ptr; ptr = ptr->next)
|
for (ptr = daemon->ptr; ptr; ptr = ptr->next)
|
||||||
if (hostname_isequal(name, ptr->name))
|
if (hostname_issubdomain(name, ptr->name))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (cache_find_non_terminal(name, now))
|
||||||
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1282,16 +1293,14 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
|||||||
struct mx_srv_record *rec;
|
struct mx_srv_record *rec;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (ntohs(header->ancount) != 0 ||
|
/* never answer queries with RD unset, to avoid cache snooping. */
|
||||||
|
if (!(header->hb3 & HB3_RD) ||
|
||||||
|
ntohs(header->ancount) != 0 ||
|
||||||
ntohs(header->nscount) != 0 ||
|
ntohs(header->nscount) != 0 ||
|
||||||
ntohs(header->qdcount) == 0 ||
|
ntohs(header->qdcount) == 0 ||
|
||||||
OPCODE(header) != QUERY )
|
OPCODE(header) != QUERY )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* always servfail queries with RD unset, to avoid cache snooping. */
|
|
||||||
if (!(header->hb3 & HB3_RD))
|
|
||||||
return setup_reply(header, qlen, NULL, F_SERVFAIL, 0);
|
|
||||||
|
|
||||||
/* Don't return AD set if checking disabled. */
|
/* Don't return AD set if checking disabled. */
|
||||||
if (header->hb4 & HB4_CD)
|
if (header->hb4 & HB4_CD)
|
||||||
sec_data = 0;
|
sec_data = 0;
|
||||||
@@ -1370,11 +1379,11 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
|||||||
sec_data = 0;
|
sec_data = 0;
|
||||||
if (!dryrun)
|
if (!dryrun)
|
||||||
{
|
{
|
||||||
log_query(F_CONFIG | F_RRNAME, name, NULL, "<RR>");
|
log_query(F_CONFIG | F_RRNAME, name, NULL, querystr(NULL, t->class));
|
||||||
if (add_resource_record(header, limit, &trunc, nameoffset, &ansp,
|
if (add_resource_record(header, limit, &trunc, nameoffset, &ansp,
|
||||||
daemon->local_ttl, NULL,
|
daemon->local_ttl, NULL,
|
||||||
t->class, C_IN, "t", t->len, t->txt))
|
t->class, C_IN, "t", t->len, t->txt))
|
||||||
anscount ++;
|
anscount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1654,7 +1663,9 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the client asked for DNSSEC don't use cached data. */
|
/* If the client asked for DNSSEC don't use cached data. */
|
||||||
if ((crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)) || !do_bit || !(crecp->flags & F_DNSSECOK))
|
if ((crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)) ||
|
||||||
|
!do_bit ||
|
||||||
|
(option_bool(OPT_DNSSEC_VALID) && !(crecp->flags & F_DNSSECOK)))
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* don't answer wildcard queries with data not from /etc/hosts
|
/* don't answer wildcard queries with data not from /etc/hosts
|
||||||
@@ -1738,7 +1749,7 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
|||||||
{
|
{
|
||||||
if ((crecp = cache_find_by_name(NULL, name, now, F_CNAME | (dryrun ? F_NO_RR : 0))) &&
|
if ((crecp = cache_find_by_name(NULL, name, now, F_CNAME | (dryrun ? F_NO_RR : 0))) &&
|
||||||
(qtype == T_CNAME || (crecp->flags & F_CONFIG)) &&
|
(qtype == T_CNAME || (crecp->flags & F_CONFIG)) &&
|
||||||
((crecp->flags & F_CONFIG) || !do_bit || !(crecp->flags & F_DNSSECOK)))
|
((crecp->flags & F_CONFIG) || !do_bit || (option_bool(OPT_DNSSEC_VALID) && !(crecp->flags & F_DNSSECOK))))
|
||||||
{
|
{
|
||||||
if (!(crecp->flags & F_DNSSECOK))
|
if (!(crecp->flags & F_DNSSECOK))
|
||||||
sec_data = 0;
|
sec_data = 0;
|
||||||
|
|||||||
+53
-6
@@ -626,6 +626,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_BOOTP]++;
|
||||||
log_packet("BOOTP", logaddr, mess->chaddr, mess->hlen, iface_name, NULL, message, mess->xid);
|
log_packet("BOOTP", logaddr, mess->chaddr, mess->hlen, iface_name, NULL, message, mess->xid);
|
||||||
|
|
||||||
return message ? 0 : dhcp_packet_size(mess, agent_id, real_end);
|
return message ? 0 : dhcp_packet_size(mess, agent_id, real_end);
|
||||||
@@ -701,6 +702,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
|
|
||||||
if (client_hostname && option_bool(OPT_LOG_OPTS))
|
if (client_hostname && option_bool(OPT_LOG_OPTS))
|
||||||
my_syslog(MS_DHCP | LOG_INFO, _("%u client provides name: %s"), ntohl(mess->xid), client_hostname);
|
my_syslog(MS_DHCP | LOG_INFO, _("%u client provides name: %s"), ntohl(mess->xid), client_hostname);
|
||||||
|
|
||||||
|
|
||||||
if (have_config(config, CONFIG_NAME))
|
if (have_config(config, CONFIG_NAME))
|
||||||
{
|
{
|
||||||
@@ -713,11 +715,15 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
}
|
}
|
||||||
else if (client_hostname)
|
else if (client_hostname)
|
||||||
{
|
{
|
||||||
|
struct dhcp_match_name *m;
|
||||||
|
size_t nl;
|
||||||
|
|
||||||
domain = strip_hostname(client_hostname);
|
domain = strip_hostname(client_hostname);
|
||||||
|
|
||||||
if (strlen(client_hostname) != 0)
|
if ((nl = strlen(client_hostname)) != 0)
|
||||||
{
|
{
|
||||||
hostname = client_hostname;
|
hostname = client_hostname;
|
||||||
|
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
/* Search again now we have a hostname.
|
/* Search again now we have a hostname.
|
||||||
@@ -735,6 +741,30 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
netid = &known_id;
|
netid = &known_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (m = daemon->dhcp_name_match; m; m = m->next)
|
||||||
|
{
|
||||||
|
size_t ml = strlen(m->name);
|
||||||
|
char save = 0;
|
||||||
|
|
||||||
|
if (nl < ml)
|
||||||
|
continue;
|
||||||
|
if (nl > ml)
|
||||||
|
{
|
||||||
|
save = client_hostname[ml];
|
||||||
|
client_hostname[ml] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hostname_isequal(client_hostname, m->name) &&
|
||||||
|
(save == 0 || m->wildcard))
|
||||||
|
{
|
||||||
|
m->netid->next = netid;
|
||||||
|
netid = m->netid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (save != 0)
|
||||||
|
client_hostname[ml] = save;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -917,7 +947,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
mess->siaddr = a_record_from_hosts(boot->tftp_sname, now);
|
mess->siaddr = a_record_from_hosts(boot->tftp_sname, now);
|
||||||
|
|
||||||
if (boot->file)
|
if (boot->file)
|
||||||
strncpy((char *)mess->file, boot->file, sizeof(mess->file)-1);
|
safe_strncpy((char *)mess->file, boot->file, sizeof(mess->file));
|
||||||
}
|
}
|
||||||
|
|
||||||
option_put(mess, end, OPTION_MESSAGE_TYPE, 1,
|
option_put(mess, end, OPTION_MESSAGE_TYPE, 1,
|
||||||
@@ -928,6 +958,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
if ((pxe && !workaround) || !redirect4011)
|
if ((pxe && !workaround) || !redirect4011)
|
||||||
do_encap_opts(pxe_opts(pxearch, tagif_netid, tmp->local, now), OPTION_VENDOR_CLASS_OPT, DHOPT_VENDOR_MATCH, mess, end, 0);
|
do_encap_opts(pxe_opts(pxearch, tagif_netid, tmp->local, now), OPTION_VENDOR_CLASS_OPT, DHOPT_VENDOR_MATCH, mess, end, 0);
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_PXE]++;
|
||||||
log_packet("PXE", NULL, emac, emac_len, iface_name, ignore ? "proxy-ignored" : "proxy", NULL, mess->xid);
|
log_packet("PXE", NULL, emac, emac_len, iface_name, ignore ? "proxy-ignored" : "proxy", NULL, mess->xid);
|
||||||
log_tags(tagif_netid, ntohl(mess->xid));
|
log_tags(tagif_netid, ntohl(mess->xid));
|
||||||
if (!ignore)
|
if (!ignore)
|
||||||
@@ -962,6 +993,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
if (!(opt = option_find(mess, sz, OPTION_REQUESTED_IP, INADDRSZ)))
|
if (!(opt = option_find(mess, sz, OPTION_REQUESTED_IP, INADDRSZ)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_DHCPDECLINE]++;
|
||||||
log_packet("DHCPDECLINE", option_ptr(opt, 0), emac, emac_len, iface_name, NULL, daemon->dhcp_buff, mess->xid);
|
log_packet("DHCPDECLINE", option_ptr(opt, 0), emac, emac_len, iface_name, NULL, daemon->dhcp_buff, mess->xid);
|
||||||
|
|
||||||
if (lease && lease->addr.s_addr == option_addr(opt).s_addr)
|
if (lease && lease->addr.s_addr == option_addr(opt).s_addr)
|
||||||
@@ -994,6 +1026,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
else
|
else
|
||||||
message = _("unknown lease");
|
message = _("unknown lease");
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_DHCPRELEASE]++;
|
||||||
log_packet("DHCPRELEASE", &mess->ciaddr, emac, emac_len, iface_name, NULL, message, mess->xid);
|
log_packet("DHCPRELEASE", &mess->ciaddr, emac, emac_len, iface_name, NULL, message, mess->xid);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1060,6 +1093,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
message = _("no address available");
|
message = _("no address available");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_DHCPDISCOVER]++;
|
||||||
log_packet("DHCPDISCOVER", opt ? option_ptr(opt, 0) : NULL, emac, emac_len, iface_name, NULL, message, mess->xid);
|
log_packet("DHCPDISCOVER", opt ? option_ptr(opt, 0) : NULL, emac, emac_len, iface_name, NULL, message, mess->xid);
|
||||||
|
|
||||||
if (message || !(context = narrow_context(context, mess->yiaddr, tagif_netid)))
|
if (message || !(context = narrow_context(context, mess->yiaddr, tagif_netid)))
|
||||||
@@ -1080,6 +1114,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
goto rapid_commit;
|
goto rapid_commit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_DHCPOFFER]++;
|
||||||
log_packet("DHCPOFFER" , &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
log_packet("DHCPOFFER" , &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
||||||
|
|
||||||
time = calc_time(context, config, option_find(mess, sz, OPTION_LEASE_TIME, 4));
|
time = calc_time(context, config, option_find(mess, sz, OPTION_LEASE_TIME, 4));
|
||||||
@@ -1192,6 +1227,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
mess->yiaddr = mess->ciaddr;
|
mess->yiaddr = mess->ciaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_DHCPREQUEST]++;
|
||||||
log_packet("DHCPREQUEST", &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
log_packet("DHCPREQUEST", &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
||||||
|
|
||||||
rapid_commit:
|
rapid_commit:
|
||||||
@@ -1265,6 +1301,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
|
|
||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
|
daemon->metrics[rapid_commit ? METRIC_NOANSWER : METRIC_DHCPNAK]++;
|
||||||
log_packet(rapid_commit ? "NOANSWER" : "DHCPNAK", &mess->yiaddr, emac, emac_len, iface_name, NULL, message, mess->xid);
|
log_packet(rapid_commit ? "NOANSWER" : "DHCPNAK", &mess->yiaddr, emac, emac_len, iface_name, NULL, message, mess->xid);
|
||||||
|
|
||||||
/* rapid commit case: lease allocate failed but don't send DHCPNAK */
|
/* rapid commit case: lease allocate failed but don't send DHCPNAK */
|
||||||
@@ -1426,6 +1463,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
else
|
else
|
||||||
override = lease->override;
|
override = lease->override;
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_DHCPACK]++;
|
||||||
log_packet("DHCPACK", &mess->yiaddr, emac, emac_len, iface_name, hostname, NULL, mess->xid);
|
log_packet("DHCPACK", &mess->yiaddr, emac, emac_len, iface_name, hostname, NULL, mess->xid);
|
||||||
|
|
||||||
clear_packet(mess, end);
|
clear_packet(mess, end);
|
||||||
@@ -1444,6 +1482,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
if (ignore || have_config(config, CONFIG_DISABLE))
|
if (ignore || have_config(config, CONFIG_DISABLE))
|
||||||
message = _("ignored");
|
message = _("ignored");
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_DHCPINFORM]++;
|
||||||
log_packet("DHCPINFORM", &mess->ciaddr, emac, emac_len, iface_name, message, NULL, mess->xid);
|
log_packet("DHCPINFORM", &mess->ciaddr, emac, emac_len, iface_name, message, NULL, mess->xid);
|
||||||
|
|
||||||
if (message || mess->ciaddr.s_addr == 0)
|
if (message || mess->ciaddr.s_addr == 0)
|
||||||
@@ -1470,6 +1509,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
|
|
||||||
log_tags(tagif_netid, ntohl(mess->xid));
|
log_tags(tagif_netid, ntohl(mess->xid));
|
||||||
|
|
||||||
|
daemon->metrics[METRIC_DHCPACK]++;
|
||||||
log_packet("DHCPACK", &mess->ciaddr, emac, emac_len, iface_name, hostname, NULL, mess->xid);
|
log_packet("DHCPACK", &mess->ciaddr, emac, emac_len, iface_name, hostname, NULL, mess->xid);
|
||||||
|
|
||||||
if (lease)
|
if (lease)
|
||||||
@@ -1636,6 +1676,13 @@ static void log_packet(char *type, void *addr, unsigned char *ext_mac,
|
|||||||
daemon->namebuff,
|
daemon->namebuff,
|
||||||
string ? string : "",
|
string ? string : "",
|
||||||
err ? err : "");
|
err ? err : "");
|
||||||
|
|
||||||
|
#ifdef HAVE_UBUS
|
||||||
|
if (!strcmp(type, "DHCPACK"))
|
||||||
|
ubus_event_bcast("dhcp.ack", daemon->namebuff, addr ? inet_ntoa(a) : NULL, string ? string : NULL, interface);
|
||||||
|
else if (!strcmp(type, "DHCPRELEASE"))
|
||||||
|
ubus_event_bcast("dhcp.release", daemon->namebuff, addr ? inet_ntoa(a) : NULL, string ? string : NULL, interface);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_options(unsigned char *start, u32 xid)
|
static void log_options(unsigned char *start, u32 xid)
|
||||||
@@ -2311,7 +2358,7 @@ static void do_options(struct dhcp_context *context,
|
|||||||
in_list(req_options, OPTION_SNAME))
|
in_list(req_options, OPTION_SNAME))
|
||||||
option_put_string(mess, end, OPTION_SNAME, boot->sname, 1);
|
option_put_string(mess, end, OPTION_SNAME, boot->sname, 1);
|
||||||
else
|
else
|
||||||
strncpy((char *)mess->sname, boot->sname, sizeof(mess->sname)-1);
|
safe_strncpy((char *)mess->sname, boot->sname, sizeof(mess->sname));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boot->file)
|
if (boot->file)
|
||||||
@@ -2321,7 +2368,7 @@ static void do_options(struct dhcp_context *context,
|
|||||||
in_list(req_options, OPTION_FILENAME))
|
in_list(req_options, OPTION_FILENAME))
|
||||||
option_put_string(mess, end, OPTION_FILENAME, boot->file, 1);
|
option_put_string(mess, end, OPTION_FILENAME, boot->file, 1);
|
||||||
else
|
else
|
||||||
strncpy((char *)mess->file, boot->file, sizeof(mess->file)-1);
|
safe_strncpy((char *)mess->file, boot->file, sizeof(mess->file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boot->next_server.s_addr)
|
if (boot->next_server.s_addr)
|
||||||
@@ -2338,14 +2385,14 @@ static void do_options(struct dhcp_context *context,
|
|||||||
if ((!req_options || !in_list(req_options, OPTION_FILENAME)) &&
|
if ((!req_options || !in_list(req_options, OPTION_FILENAME)) &&
|
||||||
(opt = option_find2(OPTION_FILENAME)) && !(opt->flags & DHOPT_FORCE))
|
(opt = option_find2(OPTION_FILENAME)) && !(opt->flags & DHOPT_FORCE))
|
||||||
{
|
{
|
||||||
strncpy((char *)mess->file, (char *)opt->val, sizeof(mess->file)-1);
|
safe_strncpy((char *)mess->file, (char *)opt->val, sizeof(mess->file));
|
||||||
done_file = 1;
|
done_file = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!req_options || !in_list(req_options, OPTION_SNAME)) &&
|
if ((!req_options || !in_list(req_options, OPTION_SNAME)) &&
|
||||||
(opt = option_find2(OPTION_SNAME)) && !(opt->flags & DHOPT_FORCE))
|
(opt = option_find2(OPTION_SNAME)) && !(opt->flags & DHOPT_FORCE))
|
||||||
{
|
{
|
||||||
strncpy((char *)mess->sname, (char *)opt->val, sizeof(mess->sname)-1);
|
safe_strncpy((char *)mess->sname, (char *)opt->val, sizeof(mess->sname));
|
||||||
done_server = 1;
|
done_server = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+90
-42
@@ -496,11 +496,16 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
}
|
}
|
||||||
else if (state->client_hostname)
|
else if (state->client_hostname)
|
||||||
{
|
{
|
||||||
|
struct dhcp_match_name *m;
|
||||||
|
size_t nl;
|
||||||
|
|
||||||
state->domain = strip_hostname(state->client_hostname);
|
state->domain = strip_hostname(state->client_hostname);
|
||||||
|
nl = strlen(state->client_hostname);
|
||||||
|
|
||||||
if (strlen(state->client_hostname) != 0)
|
if (strlen(state->client_hostname) != 0)
|
||||||
{
|
{
|
||||||
state->hostname = state->client_hostname;
|
state->hostname = state->client_hostname;
|
||||||
|
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
/* Search again now we have a hostname.
|
/* Search again now we have a hostname.
|
||||||
@@ -510,6 +515,30 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
if (new && !have_config(new, CONFIG_CLID) && !new->hwaddr)
|
if (new && !have_config(new, CONFIG_CLID) && !new->hwaddr)
|
||||||
config = new;
|
config = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (m = daemon->dhcp_name_match; m; m = m->next)
|
||||||
|
{
|
||||||
|
size_t ml = strlen(m->name);
|
||||||
|
char save = 0;
|
||||||
|
|
||||||
|
if (nl < ml)
|
||||||
|
continue;
|
||||||
|
if (nl > ml)
|
||||||
|
{
|
||||||
|
save = state->client_hostname[ml];
|
||||||
|
state->client_hostname[ml] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hostname_isequal(state->client_hostname, m->name) &&
|
||||||
|
(save == 0 || m->wildcard))
|
||||||
|
{
|
||||||
|
m->netid->next = state->tags;
|
||||||
|
state->tags = m->netid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (save != 0)
|
||||||
|
state->client_hostname[ml] = save;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -639,9 +668,8 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
int plain_range = 1;
|
int plain_range = 1;
|
||||||
u32 lease_time;
|
u32 lease_time;
|
||||||
struct dhcp_lease *ltmp;
|
struct dhcp_lease *ltmp;
|
||||||
struct in6_addr *req_addr;
|
struct in6_addr req_addr, addr;
|
||||||
struct in6_addr addr;
|
|
||||||
|
|
||||||
if (!check_ia(state, opt, &ia_end, &ia_option))
|
if (!check_ia(state, opt, &ia_end, &ia_option))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -709,9 +737,10 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
|
|
||||||
for (ia_counter = 0; ia_option; ia_counter++, ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
for (ia_counter = 0; ia_option; ia_counter++, ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
||||||
{
|
{
|
||||||
req_addr = opt6_ptr(ia_option, 0);
|
/* worry about alignment here. */
|
||||||
|
memcpy(&req_addr, opt6_ptr(ia_option, 0), IN6ADDRSZ);
|
||||||
|
|
||||||
if ((c = address6_valid(state->context, req_addr, solicit_tags, plain_range)))
|
if ((c = address6_valid(state->context, &req_addr, solicit_tags, plain_range)))
|
||||||
{
|
{
|
||||||
lease_time = c->lease_time;
|
lease_time = c->lease_time;
|
||||||
/* If the client asks for an address on the same network as a configured address,
|
/* If the client asks for an address on the same network as a configured address,
|
||||||
@@ -719,14 +748,14 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
addresses automatic. */
|
addresses automatic. */
|
||||||
if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, c, &addr) && check_address(state, &addr))
|
if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, c, &addr) && check_address(state, &addr))
|
||||||
{
|
{
|
||||||
req_addr = &addr;
|
req_addr = addr;
|
||||||
mark_config_used(c, &addr);
|
mark_config_used(c, &addr);
|
||||||
if (have_config(config, CONFIG_TIME))
|
if (have_config(config, CONFIG_TIME))
|
||||||
lease_time = config->lease_time;
|
lease_time = config->lease_time;
|
||||||
}
|
}
|
||||||
else if (!(c = address6_available(state->context, req_addr, solicit_tags, plain_range)))
|
else if (!(c = address6_available(state->context, &req_addr, solicit_tags, plain_range)))
|
||||||
continue; /* not an address we're allowed */
|
continue; /* not an address we're allowed */
|
||||||
else if (!check_address(state, req_addr))
|
else if (!check_address(state, &req_addr))
|
||||||
continue; /* address leased elsewhere */
|
continue; /* address leased elsewhere */
|
||||||
|
|
||||||
/* add address to output packet */
|
/* add address to output packet */
|
||||||
@@ -734,8 +763,8 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
if (dump_all_prefix_classes && state->ia_type == OPTION6_IA_NA)
|
if (dump_all_prefix_classes && state->ia_type == OPTION6_IA_NA)
|
||||||
state->send_prefix_class = prefix_class_from_context(c);
|
state->send_prefix_class = prefix_class_from_context(c);
|
||||||
#endif
|
#endif
|
||||||
add_address(state, c, lease_time, ia_option, &min_time, req_addr, now);
|
add_address(state, c, lease_time, ia_option, &min_time, &req_addr, now);
|
||||||
mark_context_used(state, req_addr);
|
mark_context_used(state, &req_addr);
|
||||||
get_context_tag(state, c);
|
get_context_tag(state, c);
|
||||||
address_assigned = 1;
|
address_assigned = 1;
|
||||||
}
|
}
|
||||||
@@ -768,15 +797,15 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
ltmp = NULL;
|
ltmp = NULL;
|
||||||
while ((ltmp = lease6_find_by_client(ltmp, state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, state->clid, state->clid_len, state->iaid)))
|
while ((ltmp = lease6_find_by_client(ltmp, state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, state->clid, state->clid_len, state->iaid)))
|
||||||
{
|
{
|
||||||
req_addr = <mp->addr6;
|
req_addr = ltmp->addr6;
|
||||||
if ((c = address6_available(state->context, req_addr, solicit_tags, plain_range)))
|
if ((c = address6_available(state->context, &req_addr, solicit_tags, plain_range)))
|
||||||
{
|
{
|
||||||
#ifdef OPTION6_PREFIX_CLASS
|
#ifdef OPTION6_PREFIX_CLASS
|
||||||
if (dump_all_prefix_classes && state->ia_type == OPTION6_IA_NA)
|
if (dump_all_prefix_classes && state->ia_type == OPTION6_IA_NA)
|
||||||
state->send_prefix_class = prefix_class_from_context(c);
|
state->send_prefix_class = prefix_class_from_context(c);
|
||||||
#endif
|
#endif
|
||||||
add_address(state, c, c->lease_time, NULL, &min_time, req_addr, now);
|
add_address(state, c, c->lease_time, NULL, &min_time, &req_addr, now);
|
||||||
mark_context_used(state, req_addr);
|
mark_context_used(state, &req_addr);
|
||||||
get_context_tag(state, c);
|
get_context_tag(state, c);
|
||||||
address_assigned = 1;
|
address_assigned = 1;
|
||||||
}
|
}
|
||||||
@@ -892,16 +921,19 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
|
|
||||||
for (; ia_option; ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
for (; ia_option; ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
||||||
{
|
{
|
||||||
struct in6_addr *req_addr = opt6_ptr(ia_option, 0);
|
struct in6_addr req_addr;
|
||||||
struct dhcp_context *dynamic, *c;
|
struct dhcp_context *dynamic, *c;
|
||||||
unsigned int lease_time;
|
unsigned int lease_time;
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
int config_ok = 0;
|
int config_ok = 0;
|
||||||
|
|
||||||
|
/* align. */
|
||||||
|
memcpy(&req_addr, opt6_ptr(ia_option, 0), IN6ADDRSZ);
|
||||||
|
|
||||||
if ((c = address6_valid(state->context, req_addr, tagif, 1)))
|
if ((c = address6_valid(state->context, &req_addr, tagif, 1)))
|
||||||
config_ok = config_valid(config, c, &addr) && IN6_ARE_ADDR_EQUAL(&addr, req_addr);
|
config_ok = config_valid(config, c, &addr) && IN6_ARE_ADDR_EQUAL(&addr, &req_addr);
|
||||||
|
|
||||||
if ((dynamic = address6_available(state->context, req_addr, tagif, 1)) || c)
|
if ((dynamic = address6_available(state->context, &req_addr, tagif, 1)) || c)
|
||||||
{
|
{
|
||||||
if (!dynamic && !config_ok)
|
if (!dynamic && !config_ok)
|
||||||
{
|
{
|
||||||
@@ -911,7 +943,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
put_opt6_string(_("address unavailable"));
|
put_opt6_string(_("address unavailable"));
|
||||||
end_opt6(o1);
|
end_opt6(o1);
|
||||||
}
|
}
|
||||||
else if (!check_address(state, req_addr))
|
else if (!check_address(state, &req_addr))
|
||||||
{
|
{
|
||||||
/* Address leased to another DUID/IAID */
|
/* Address leased to another DUID/IAID */
|
||||||
o1 = new_opt6(OPTION6_STATUS_CODE);
|
o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||||
@@ -933,7 +965,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
if (dump_all_prefix_classes && state->ia_type == OPTION6_IA_NA)
|
if (dump_all_prefix_classes && state->ia_type == OPTION6_IA_NA)
|
||||||
state->send_prefix_class = prefix_class_from_context(c);
|
state->send_prefix_class = prefix_class_from_context(c);
|
||||||
#endif
|
#endif
|
||||||
add_address(state, dynamic, lease_time, ia_option, &min_time, req_addr, now);
|
add_address(state, dynamic, lease_time, ia_option, &min_time, &req_addr, now);
|
||||||
get_context_tag(state, dynamic);
|
get_context_tag(state, dynamic);
|
||||||
address_assigned = 1;
|
address_assigned = 1;
|
||||||
}
|
}
|
||||||
@@ -996,15 +1028,17 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
for (; ia_option; ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
for (; ia_option; ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
||||||
{
|
{
|
||||||
struct dhcp_lease *lease = NULL;
|
struct dhcp_lease *lease = NULL;
|
||||||
struct in6_addr *req_addr = opt6_ptr(ia_option, 0);
|
struct in6_addr req_addr;
|
||||||
unsigned int preferred_time = opt6_uint(ia_option, 16, 4);
|
unsigned int preferred_time = opt6_uint(ia_option, 16, 4);
|
||||||
unsigned int valid_time = opt6_uint(ia_option, 20, 4);
|
unsigned int valid_time = opt6_uint(ia_option, 20, 4);
|
||||||
char *message = NULL;
|
char *message = NULL;
|
||||||
struct dhcp_context *this_context;
|
struct dhcp_context *this_context;
|
||||||
|
|
||||||
|
memcpy(&req_addr, opt6_ptr(ia_option, 0), IN6ADDRSZ);
|
||||||
|
|
||||||
if (!(lease = lease6_find(state->clid, state->clid_len,
|
if (!(lease = lease6_find(state->clid, state->clid_len,
|
||||||
state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA,
|
state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA,
|
||||||
state->iaid, req_addr)))
|
state->iaid, &req_addr)))
|
||||||
{
|
{
|
||||||
/* If the server cannot find a client entry for the IA the server
|
/* If the server cannot find a client entry for the IA the server
|
||||||
returns the IA containing no addresses with a Status Code option set
|
returns the IA containing no addresses with a Status Code option set
|
||||||
@@ -1012,7 +1046,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
save_counter(iacntr);
|
save_counter(iacntr);
|
||||||
t1cntr = 0;
|
t1cntr = 0;
|
||||||
|
|
||||||
log6_packet(state, "DHCPREPLY", req_addr, _("lease not found"));
|
log6_packet(state, "DHCPREPLY", &req_addr, _("lease not found"));
|
||||||
|
|
||||||
o1 = new_opt6(OPTION6_STATUS_CODE);
|
o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||||
put_opt6_short(DHCP6NOBINDING);
|
put_opt6_short(DHCP6NOBINDING);
|
||||||
@@ -1024,15 +1058,15 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((this_context = address6_available(state->context, req_addr, tagif, 1)) ||
|
if ((this_context = address6_available(state->context, &req_addr, tagif, 1)) ||
|
||||||
(this_context = address6_valid(state->context, req_addr, tagif, 1)))
|
(this_context = address6_valid(state->context, &req_addr, tagif, 1)))
|
||||||
{
|
{
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
unsigned int lease_time;
|
unsigned int lease_time;
|
||||||
|
|
||||||
get_context_tag(state, this_context);
|
get_context_tag(state, this_context);
|
||||||
|
|
||||||
if (config_valid(config, this_context, &addr) && IN6_ARE_ADDR_EQUAL(&addr, req_addr) && have_config(config, CONFIG_TIME))
|
if (config_valid(config, this_context, &addr) && IN6_ARE_ADDR_EQUAL(&addr, &req_addr) && have_config(config, CONFIG_TIME))
|
||||||
lease_time = config->lease_time;
|
lease_time = config->lease_time;
|
||||||
else
|
else
|
||||||
lease_time = this_context->lease_time;
|
lease_time = this_context->lease_time;
|
||||||
@@ -1045,7 +1079,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
lease_set_hwaddr(lease, state->mac, state->clid, state->mac_len, state->mac_type, state->clid_len, now, 0);
|
lease_set_hwaddr(lease, state->mac, state->clid, state->mac_len, state->mac_type, state->clid_len, now, 0);
|
||||||
if (state->ia_type == OPTION6_IA_NA && state->hostname)
|
if (state->ia_type == OPTION6_IA_NA && state->hostname)
|
||||||
{
|
{
|
||||||
char *addr_domain = get_domain6(req_addr);
|
char *addr_domain = get_domain6(&req_addr);
|
||||||
if (!state->send_domain)
|
if (!state->send_domain)
|
||||||
state->send_domain = addr_domain;
|
state->send_domain = addr_domain;
|
||||||
lease_set_hostname(lease, state->hostname, state->hostname_auth, addr_domain, state->domain);
|
lease_set_hostname(lease, state->hostname, state->hostname_auth, addr_domain, state->domain);
|
||||||
@@ -1063,12 +1097,12 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (message && (message != state->hostname))
|
if (message && (message != state->hostname))
|
||||||
log6_packet(state, "DHCPREPLY", req_addr, message);
|
log6_packet(state, "DHCPREPLY", &req_addr, message);
|
||||||
else
|
else
|
||||||
log6_quiet(state, "DHCPREPLY", req_addr, message);
|
log6_quiet(state, "DHCPREPLY", &req_addr, message);
|
||||||
|
|
||||||
o1 = new_opt6(OPTION6_IAADDR);
|
o1 = new_opt6(OPTION6_IAADDR);
|
||||||
put_opt6(req_addr, sizeof(*req_addr));
|
put_opt6(&req_addr, sizeof(req_addr));
|
||||||
put_opt6_long(preferred_time);
|
put_opt6_long(preferred_time);
|
||||||
put_opt6_long(valid_time);
|
put_opt6_long(valid_time);
|
||||||
end_opt6(o1);
|
end_opt6(o1);
|
||||||
@@ -1100,19 +1134,23 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
ia_option;
|
ia_option;
|
||||||
ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
||||||
{
|
{
|
||||||
struct in6_addr *req_addr = opt6_ptr(ia_option, 0);
|
struct in6_addr req_addr;
|
||||||
|
|
||||||
|
/* alignment */
|
||||||
|
memcpy(&req_addr, opt6_ptr(ia_option, 0), IN6ADDRSZ);
|
||||||
|
|
||||||
if (!address6_valid(state->context, req_addr, tagif, 1))
|
if (!address6_valid(state->context, &req_addr, tagif, 1))
|
||||||
{
|
{
|
||||||
o1 = new_opt6(OPTION6_STATUS_CODE);
|
o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||||
put_opt6_short(DHCP6NOTONLINK);
|
put_opt6_short(DHCP6NOTONLINK);
|
||||||
put_opt6_string(_("confirm failed"));
|
put_opt6_string(_("confirm failed"));
|
||||||
end_opt6(o1);
|
end_opt6(o1);
|
||||||
|
log6_quiet(state, "DHCPREPLY", &req_addr, _("confirm failed"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
good_addr = 1;
|
good_addr = 1;
|
||||||
log6_quiet(state, "DHCPREPLY", req_addr, state->hostname);
|
log6_quiet(state, "DHCPREPLY", &req_addr, state->hostname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1171,9 +1209,12 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
||||||
{
|
{
|
||||||
struct dhcp_lease *lease;
|
struct dhcp_lease *lease;
|
||||||
|
struct in6_addr addr;
|
||||||
|
|
||||||
|
/* align */
|
||||||
|
memcpy(&addr, opt6_ptr(ia_option, 0), IN6ADDRSZ);
|
||||||
if ((lease = lease6_find(state->clid, state->clid_len, state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA,
|
if ((lease = lease6_find(state->clid, state->clid_len, state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA,
|
||||||
state->iaid, opt6_ptr(ia_option, 0))))
|
state->iaid, &addr)))
|
||||||
lease_prune(lease, now);
|
lease_prune(lease, now);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1190,7 +1231,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
}
|
}
|
||||||
|
|
||||||
o1 = new_opt6(OPTION6_IAADDR);
|
o1 = new_opt6(OPTION6_IAADDR);
|
||||||
put_opt6(opt6_ptr(ia_option, 0), IN6ADDRSZ);
|
put_opt6(&addr, IN6ADDRSZ);
|
||||||
put_opt6_long(0);
|
put_opt6_long(0);
|
||||||
put_opt6_long(0);
|
put_opt6_long(0);
|
||||||
end_opt6(o1);
|
end_opt6(o1);
|
||||||
@@ -1233,12 +1274,15 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
ia_option = opt6_find(opt6_next(ia_option, ia_end), ia_end, OPTION6_IAADDR, 24))
|
||||||
{
|
{
|
||||||
struct dhcp_lease *lease;
|
struct dhcp_lease *lease;
|
||||||
struct in6_addr *addrp = opt6_ptr(ia_option, 0);
|
struct in6_addr addr;
|
||||||
|
|
||||||
if (have_config(config, CONFIG_ADDR6) && IN6_ARE_ADDR_EQUAL(&config->addr6, addrp))
|
/* align */
|
||||||
|
memcpy(&addr, opt6_ptr(ia_option, 0), IN6ADDRSZ);
|
||||||
|
|
||||||
|
if (have_config(config, CONFIG_ADDR6) && IN6_ARE_ADDR_EQUAL(&config->addr6, &addr))
|
||||||
{
|
{
|
||||||
prettyprint_time(daemon->dhcp_buff3, DECLINE_BACKOFF);
|
prettyprint_time(daemon->dhcp_buff3, DECLINE_BACKOFF);
|
||||||
inet_ntop(AF_INET6, addrp, daemon->addrbuff, ADDRSTRLEN);
|
inet_ntop(AF_INET6, &addr, daemon->addrbuff, ADDRSTRLEN);
|
||||||
my_syslog(MS_DHCP | LOG_WARNING, _("disabling DHCP static address %s for %s"),
|
my_syslog(MS_DHCP | LOG_WARNING, _("disabling DHCP static address %s for %s"),
|
||||||
daemon->addrbuff, daemon->dhcp_buff3);
|
daemon->addrbuff, daemon->dhcp_buff3);
|
||||||
config->flags |= CONFIG_DECLINED;
|
config->flags |= CONFIG_DECLINED;
|
||||||
@@ -1250,7 +1294,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
context_tmp->addr_epoch++;
|
context_tmp->addr_epoch++;
|
||||||
|
|
||||||
if ((lease = lease6_find(state->clid, state->clid_len, state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA,
|
if ((lease = lease6_find(state->clid, state->clid_len, state->ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA,
|
||||||
state->iaid, opt6_ptr(ia_option, 0))))
|
state->iaid, &addr)))
|
||||||
lease_prune(lease, now);
|
lease_prune(lease, now);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1267,7 +1311,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
|||||||
}
|
}
|
||||||
|
|
||||||
o1 = new_opt6(OPTION6_IAADDR);
|
o1 = new_opt6(OPTION6_IAADDR);
|
||||||
put_opt6(opt6_ptr(ia_option, 0), IN6ADDRSZ);
|
put_opt6(&addr, IN6ADDRSZ);
|
||||||
put_opt6_long(0);
|
put_opt6_long(0);
|
||||||
put_opt6_long(0);
|
put_opt6_long(0);
|
||||||
end_opt6(o1);
|
end_opt6(o1);
|
||||||
@@ -1935,7 +1979,11 @@ static void log6_opts(int nest, unsigned int xid, void *start_opts, void *end_op
|
|||||||
}
|
}
|
||||||
else if (type == OPTION6_IAADDR)
|
else if (type == OPTION6_IAADDR)
|
||||||
{
|
{
|
||||||
inet_ntop(AF_INET6, opt6_ptr(opt, 0), daemon->addrbuff, ADDRSTRLEN);
|
struct in6_addr addr;
|
||||||
|
|
||||||
|
/* align */
|
||||||
|
memcpy(&addr, opt6_ptr(opt, 0), IN6ADDRSZ);
|
||||||
|
inet_ntop(AF_INET6, &addr, daemon->addrbuff, ADDRSTRLEN);
|
||||||
sprintf(daemon->namebuff, "%s PL=%u VL=%u",
|
sprintf(daemon->namebuff, "%s PL=%u VL=%u",
|
||||||
daemon->addrbuff, opt6_uint(opt, 16, 4), opt6_uint(opt, 20, 4));
|
daemon->addrbuff, opt6_uint(opt, 16, 4), opt6_uint(opt, 20, 4));
|
||||||
optname = "iaaddr";
|
optname = "iaaddr";
|
||||||
|
|||||||
+2
-1
@@ -166,7 +166,8 @@ time_t periodic_slaac(time_t now, struct dhcp_lease *leases)
|
|||||||
|
|
||||||
if (sendto(daemon->icmp6fd, daemon->outpacket.iov_base, save_counter(-1), 0,
|
if (sendto(daemon->icmp6fd, daemon->outpacket.iov_base, save_counter(-1), 0,
|
||||||
(struct sockaddr *)&addr, sizeof(addr)) == -1 &&
|
(struct sockaddr *)&addr, sizeof(addr)) == -1 &&
|
||||||
errno == EHOSTUNREACH)
|
errno == EHOSTUNREACH &&
|
||||||
|
slaac->backoff == 12)
|
||||||
slaac->ping_time = 0; /* Give up */
|
slaac->ping_time = 0; /* Give up */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -234,7 +234,7 @@ void tftp_request(struct listener *listen, time_t now)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(ifr.ifr_name, name, IF_NAMESIZE);
|
safe_strncpy(ifr.ifr_name, name, IF_NAMESIZE);
|
||||||
if (ioctl(listen->tftpfd, SIOCGIFMTU, &ifr) != -1)
|
if (ioctl(listen->tftpfd, SIOCGIFMTU, &ifr) != -1)
|
||||||
{
|
{
|
||||||
mtu = ifr.ifr_mtu;
|
mtu = ifr.ifr_mtu;
|
||||||
|
|||||||
+107
@@ -0,0 +1,107 @@
|
|||||||
|
/* dnsmasq is Copyright (c) 2000-2018 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
|
||||||
|
the Free Software Foundation; version 2 dated June, 1991, or
|
||||||
|
(at your option) version 3 dated 29 June, 2007.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dnsmasq.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UBUS
|
||||||
|
|
||||||
|
#include <libubus.h>
|
||||||
|
|
||||||
|
static struct ubus_context *ubus = NULL;
|
||||||
|
static struct blob_buf b;
|
||||||
|
|
||||||
|
static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj,
|
||||||
|
struct ubus_request_data *req, const char *method,
|
||||||
|
struct blob_attr *msg);
|
||||||
|
static struct ubus_method ubus_object_methods[] = {
|
||||||
|
{.name = "metrics", .handler = ubus_handle_metrics},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct ubus_object_type ubus_object_type = UBUS_OBJECT_TYPE("dnsmasq", ubus_object_methods);
|
||||||
|
|
||||||
|
static struct ubus_object ubus_object = {
|
||||||
|
.name = "dnsmasq",
|
||||||
|
.type = &ubus_object_type,
|
||||||
|
.methods = ubus_object_methods,
|
||||||
|
.n_methods = ARRAY_SIZE(ubus_object_methods),
|
||||||
|
};
|
||||||
|
|
||||||
|
void set_ubus_listeners()
|
||||||
|
{
|
||||||
|
if (!ubus)
|
||||||
|
return;
|
||||||
|
|
||||||
|
poll_listen(ubus->sock.fd, POLLIN);
|
||||||
|
poll_listen(ubus->sock.fd, POLLERR);
|
||||||
|
poll_listen(ubus->sock.fd, POLLHUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
void check_ubus_listeners()
|
||||||
|
{
|
||||||
|
if (!ubus)
|
||||||
|
{
|
||||||
|
ubus = ubus_connect(NULL);
|
||||||
|
if (!ubus)
|
||||||
|
return;
|
||||||
|
ubus_add_object(ubus, &ubus_object);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (poll_check(ubus->sock.fd, POLLIN))
|
||||||
|
ubus_handle_event(ubus);
|
||||||
|
|
||||||
|
if (poll_check(ubus->sock.fd, POLLHUP))
|
||||||
|
{
|
||||||
|
ubus_free(ubus);
|
||||||
|
ubus = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj,
|
||||||
|
struct ubus_request_data *req, const char *method,
|
||||||
|
struct blob_attr *msg)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
blob_buf_init(&b, 0);
|
||||||
|
|
||||||
|
for(i=0; i < __METRIC_MAX; i++)
|
||||||
|
blobmsg_add_u32(&b, get_metric_name(i), daemon->metrics[i]);
|
||||||
|
|
||||||
|
ubus_send_reply(ctx, req, b.head);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface)
|
||||||
|
{
|
||||||
|
if (!ubus || !ubus_object.has_subscribers)
|
||||||
|
return;
|
||||||
|
|
||||||
|
blob_buf_init(&b, 0);
|
||||||
|
if (mac)
|
||||||
|
blobmsg_add_string(&b, "mac", mac);
|
||||||
|
if (ip)
|
||||||
|
blobmsg_add_string(&b, "ip", ip);
|
||||||
|
if (name)
|
||||||
|
blobmsg_add_string(&b, "name", name);
|
||||||
|
if (interface)
|
||||||
|
blobmsg_add_string(&b, "interface", interface);
|
||||||
|
|
||||||
|
ubus_notify(ubus, &ubus_object, type, b.head, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HAVE_UBUS */
|
||||||
+50
-1
@@ -281,7 +281,18 @@ void *safe_malloc(size_t size)
|
|||||||
die(_("could not get memory"), NULL, EC_NOMEM);
|
die(_("could not get memory"), NULL, EC_NOMEM);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ensure limited size string is always terminated.
|
||||||
|
* Can be replaced by (void)strlcpy() on some platforms */
|
||||||
|
void safe_strncpy(char *dest, const char *src, size_t size)
|
||||||
|
{
|
||||||
|
if (size != 0)
|
||||||
|
{
|
||||||
|
dest[size-1] = '\0';
|
||||||
|
strncpy(dest, src, size-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void safe_pipe(int *fd, int read_noblock)
|
void safe_pipe(int *fd, int read_noblock)
|
||||||
{
|
{
|
||||||
@@ -355,6 +366,44 @@ int hostname_isequal(const char *a, const char *b)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* is b equal to or a subdomain of a return 2 for equal, 1 for subdomain */
|
||||||
|
int hostname_issubdomain(char *a, char *b)
|
||||||
|
{
|
||||||
|
char *ap, *bp;
|
||||||
|
unsigned int c1, c2;
|
||||||
|
|
||||||
|
/* move to the end */
|
||||||
|
for (ap = a; *ap; ap++);
|
||||||
|
for (bp = b; *bp; bp++);
|
||||||
|
|
||||||
|
/* a shorter than b or a empty. */
|
||||||
|
if ((bp - b) < (ap - a) || ap == a)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
c1 = (unsigned char) *(--ap);
|
||||||
|
c2 = (unsigned char) *(--bp);
|
||||||
|
|
||||||
|
if (c1 >= 'A' && c1 <= 'Z')
|
||||||
|
c1 += 'a' - 'A';
|
||||||
|
if (c2 >= 'A' && c2 <= 'Z')
|
||||||
|
c2 += 'a' - 'A';
|
||||||
|
|
||||||
|
if (c1 != c2)
|
||||||
|
return 0;
|
||||||
|
} while (ap != a);
|
||||||
|
|
||||||
|
if (bp == b)
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
if (*(--bp) == '.')
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
time_t dnsmasq_time(void)
|
time_t dnsmasq_time(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_BROKEN_RTC
|
#ifdef HAVE_BROKEN_RTC
|
||||||
|
|||||||
Reference in new issue
Block a user