Compare commits
26 Commits
v2.80test4
...
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 |
17
CHANGELOG
17
CHANGELOG
@@ -52,8 +52,23 @@ version 2.80
|
||||
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
|
||||
Fix parsing of CNAME arguments, which are confused by extra spaces.
|
||||
Thanks to Diego Aguirre for spotting the bug.
|
||||
|
||||
@@ -83,7 +83,7 @@ static unsigned char *option_find1(unsigned char *p, unsigned char *end, int opt
|
||||
if (p >= end - 2)
|
||||
return NULL; /* malformed packet */
|
||||
opt_len = option_len(p);
|
||||
if (p >= end - (2 + opt_len))
|
||||
if (end - p >= (2 + opt_len))
|
||||
return NULL; /* malformed packet */
|
||||
if (*p == opt && opt_len >= minsize)
|
||||
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
|
||||
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)
|
||||
{
|
||||
perror("cannot setup interface");
|
||||
|
||||
@@ -376,9 +376,12 @@ int send_release_packet(const char* iface, struct dhcp6_packet* packet)
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
close(sock);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
close(sock);
|
||||
fprintf(stderr, "Response timed out\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
9
debian/changelog
vendored
9
debian/changelog
vendored
@@ -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
|
||||
|
||||
* New upstream. (closes: #888200)
|
||||
|
||||
3
debian/init
vendored
3
debian/init
vendored
@@ -127,7 +127,8 @@ start()
|
||||
mkdir /run/dnsmasq || return 2
|
||||
chown dnsmasq:nogroup /run/dnsmasq || return 2
|
||||
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 -- \
|
||||
-x /run/dnsmasq/$NAME.pid \
|
||||
|
||||
2
debian/rules
vendored
2
debian/rules
vendored
@@ -169,6 +169,7 @@ binary-indep: checkroot
|
||||
-d debian/trees/daemon/usr/share/dnsmasq \
|
||||
-d debian/trees/daemon/etc/default \
|
||||
-d debian/trees/daemon/lib/systemd/system \
|
||||
-d debian/trees/daemon/usr/lib/tmpfiles.d \
|
||||
-d debian/trees/daemon/etc/insserv.conf.d
|
||||
install -m 644 debian/conffiles 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 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/tmpfiles.conf debian/trees/daemon/usr/lib/tmpfiles.d/dnsmasq.conf
|
||||
install -m 644 debian/insserv debian/trees/daemon/etc/insserv.conf.d/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
|
||||
|
||||
1
debian/tmpfiles.conf
vendored
Normal file
1
debian/tmpfiles.conf
vendored
Normal file
@@ -0,0 +1 @@
|
||||
d /run/dnsmasq 755 dnsmasq nogroup
|
||||
@@ -672,3 +672,8 @@
|
||||
|
||||
# Include all files in a directory which end in .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
|
||||
|
||||
@@ -27,7 +27,7 @@ TFTP server to allow net/PXE boot of DHCP hosts and also supports BOOTP. The PXE
|
||||
.PP
|
||||
The dnsmasq DHCPv6 server provides the same set of features as the
|
||||
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.
|
||||
.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.
|
||||
@@ -156,7 +156,7 @@ can be over-ridden with this switch.
|
||||
.TP
|
||||
.B \-g, --group=<groupname>
|
||||
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.
|
||||
.TP
|
||||
.B \-v, --version
|
||||
@@ -231,7 +231,7 @@ options always override the others. The comments about interface labels for
|
||||
.B --listen-address
|
||||
apply here.
|
||||
.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
|
||||
need not be mentioned in
|
||||
.B --interface
|
||||
@@ -244,7 +244,7 @@ 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
|
||||
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
|
||||
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
|
||||
.B --local-service
|
||||
Accept DNS queries only from hosts whose address is on a local subnet,
|
||||
@@ -510,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
|
||||
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
|
||||
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
|
||||
.B --ipset=/<domain>[/<domain>...]/<ipset>[,<ipset>...]
|
||||
Places the resolved IP addresses of queries for one or more domains in
|
||||
@@ -822,7 +827,8 @@ authoritative zones as dnsmasq.
|
||||
.B --auth-peer=<ip-address>[,<ip-address>[,<ip-address>...]]
|
||||
Specify the addresses of secondary servers which are allowed to
|
||||
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,
|
||||
then AXFR requests will be
|
||||
accepted from any secondary. Specifying
|
||||
.B --auth-peer
|
||||
without
|
||||
|
||||
79
po/de.po
79
po/de.po
@@ -9,18 +9,18 @@
|
||||
# Simon Kelley <simon@thekelleys.org.uk>, 2005.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dnsmasq 2.77\n"
|
||||
"Project-Id-Version: dnsmasq 2.80\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-06-18 12:24+0100\n"
|
||||
"PO-Revision-Date: 2017-07-17 18:30+0100\n"
|
||||
"Last-Translator: Conrad Kostecki <ck@conrad-kostecki.de>\n"
|
||||
"PO-Revision-Date: 2018-09-29 00:13+0200\n"
|
||||
"Last-Translator: Conrad Kostecki <conrad@kostecki.com>\n"
|
||||
"Language-Team: German <de@li.org>\n"
|
||||
"Language: de\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\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"
|
||||
|
||||
#: cache.c:518
|
||||
@@ -150,7 +150,7 @@ msgstr "Konfigurationsdatei festlegen (Voreinstellung: %s)."
|
||||
|
||||
#: option.c:350
|
||||
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
|
||||
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
|
||||
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"
|
||||
#: option.c:355
|
||||
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
|
||||
#, c-format
|
||||
@@ -314,7 +314,7 @@ msgstr "Ausgehenden Port erzwingen für DNS-Anfragen an vorgelagerte Server."
|
||||
|
||||
#: option.c:389
|
||||
msgid "Do NOT read resolv.conf."
|
||||
msgstr "resolv.conf NICHT lesen."
|
||||
msgstr "Die resolv.conf NICHT lesen."
|
||||
|
||||
#: option.c:390
|
||||
#, c-format
|
||||
@@ -323,7 +323,7 @@ msgstr "Pfad zu resolv.conf festlegen (%s voreingestellt)."
|
||||
|
||||
#: option.c:391
|
||||
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
|
||||
msgid "Specify address(es) of upstream servers with optional domains."
|
||||
@@ -376,7 +376,7 @@ msgstr "DHCP-\"vendor class\" auf Marke abbilden."
|
||||
|
||||
#: option.c:404
|
||||
msgid "Display dnsmasq version and copyright information."
|
||||
msgstr "dnsmasq-Version und Urheberrecht anzeigen."
|
||||
msgstr "DNSMasq-Version und Urheberrecht anzeigen."
|
||||
|
||||
#: option.c:405
|
||||
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."
|
||||
|
||||
#: option.c:435
|
||||
#, fuzzy
|
||||
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
|
||||
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."
|
||||
|
||||
#: option.c:438
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
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
|
||||
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"
|
||||
|
||||
#: option.c:477
|
||||
#, fuzzy
|
||||
msgid "Set authoritative zone information"
|
||||
msgstr "Setze autoritative Zoneninformationen"
|
||||
|
||||
@@ -724,9 +722,8 @@ msgid "Specify DHCPv6 prefix class"
|
||||
msgstr "Spezifiziere DHCPv6 Prefix Klasse"
|
||||
|
||||
#: option.c:491
|
||||
#, fuzzy
|
||||
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
|
||||
msgid "Do not log routine DHCP."
|
||||
@@ -758,7 +755,7 @@ msgstr "Setzte TTL in DNS-Antworten mit DHCP-abgeleiteten Adressen."
|
||||
|
||||
#: option.c:499
|
||||
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
|
||||
#, c-format
|
||||
@@ -781,7 +778,7 @@ msgstr "Gültige Optionen sind:\n"
|
||||
|
||||
#: option.c:754 option.c:868
|
||||
msgid "bad address"
|
||||
msgstr "Fehlerhafte Adresse."
|
||||
msgstr "Fehlerhafte Adresse"
|
||||
|
||||
#: option.c:779 option.c:783
|
||||
msgid "bad port"
|
||||
@@ -793,7 +790,7 @@ msgstr "Schnittstellenbindung nicht unterstützt"
|
||||
|
||||
#: option.c:821 option.c:856
|
||||
msgid "interface can only be specified once"
|
||||
msgstr ""
|
||||
msgstr "Schnittstelle kann nur einmal angegeben werden"
|
||||
|
||||
#: option.c:835 option.c:3809
|
||||
msgid "bad interface name"
|
||||
@@ -960,7 +957,7 @@ msgstr "Fehlerhafte DHCP-Proxy-Adresse"
|
||||
|
||||
#: option.c:3704
|
||||
msgid "Bad dhcp-relay"
|
||||
msgstr "unzulässiger dhcp-relay"
|
||||
msgstr "Uunzulässiger dhcp-relay"
|
||||
|
||||
#: option.c:3745
|
||||
msgid "bad RA-params"
|
||||
@@ -1016,7 +1013,7 @@ msgstr "unzulässige Wichtung"
|
||||
|
||||
#: option.c:4073
|
||||
msgid "Bad host-record"
|
||||
msgstr "unzulässiger host-record"
|
||||
msgstr "Unzulässiger host-record"
|
||||
|
||||
#: option.c:4097
|
||||
msgid "Bad name in host-record"
|
||||
@@ -1123,7 +1120,7 @@ msgstr "unzulässige Optionen auf der Befehlszeile: %s"
|
||||
#: option.c:4818
|
||||
#, c-format
|
||||
msgid "CNAME loop involving %s"
|
||||
msgstr ""
|
||||
msgstr "CNAME-Schleife mit %s"
|
||||
|
||||
#: option.c:4854
|
||||
#, c-format
|
||||
@@ -1178,7 +1175,7 @@ msgstr "möglichen DNS-Rebind-Angriff entdeckt: %s"
|
||||
#: forward.c:870
|
||||
#, c-format
|
||||
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
|
||||
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"
|
||||
|
||||
#: network.c:1047
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
msgid "warning: using interface %s instead"
|
||||
msgstr "Warnung: %s nicht zugreifbar"
|
||||
msgstr "Warnung: Benutzer stattdessen Schnittstelle %s"
|
||||
|
||||
#: network.c:1056
|
||||
#, c-format
|
||||
@@ -1289,9 +1286,9 @@ msgid "using nameserver %s#%d"
|
||||
msgstr "Benutze Namensserver %s#%d"
|
||||
|
||||
#: network.c:1591
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
msgid "using %d more local addresses"
|
||||
msgstr "Benutze %d mehr Namensserver"
|
||||
msgstr "Benutze %d mehr lokale Adressen"
|
||||
|
||||
#: network.c:1593
|
||||
#, c-format
|
||||
@@ -1425,9 +1422,8 @@ msgid "DNSSEC validation enabled"
|
||||
msgstr "DNSSEC-Validierung aktiviert"
|
||||
|
||||
#: dnsmasq.c:775
|
||||
#, fuzzy
|
||||
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
|
||||
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
|
||||
#, c-format
|
||||
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
|
||||
#, c-format
|
||||
@@ -1671,12 +1667,12 @@ msgstr "kann Lease-Datei %s nicht öffnen: %s"
|
||||
#: lease.c:175
|
||||
#, c-format
|
||||
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
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
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
|
||||
#, c-format
|
||||
@@ -1874,7 +1870,7 @@ msgstr "Kann RFC3925-Option nicht senden: zu viele Optionen für Unternehmen Nr.
|
||||
#: rfc2131.c:2650
|
||||
#, c-format
|
||||
msgid "%u reply delay: %d"
|
||||
msgstr ""
|
||||
msgstr "%u Antwortverzögerung: %d"
|
||||
|
||||
#: netlink.c:77
|
||||
#, c-format
|
||||
@@ -2111,7 +2107,7 @@ msgstr ", Prefix veraltet"
|
||||
#: dhcp-common.c:823
|
||||
#, c-format
|
||||
msgid ", lease time "
|
||||
msgstr ", Lease Zeit"
|
||||
msgstr ", Lease Zeit "
|
||||
|
||||
#: dhcp-common.c:865
|
||||
#, c-format
|
||||
@@ -2174,14 +2170,13 @@ msgid "failed to create IPset control socket: %s"
|
||||
msgstr "konnte IPset-Kontroll-Socket nicht erzeugen: %s"
|
||||
|
||||
#: ipset.c:233
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
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
|
||||
#, fuzzy
|
||||
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
|
||||
#, c-format
|
||||
@@ -2209,9 +2204,9 @@ msgid "error: cannot strlcpy table name %s"
|
||||
msgstr "Fehler: Kann den Tabellennamen %s nicht strlcpy"
|
||||
|
||||
#: tables.c:101
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
msgid "IPset: error:%s"
|
||||
msgstr "DBus-Fehler: %s"
|
||||
msgstr "IPset: Fehler: %s"
|
||||
|
||||
#: tables.c:108
|
||||
msgid "info: table created"
|
||||
|
||||
@@ -169,7 +169,7 @@ int iface_enumerate(int family, void *parm, int (*callback)())
|
||||
struct in6_ifreq 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);
|
||||
if (fd != -1 && ioctl(fd, SIOCGIFAFLAG_IN6, &ifr6) != -1)
|
||||
|
||||
37
src/cache.c
37
src/cache.c
@@ -825,7 +825,7 @@ static void add_hosts_cname(struct crec *target)
|
||||
for (a = daemon->cnames; a; a = a->next)
|
||||
if (a->alias[1] != '*' &&
|
||||
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->ttd = a->ttl;
|
||||
@@ -1029,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 (option_bool(OPT_EXPAND) && domain_suffix && !fqdn &&
|
||||
(cache = whine_malloc(sizeof(struct crec) +
|
||||
strlen(canon)+2+strlen(domain_suffix)-SMALLDNAME)))
|
||||
(cache = whine_malloc(SIZEOF_BARE_CREC + strlen(canon) + 2 + strlen(domain_suffix))))
|
||||
{
|
||||
strcpy(cache->name.sname, canon);
|
||||
strcat(cache->name.sname, ".");
|
||||
@@ -1040,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);
|
||||
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);
|
||||
cache->flags = flags;
|
||||
@@ -1113,7 +1112,7 @@ void cache_reload(void)
|
||||
for (intr = daemon->int_names; intr; intr = intr->next)
|
||||
if (a->alias[1] != '*' &&
|
||||
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->ttd = a->ttl;
|
||||
@@ -1128,7 +1127,7 @@ void cache_reload(void)
|
||||
|
||||
#ifdef HAVE_DNSSEC
|
||||
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->flags = F_FORWARD | F_IMMORTAL | F_DS | F_CONFIG | F_NAMEP;
|
||||
@@ -1155,7 +1154,7 @@ void cache_reload(void)
|
||||
for (nl = hr->names; nl; nl = nl->next)
|
||||
{
|
||||
if (hr->addr.s_addr != 0 &&
|
||||
(cache = whine_malloc(sizeof(struct crec))))
|
||||
(cache = whine_malloc(SIZEOF_POINTER_CREC)))
|
||||
{
|
||||
cache->name.namep = nl->name;
|
||||
cache->ttd = hr->ttl;
|
||||
@@ -1164,7 +1163,7 @@ void cache_reload(void)
|
||||
}
|
||||
#ifdef HAVE_IPV6
|
||||
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->ttd = hr->ttl;
|
||||
@@ -1241,7 +1240,7 @@ static void add_dhcp_cname(struct crec *target, time_t ttd)
|
||||
if ((aliasc = dhcp_spare))
|
||||
dhcp_spare = dhcp_spare->next;
|
||||
else /* need new one */
|
||||
aliasc = whine_malloc(sizeof(struct crec));
|
||||
aliasc = whine_malloc(SIZEOF_POINTER_CREC);
|
||||
|
||||
if (aliasc)
|
||||
{
|
||||
@@ -1332,7 +1331,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
|
||||
if ((crec = dhcp_spare))
|
||||
dhcp_spare = dhcp_spare->next;
|
||||
else /* need new one */
|
||||
crec = whine_malloc(sizeof(struct crec));
|
||||
crec = whine_malloc(SIZEOF_POINTER_CREC);
|
||||
|
||||
if (crec) /* malloc may fail */
|
||||
{
|
||||
@@ -1360,7 +1359,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
|
||||
static void make_non_terminals(struct crec *source)
|
||||
{
|
||||
char *name = cache_get_name(source);
|
||||
struct crec* crecp, *tmp, **up;
|
||||
struct crec *crecp, *tmp, **up;
|
||||
int type = F_HOSTS | F_CONFIG;
|
||||
#ifdef HAVE_DHCP
|
||||
if (source->flags & F_DHCP)
|
||||
@@ -1432,14 +1431,16 @@ static void make_non_terminals(struct crec *source)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
crecp = whine_malloc(sizeof(struct crec));
|
||||
crecp = whine_malloc(SIZEOF_POINTER_CREC);
|
||||
|
||||
*crecp = *source;
|
||||
crecp->flags &= ~(F_IPV4 | F_IPV6 | F_CNAME | F_DNSKEY | F_DS | F_REVERSE);
|
||||
crecp->flags |= F_NAMEP;
|
||||
crecp->name.namep = name;
|
||||
|
||||
cache_hash(crecp);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -485,8 +485,11 @@ char *whichdevice(void)
|
||||
|
||||
void bindtodevice(char *device, int fd)
|
||||
{
|
||||
size_t len = strlen(device)+1;
|
||||
if (len > IFNAMSIZ)
|
||||
len = IFNAMSIZ;
|
||||
/* 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)
|
||||
die(_("failed to set SO_BINDTODEVICE on DHCP socket: %s"), NULL, EC_BADNET);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ void dhcp_packet(time_t now, int pxe_fd)
|
||||
|
||||
#ifdef HAVE_LINUX_NETWORK
|
||||
/* 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
|
||||
|
||||
/* 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
|
||||
{
|
||||
strncpy(ifr.ifr_name, bridge->iface, IF_NAMESIZE);
|
||||
safe_strncpy(ifr.ifr_name, bridge->iface, sizeof(ifr.ifr_name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -279,7 +279,7 @@ void dhcp_packet(time_t now, int pxe_fd)
|
||||
is_relay_reply = 1;
|
||||
iov.iov_len = sz;
|
||||
#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
|
||||
}
|
||||
else
|
||||
@@ -988,8 +988,7 @@ char *host_from_dns(struct in_addr addr)
|
||||
if (!legal_hostname(hostname))
|
||||
return NULL;
|
||||
|
||||
strncpy(daemon->dhcp_buff, hostname, 256);
|
||||
daemon->dhcp_buff[255] = 0;
|
||||
safe_strncpy(daemon->dhcp_buff, hostname, 256);
|
||||
strip_hostname(daemon->dhcp_buff);
|
||||
|
||||
return daemon->dhcp_buff;
|
||||
|
||||
@@ -216,7 +216,7 @@ int main (int argc, char **argv)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_AUTH
|
||||
if (daemon->authserver || daemon->auth_zones)
|
||||
if (daemon->auth_zones)
|
||||
die(_("authoritative DNS not available: set HAVE_AUTH in src/config.h"), NULL, EC_BADCONF);
|
||||
#endif
|
||||
|
||||
@@ -235,13 +235,20 @@ int main (int argc, char **argv)
|
||||
|
||||
now = dnsmasq_time();
|
||||
|
||||
/* Create a serial at startup if not configured. */
|
||||
if (daemon->auth_zones && daemon->soa_sn == 0)
|
||||
if (daemon->auth_zones)
|
||||
{
|
||||
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
|
||||
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
|
||||
daemon->soa_sn = now;
|
||||
if (daemon->soa_sn == 0)
|
||||
daemon->soa_sn = now;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_DHCP6
|
||||
if (daemon->dhcp6)
|
||||
|
||||
@@ -42,6 +42,12 @@
|
||||
# define __EXTENSIONS__
|
||||
#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... */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -436,6 +442,9 @@ struct crec {
|
||||
} 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_NAMEP (1u<<1)
|
||||
#define F_REVERSE (1u<<2)
|
||||
@@ -1218,7 +1227,7 @@ int in_zone(struct auth_zone *zone, char *name, char **cut);
|
||||
#endif
|
||||
|
||||
/* 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_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,
|
||||
@@ -1246,6 +1255,7 @@ int legal_hostname(char *name);
|
||||
char *canonicalise(char *in, int *nomem);
|
||||
unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit);
|
||||
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 *whine_malloc(size_t size);
|
||||
int sa_len(union mysockaddr *addr);
|
||||
@@ -1275,7 +1285,7 @@ int wildcard_match(const char* wildcard, const char* match);
|
||||
int wildcard_matchn(const char* wildcard, const char* match, int num);
|
||||
|
||||
/* 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_reopen(char *log_file);
|
||||
|
||||
|
||||
20
src/dnssec.c
20
src/dnssec.c
@@ -1761,7 +1761,7 @@ int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, ch
|
||||
|
||||
unsigned char *ans_start, *p1, *p2;
|
||||
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;
|
||||
|
||||
/* extend rr_status if necessary */
|
||||
@@ -1835,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++)
|
||||
{
|
||||
if (i != 0 && !ADD_RDLEN(header, p1, plen, rdlen1))
|
||||
return STAT_BOGUS;
|
||||
|
||||
if (!extract_name(header, plen, &p1, name, 1, 10))
|
||||
if (i != 0 && !ADD_RDLEN(header, p1, plen, rdlen1))
|
||||
return STAT_BOGUS;
|
||||
|
||||
if (!extract_name(header, plen, &p1, name, 1, 10))
|
||||
return STAT_BOGUS; /* bad packet */
|
||||
|
||||
GETSHORT(type1, p1);
|
||||
@@ -2026,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,
|
||||
int type, union mysockaddr *addr, int edns_pktsz)
|
||||
int type, int edns_pktsz)
|
||||
{
|
||||
unsigned char *p;
|
||||
char *types = querystr("dnssec-query", type);
|
||||
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->ancount = htons(0);
|
||||
header->nscount = htons(0);
|
||||
|
||||
118
src/forward.c
118
src/forward.c
@@ -118,6 +118,7 @@ static unsigned int search_servers(time_t now, struct all_addr **addrpp, unsigne
|
||||
unsigned int matchlen = 0;
|
||||
struct server *serv;
|
||||
unsigned int flags = 0;
|
||||
static struct all_addr zero;
|
||||
|
||||
for (serv = daemon->servers; serv; serv=serv->next)
|
||||
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;
|
||||
if (serv->flags & SERV_NO_ADDR)
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
int logflags = 0;
|
||||
|
||||
if (flags == F_NXDOMAIN || flags == F_NOERR)
|
||||
logflags = F_NEG | qtype;
|
||||
|
||||
log_query(logflags | flags | F_CONFIG | F_FORWARD, qdomain, *addrpp, NULL);
|
||||
if (flags == F_NXDOMAIN || flags == F_NOERR)
|
||||
log_query(flags | qtype | F_NEG | F_CONFIG | F_FORWARD, qdomain, NULL, NULL);
|
||||
else
|
||||
{
|
||||
/* handle F_IPV4 and F_IPV6 set on ANY query to 0.0.0.0/:: domain. */
|
||||
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)
|
||||
{
|
||||
@@ -1037,7 +1058,7 @@ void reply_query(int fd, int family, time_t now)
|
||||
status = STAT_ABANDONED;
|
||||
else
|
||||
{
|
||||
int fd, type = SERV_DO_DNSSEC;
|
||||
int querytype, fd, type = SERV_DO_DNSSEC;
|
||||
struct frec *next = new->next;
|
||||
char *domain;
|
||||
|
||||
@@ -1090,15 +1111,26 @@ void reply_query(int fd, int family, time_t now)
|
||||
if (status == STAT_NEED_KEY)
|
||||
{
|
||||
new->flags |= FREC_DNSKEY_QUERY;
|
||||
nn = dnssec_generate_query(header, ((unsigned char *) header) + server->edns_pktsz,
|
||||
daemon->keyname, forward->class, T_DNSKEY, &server->addr, server->edns_pktsz);
|
||||
querytype = T_DNSKEY;
|
||||
}
|
||||
else
|
||||
{
|
||||
new->flags |= FREC_DS_QUERY;
|
||||
nn = dnssec_generate_query(header,((unsigned char *) header) + server->edns_pktsz,
|
||||
daemon->keyname, forward->class, T_DS, &server->addr, server->edns_pktsz);
|
||||
querytype = T_DS;
|
||||
}
|
||||
|
||||
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)))
|
||||
memcpy(new->hash, hash, HASH_SIZE);
|
||||
new->new_id = get_id();
|
||||
@@ -1632,9 +1664,9 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
|
||||
new_status = STAT_ABANDONED;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@@ -1667,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)) ||
|
||||
(server->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
|
||||
continue;
|
||||
|
||||
retry:
|
||||
/* may need to make new connection. */
|
||||
if (server->tcpfd == -1)
|
||||
{
|
||||
if ((server->tcpfd = socket(server->addr.sa.sa_family, SOCK_STREAM, 0)) == -1)
|
||||
continue; /* No good, next server */
|
||||
|
||||
|
||||
retry:
|
||||
/* may need to make new connection. */
|
||||
if (server->tcpfd == -1)
|
||||
{
|
||||
if ((server->tcpfd = socket(server->addr.sa.sa_family, SOCK_STREAM, 0)) == -1)
|
||||
continue; /* No good, next server */
|
||||
|
||||
#ifdef HAVE_CONNTRACK
|
||||
/* Copy connection mark of incoming query to outgoing connection. */
|
||||
if (have_mark)
|
||||
setsockopt(server->tcpfd, SOL_SOCKET, SO_MARK, &mark, sizeof(unsigned int));
|
||||
/* Copy connection mark of incoming query to outgoing connection. */
|
||||
if (have_mark)
|
||||
setsockopt(server->tcpfd, SOL_SOCKET, SO_MARK, &mark, sizeof(unsigned int));
|
||||
#endif
|
||||
|
||||
if (!local_bind(server->tcpfd, &server->source_addr, server->interface, 0, 1) ||
|
||||
connect(server->tcpfd, &server->addr.sa, sa_len(&server->addr)) == -1)
|
||||
{
|
||||
close(server->tcpfd);
|
||||
server->tcpfd = -1;
|
||||
continue; /* No good, next server */
|
||||
}
|
||||
|
||||
server->flags &= ~SERV_GOT_TCP;
|
||||
}
|
||||
|
||||
if (!local_bind(server->tcpfd, &server->source_addr, server->interface, 0, 1) ||
|
||||
connect(server->tcpfd, &server->addr.sa, sa_len(&server->addr)) == -1)
|
||||
{
|
||||
close(server->tcpfd);
|
||||
server->tcpfd = -1;
|
||||
continue; /* No good, next server */
|
||||
}
|
||||
|
||||
server->flags &= ~SERV_GOT_TCP;
|
||||
}
|
||||
|
||||
if (!read_write(server->tcpfd, packet, m + sizeof(u16), 0) ||
|
||||
!read_write(server->tcpfd, &c1, 1, 1) ||
|
||||
@@ -1707,6 +1739,16 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
|
||||
else
|
||||
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;
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ static void log_write(void)
|
||||
logaddr.sun_len = sizeof(logaddr) - sizeof(logaddr.sun_path) + strlen(_PATH_LOG) + 1;
|
||||
#endif
|
||||
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. */
|
||||
if (connect(log_fd, (struct sockaddr *)&logaddr, sizeof(logaddr)) != -1)
|
||||
|
||||
@@ -149,10 +149,10 @@ int iface_enumerate(int family, void *parm, int (*callback)())
|
||||
struct rtgenmsg g;
|
||||
} req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
|
||||
addr.nl_family = AF_NETLINK;
|
||||
addr.nl_pad = 0;
|
||||
addr.nl_groups = 0;
|
||||
addr.nl_pid = 0; /* address to kernel */
|
||||
|
||||
again:
|
||||
if (family == AF_UNSPEC)
|
||||
|
||||
@@ -29,7 +29,7 @@ int indextoname(int fd, int index, char *name)
|
||||
if (ioctl(fd, SIOCGIFNAME, &ifr) == -1)
|
||||
return 0;
|
||||
|
||||
strncpy(name, ifr.ifr_name, IF_NAMESIZE);
|
||||
safe_strncpy(name, ifr.ifr_name, IF_NAMESIZE);
|
||||
|
||||
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++)
|
||||
{
|
||||
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)
|
||||
return 0;
|
||||
|
||||
if (lifr.lifr_index == index) {
|
||||
strncpy(name, lifr.lifr_name, IF_NAMESIZE);
|
||||
safe_strncpy(name, lifr.lifr_name, IF_NAMESIZE);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ int loopback_exception(int fd, int family, struct all_addr *addr, char *name)
|
||||
struct ifreq ifr;
|
||||
struct irec *iface;
|
||||
|
||||
strncpy(ifr.ifr_name, name, IF_NAMESIZE);
|
||||
safe_strncpy(ifr.ifr_name, name, IF_NAMESIZE);
|
||||
if (ioctl(fd, SIOCGIFFLAGS, &ifr) != -1 &&
|
||||
ifr.ifr_flags & IFF_LOOPBACK)
|
||||
{
|
||||
@@ -1286,7 +1286,7 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(sfd->interface, intname);
|
||||
safe_strncpy(sfd->interface, intname, sizeof(sfd->interface));
|
||||
sfd->source_addr = *addr;
|
||||
sfd->next = daemon->sfds;
|
||||
sfd->ifindex = ifindex;
|
||||
@@ -1458,7 +1458,7 @@ void add_update_server(int flags,
|
||||
serv->flags |= SERV_HAS_DOMAIN;
|
||||
|
||||
if (interface)
|
||||
strcpy(serv->interface, interface);
|
||||
safe_strncpy(serv->interface, interface, sizeof(serv->interface));
|
||||
if (addr)
|
||||
serv->addr = *addr;
|
||||
if (source_addr)
|
||||
|
||||
77
src/option.c
77
src/option.c
@@ -810,7 +810,7 @@ char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_a
|
||||
if (interface_opt)
|
||||
{
|
||||
#if defined(SO_BINDTODEVICE)
|
||||
strncpy(interface, interface_opt, IF_NAMESIZE - 1);
|
||||
safe_strncpy(interface, interface_opt, IF_NAMESIZE);
|
||||
#else
|
||||
return _("interface binding not supported");
|
||||
#endif
|
||||
@@ -839,7 +839,7 @@ char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_a
|
||||
return _("interface can only be specified once");
|
||||
|
||||
source_addr->in.sin_addr.s_addr = INADDR_ANY;
|
||||
strncpy(interface, source, IF_NAMESIZE - 1);
|
||||
safe_strncpy(interface, source, IF_NAMESIZE);
|
||||
#else
|
||||
return _("interface binding not supported");
|
||||
#endif
|
||||
@@ -874,7 +874,7 @@ char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_a
|
||||
return _("interface can only be specified once");
|
||||
|
||||
source_addr->in6.sin6_addr = in6addr_any;
|
||||
strncpy(interface, source, IF_NAMESIZE - 1);
|
||||
safe_strncpy(interface, source, IF_NAMESIZE);
|
||||
#else
|
||||
return _("interface binding not supported");
|
||||
#endif
|
||||
@@ -1902,44 +1902,42 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
}
|
||||
|
||||
case LOPT_AUTHSERV: /* --auth-server */
|
||||
if (!(comma = split(arg)))
|
||||
ret_err(gen_err);
|
||||
comma = split(arg);
|
||||
|
||||
daemon->authserver = opt_string_alloc(arg);
|
||||
arg = comma;
|
||||
do {
|
||||
struct iname *new = opt_malloc(sizeof(struct iname));
|
||||
comma = split(arg);
|
||||
new->name = NULL;
|
||||
unhide_metas(arg);
|
||||
if (inet_pton(AF_INET, arg, &new->addr.in.sin_addr) > 0)
|
||||
new->addr.sa.sa_family = AF_INET;
|
||||
|
||||
while ((arg = comma))
|
||||
{
|
||||
struct iname *new = opt_malloc(sizeof(struct iname));
|
||||
comma = split(arg);
|
||||
new->name = NULL;
|
||||
unhide_metas(arg);
|
||||
if (inet_pton(AF_INET, arg, &new->addr.in.sin_addr) > 0)
|
||||
new->addr.sa.sa_family = AF_INET;
|
||||
#ifdef HAVE_IPV6
|
||||
else if (inet_pton(AF_INET6, arg, &new->addr.in6.sin6_addr) > 0)
|
||||
new->addr.sa.sa_family = AF_INET6;
|
||||
else if (inet_pton(AF_INET6, arg, &new->addr.in6.sin6_addr) > 0)
|
||||
new->addr.sa.sa_family = AF_INET6;
|
||||
#endif
|
||||
else
|
||||
{
|
||||
char *fam = split_chr(arg, '/');
|
||||
new->name = opt_string_alloc(arg);
|
||||
new->addr.sa.sa_family = 0;
|
||||
if (fam)
|
||||
{
|
||||
if (strcmp(fam, "4") == 0)
|
||||
new->addr.sa.sa_family = AF_INET;
|
||||
else
|
||||
{
|
||||
char *fam = split_chr(arg, '/');
|
||||
new->name = opt_string_alloc(arg);
|
||||
new->addr.sa.sa_family = 0;
|
||||
if (fam)
|
||||
{
|
||||
if (strcmp(fam, "4") == 0)
|
||||
new->addr.sa.sa_family = AF_INET;
|
||||
#ifdef HAVE_IPV6
|
||||
else if (strcmp(fam, "6") == 0)
|
||||
new->addr.sa.sa_family = AF_INET6;
|
||||
else if (strcmp(fam, "6") == 0)
|
||||
new->addr.sa.sa_family = AF_INET6;
|
||||
#endif
|
||||
else
|
||||
ret_err(gen_err);
|
||||
}
|
||||
}
|
||||
new->next = daemon->authinterface;
|
||||
daemon->authinterface = new;
|
||||
|
||||
arg = comma;
|
||||
} while (arg);
|
||||
else
|
||||
ret_err(gen_err);
|
||||
}
|
||||
}
|
||||
new->next = daemon->authinterface;
|
||||
daemon->authinterface = new;
|
||||
};
|
||||
|
||||
break;
|
||||
|
||||
@@ -2467,11 +2465,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
}
|
||||
|
||||
else if (strcmp(arg, "#") == 0)
|
||||
{
|
||||
newlist->flags |= SERV_USE_RESOLV; /* treat in ordinary way */
|
||||
if (newlist->flags & SERV_LITERAL_ADDRESS)
|
||||
ret_err(gen_err);
|
||||
}
|
||||
newlist->flags |= SERV_USE_RESOLV; /* treat in ordinary way */
|
||||
else
|
||||
{
|
||||
char *err = parse_server(arg, &newlist->addr, &newlist->source_addr, newlist->interface, &newlist->flags);
|
||||
@@ -4805,8 +4799,7 @@ void read_opts(int argc, char **argv, char *compile_opts)
|
||||
argbuf_size = strlen(optarg) + 1;
|
||||
argbuf = opt_malloc(argbuf_size);
|
||||
}
|
||||
strncpy(argbuf, optarg, argbuf_size);
|
||||
argbuf[argbuf_size-1] = 0;
|
||||
safe_strncpy(argbuf, optarg, argbuf_size);
|
||||
arg = argbuf;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -956,22 +956,26 @@ size_t setup_reply(struct dns_header *header, size_t qlen,
|
||||
log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
|
||||
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)
|
||||
else if (flags & ( F_IPV4 | F_IPV6))
|
||||
{
|
||||
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_AAAA, C_IN, "6", addrp);
|
||||
}
|
||||
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
|
||||
}
|
||||
else /* nowhere to forward to */
|
||||
{
|
||||
struct all_addr a;
|
||||
@@ -1289,16 +1293,14 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
||||
struct mx_srv_record *rec;
|
||||
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->qdcount) == 0 ||
|
||||
OPCODE(header) != QUERY )
|
||||
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. */
|
||||
if (header->hb4 & HB4_CD)
|
||||
sec_data = 0;
|
||||
|
||||
@@ -700,39 +700,9 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
client_hostname = daemon->dhcp_buff;
|
||||
}
|
||||
|
||||
if (client_hostname)
|
||||
{
|
||||
struct dhcp_match_name *m;
|
||||
size_t nl = strlen(client_hostname);
|
||||
|
||||
if (option_bool(OPT_LOG_OPTS))
|
||||
my_syslog(MS_DHCP | LOG_INFO, _("%u client provides name: %s"), ntohl(mess->xid), client_hostname);
|
||||
if (client_hostname && option_bool(OPT_LOG_OPTS))
|
||||
my_syslog(MS_DHCP | LOG_INFO, _("%u client provides name: %s"), ntohl(mess->xid), client_hostname);
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (have_config(config, CONFIG_NAME))
|
||||
{
|
||||
@@ -745,11 +715,15 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
}
|
||||
else if (client_hostname)
|
||||
{
|
||||
struct dhcp_match_name *m;
|
||||
size_t nl;
|
||||
|
||||
domain = strip_hostname(client_hostname);
|
||||
|
||||
if (strlen(client_hostname) != 0)
|
||||
if ((nl = strlen(client_hostname)) != 0)
|
||||
{
|
||||
hostname = client_hostname;
|
||||
|
||||
if (!config)
|
||||
{
|
||||
/* Search again now we have a hostname.
|
||||
@@ -767,6 +741,30 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,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);
|
||||
|
||||
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,
|
||||
@@ -2360,7 +2358,7 @@ static void do_options(struct dhcp_context *context,
|
||||
in_list(req_options, OPTION_SNAME))
|
||||
option_put_string(mess, end, OPTION_SNAME, boot->sname, 1);
|
||||
else
|
||||
strncpy((char *)mess->sname, boot->sname, sizeof(mess->sname)-1);
|
||||
safe_strncpy((char *)mess->sname, boot->sname, sizeof(mess->sname));
|
||||
}
|
||||
|
||||
if (boot->file)
|
||||
@@ -2370,7 +2368,7 @@ static void do_options(struct dhcp_context *context,
|
||||
in_list(req_options, OPTION_FILENAME))
|
||||
option_put_string(mess, end, OPTION_FILENAME, boot->file, 1);
|
||||
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)
|
||||
@@ -2387,14 +2385,14 @@ static void do_options(struct dhcp_context *context,
|
||||
if ((!req_options || !in_list(req_options, OPTION_FILENAME)) &&
|
||||
(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;
|
||||
}
|
||||
|
||||
if ((!req_options || !in_list(req_options, OPTION_SNAME)) &&
|
||||
(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;
|
||||
}
|
||||
|
||||
|
||||
@@ -496,11 +496,16 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
}
|
||||
else if (state->client_hostname)
|
||||
{
|
||||
struct dhcp_match_name *m;
|
||||
size_t nl;
|
||||
|
||||
state->domain = strip_hostname(state->client_hostname);
|
||||
nl = strlen(state->client_hostname);
|
||||
|
||||
if (strlen(state->client_hostname) != 0)
|
||||
{
|
||||
state->hostname = state->client_hostname;
|
||||
|
||||
if (!config)
|
||||
{
|
||||
/* 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)
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
(struct sockaddr *)&addr, sizeof(addr)) == -1 &&
|
||||
errno == EHOSTUNREACH)
|
||||
errno == EHOSTUNREACH &&
|
||||
slaac->backoff == 12)
|
||||
slaac->ping_time = 0; /* Give up */
|
||||
else
|
||||
{
|
||||
|
||||
@@ -234,7 +234,7 @@ void tftp_request(struct listener *listen, time_t now)
|
||||
#endif
|
||||
}
|
||||
|
||||
strncpy(ifr.ifr_name, name, IF_NAMESIZE);
|
||||
safe_strncpy(ifr.ifr_name, name, IF_NAMESIZE);
|
||||
if (ioctl(listen->tftpfd, SIOCGIFMTU, &ifr) != -1)
|
||||
{
|
||||
mtu = ifr.ifr_mtu;
|
||||
|
||||
13
src/util.c
13
src/util.c
@@ -281,7 +281,18 @@ void *safe_malloc(size_t size)
|
||||
die(_("could not get memory"), NULL, EC_NOMEM);
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user