Compare commits
8 Commits
v2.77test2
...
v2.77test4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62f9c0d470 | ||
|
|
54bb3639d4 | ||
|
|
fca008d8d4 | ||
|
|
43517fcaf5 | ||
|
|
88a77a78ad | ||
|
|
3e2496fb16 | ||
|
|
05da782f8f | ||
|
|
361dfe5158 |
29
CHANGELOG
29
CHANGELOG
@@ -51,7 +51,7 @@ version 2.77
|
||||
Add DNSMASQ_REQUESTED_OPTIONS environment variable to the
|
||||
lease-change script. Thanks to ZHAO Yu for the patch.
|
||||
|
||||
Fix foobar in rrfilter code, that could cause misformed
|
||||
Fix foobar in rrfilter code, that could cause malformed
|
||||
replies, especially when DNSSEC validation on, and
|
||||
the upstream server returns answer with the RRs in a
|
||||
particular order. The only DNS server known to tickle
|
||||
@@ -65,7 +65,22 @@ version 2.77
|
||||
Thanks to Kevin Darbyshire-Bryant and Eric Luehrsen
|
||||
for pushing this.
|
||||
|
||||
Improve connection handling when talking to TCP upstream
|
||||
servers. Specifically, be prepared to open a new TCP
|
||||
connection when we want to make multiple queries
|
||||
but the upstream server accepts fewer queries per connection.
|
||||
|
||||
Improve logging of upstream servers when there are a lot
|
||||
of "local addresses only" entries. Thanks to Hannu Nyman for
|
||||
the patch.
|
||||
|
||||
Implement RFC 6842. Thanks to Reddeiah Raju Konduru for
|
||||
pointing out that this was missing.
|
||||
|
||||
Make --bogus-priv apply to IPv6, for the prefixes specified
|
||||
in RFC6303. Thanks to Kevin Darbyshire-Bryant for work on this.
|
||||
|
||||
|
||||
version 2.76
|
||||
Include 0.0.0.0/8 in DNS rebind checks. This range
|
||||
translates to hosts on the local network, or, at
|
||||
@@ -456,7 +471,7 @@ version 2.69
|
||||
conf-file=/path/to/trust-anchors.conf
|
||||
dnssec
|
||||
|
||||
to your config is all thats needed to get things
|
||||
to your config is all that's needed to get things
|
||||
working. The upstream nameservers have to be DNSSEC-capable
|
||||
too, of course. Many ISP nameservers aren't, but the
|
||||
Google public nameservers (8.8.8.8 and 8.8.4.4) are.
|
||||
@@ -644,7 +659,7 @@ version 2.67
|
||||
we can't use SO_BINDTODEVICE. Thanks to Natrio for the bug
|
||||
report.
|
||||
|
||||
Increase timeout/number of retries in TFTP to accomodate
|
||||
Increase timeout/number of retries in TFTP to accommodate
|
||||
AudioCodes Voice Gateways doing streaming writes to flash.
|
||||
Thanks to Damian Kaczkowski for spotting the problem.
|
||||
|
||||
@@ -912,7 +927,7 @@ version 2.63
|
||||
still-born attempt to allow automatic isolated
|
||||
configuration by libvirt, but have never (to my knowledge)
|
||||
been used, had very strange semantics, and have been
|
||||
superceded by other mechanisms.
|
||||
superseded by other mechanisms.
|
||||
|
||||
Fixed bug logging filenames when duplicate dhcp-host
|
||||
addresses are found. Thanks to John Hanks for the patch.
|
||||
@@ -945,7 +960,7 @@ version 2.63
|
||||
version 2.62
|
||||
Update German translation. Thanks to Conrad Kostecki.
|
||||
|
||||
Cope with router-solict packets wich don't have a valid
|
||||
Cope with router-solict packets which don't have a valid
|
||||
source address. Thanks to Vladislav Grishenko for the patch.
|
||||
|
||||
Fixed bug which caused missing periodic router
|
||||
@@ -1199,7 +1214,7 @@ version 2.58
|
||||
|
||||
Relax the need to supply a netmask in --dhcp-range for
|
||||
networks which use a DHCP relay. Whilst this is still
|
||||
desireable, in the absence of a netmask dnsmasq will use
|
||||
desirable, in the absence of a netmask dnsmasq will use
|
||||
a default based on the class (A, B, or C) of the address.
|
||||
This should at least remove a cause of mysterious failure
|
||||
for people using RFC1918 addresses and relays.
|
||||
@@ -1313,7 +1328,7 @@ version 2.56
|
||||
|
||||
Add --add-mac option. This is to support currently
|
||||
experimental DNS filtering facilities. Thanks to Benjamin
|
||||
Petrin for the orignal patch.
|
||||
Petrin for the original patch.
|
||||
|
||||
Fix bug which meant that tags were ignored in dhcp-range
|
||||
configuration specifying PXE-proxy service. Thanks to
|
||||
|
||||
@@ -78,7 +78,7 @@ release 0.98 Some enhancements and bug-fixes.
|
||||
ids, to thwart DNS spoofers.
|
||||
(7) Dnsmasq no longer forwards queries when the
|
||||
"recursion desired" bit is not set in the header.
|
||||
(8) Fixed getopt code to work on compliers with unsigned char.
|
||||
(8) Fixed getopt code to work on compilers with unsigned char.
|
||||
|
||||
release 0.991 Added -b flag: when set causes dnsmasq to always answer
|
||||
reverse queries on the RFC 1918 private IP space itself and
|
||||
@@ -319,7 +319,7 @@ release 1.9 Fixes to rpm .spec files.
|
||||
uClinux. Thanks to Matthew Natalier for uClinux stuff.
|
||||
|
||||
release 1.10 Log warnings if resolv.conf or dhcp.leases are not
|
||||
accessable for any reason, as suggested by Hinrich Eilts.
|
||||
accessible for any reason, as suggested by Hinrich Eilts.
|
||||
|
||||
Fixed wrong address printing in error message about
|
||||
no interface with address.
|
||||
@@ -975,7 +975,7 @@ release 2.8
|
||||
configuration. Specifically: (1) options are matched on
|
||||
the netids from dhcp-range, dhcp-host, vendor class and
|
||||
user class(es). Multiple net-ids are allowed and options
|
||||
are searched on them all. (2) matches agains vendor class
|
||||
are searched on them all. (2) matches against vendor class
|
||||
and user class are now on a substring, if the given
|
||||
string is a substring of the vendor/user class, then a
|
||||
match occurs. Thanks again to Richard Musil for prompting
|
||||
@@ -1019,7 +1019,7 @@ release 2.9
|
||||
broken. The new algorithm is to pick as before for the
|
||||
first try, but if a query is retried, to send to all
|
||||
available servers in parallel. The first one to reply
|
||||
then becomes prefered for the next query. This should
|
||||
then becomes preferred for the next query. This should
|
||||
improve reliability without generating significant extra
|
||||
upstream load.
|
||||
|
||||
@@ -1229,7 +1229,7 @@ version 2.16
|
||||
|
||||
Set NONBLOCK on all listening sockets to workaround non-POSIX
|
||||
compliance in Linux 2.4 and 2.6. This fixes rare hangs which
|
||||
occured when corrupted packets were received. Thanks to
|
||||
occurred when corrupted packets were received. Thanks to
|
||||
Joris van Rantwijk for chasing that down.
|
||||
|
||||
Updated config.h for NetBSD. Thanks to Martin Lambers.
|
||||
@@ -1297,7 +1297,7 @@ version 2.18
|
||||
interfaces with more than one IPv6 address. Thanks to
|
||||
Martin Pels for help with that.
|
||||
|
||||
Fix problems which occured when more than one dhcp-range
|
||||
Fix problems which occurred when more than one dhcp-range
|
||||
was specified in the same subnet: sometimes parameters
|
||||
(lease time, network-id tag) from the wrong one would be
|
||||
used. Thanks to Rory Campbell-Lange for the bug report.
|
||||
@@ -1740,7 +1740,7 @@ version 2.28
|
||||
Fixed regression in netlink code under 2.2.x kernels which
|
||||
occurred in 2.27. Erik Jan Tromp is the vintage kernel fan
|
||||
who found this. P.S. It looks like this "netlink bind:
|
||||
permission denied" problem occured in kernels at least as
|
||||
permission denied" problem occurred in kernels at least as
|
||||
late a 2.4.18. Good information from Alain Richoux.
|
||||
|
||||
Added a warning when it's impossible to give a host its
|
||||
|
||||
62
FAQ
62
FAQ
@@ -156,7 +156,7 @@ A: [note: this was written in September 2003, things may well change.]
|
||||
|
||||
If you get "jlsdajkdalld.com" does not exist, then all is fine, if
|
||||
host returns an IP address, then the DNS is broken. (Try a few
|
||||
different unlikely domains, just in case you picked a wierd one
|
||||
different unlikely domains, just in case you picked a weird one
|
||||
which really _is_ registered.)
|
||||
|
||||
Assuming that your DNS is broken, and you want to fix it, simply
|
||||
@@ -320,8 +320,18 @@ A: Yes, new releases of dnsmasq are always announced through
|
||||
|
||||
Q: What does the dhcp-authoritative option do?
|
||||
|
||||
A: See http://www.isc.org/files/auth.html - that's
|
||||
for the ISC daemon, but the same applies to dnsmasq.
|
||||
A: The DHCP spec says that when a DHCP server recieves a renewal request
|
||||
from a client it has no knowledge of, it should just ignore it.
|
||||
This is because it's supported to have more than one DHCP server
|
||||
on a network, and another DHCP server may be dealing with the client.
|
||||
This has the unfortunate effect that when _no_ DHCP replies to
|
||||
the client, it takes some time for the client to time-out and start
|
||||
to get a new lease. Setting this option makes dnsmasq violate the
|
||||
standard to the extent that it will send a NAK reply to the client,
|
||||
causing it to immediately start to get a new lease. This improves
|
||||
behaviour when machines move networks, and in the case that the DHCP
|
||||
lease database is lost. As long as there are not more tha one DHCP
|
||||
server on the network, it's safe to enable the option.
|
||||
|
||||
Q: Why does my Gentoo box pause for a minute before getting a new
|
||||
lease?
|
||||
@@ -349,6 +359,7 @@ A: By default, the identity of a machine is determined by using the
|
||||
method for setting the client-id varies with DHCP client software,
|
||||
dhcpcd uses the "-I" flag. Windows uses a registry setting,
|
||||
see http://www.jsiinc.com/SUBF/TIP2800/rh2845.htm
|
||||
|
||||
Addendum:
|
||||
From version 2.46, dnsmasq has a solution to this which doesn't
|
||||
involve setting client-IDs. It's possible to put more than one MAC
|
||||
@@ -361,6 +372,51 @@ Addendum:
|
||||
constraint: if you configure multiple MAC addresses and violate
|
||||
this rule, bad things will happen.
|
||||
|
||||
Addendum-II: The link above is dead, the former contents of the link are:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
How can I keep the same DHCP client reservation, if the MAC address changes?
|
||||
|
||||
When you reserve an IP address for a DHCP client, you provide the
|
||||
MAC address of the client's NIC.
|
||||
|
||||
It is possible to use a custom identifier, which is sent as
|
||||
option 61 in the client's DHCP Discover and Request packet.
|
||||
|
||||
The DhcpClientIdentifier is a REG_DWORD value that is located at:
|
||||
|
||||
Windows NT 4.0 SP2+
|
||||
|
||||
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<Adapter Name>'X'\Parameters\Tcpip
|
||||
|
||||
where <Adapter Name> is the NIC driver name and 'X' is the number of the NIC.
|
||||
|
||||
Windows 2000
|
||||
|
||||
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TcpIp\Parameters\Interfaces\<NIC GUID>
|
||||
|
||||
where <NIC GUID> is the GUID of the NIC.
|
||||
|
||||
The valid range of data is 0x0 - 0xFFFFFFFF. The custom identifier is send as 4 bytes,
|
||||
8 hexadecimal character, in groups of 2 hexadecimal characters, with the groups being
|
||||
sent in reverse order. If the custom identifier is less than 8 hexadeciaml characters,
|
||||
it is zero padded at the end. Examples:
|
||||
|
||||
Custom Client Client Reservation
|
||||
Identifier on DHCP Server
|
||||
12345678 78563412
|
||||
123456 56341200
|
||||
1234 34120000
|
||||
1234567 67452301
|
||||
12345 45230100
|
||||
123 23010000
|
||||
A18F42 428FA100
|
||||
CF432 32F40C00
|
||||
C32D1BE BED1320C
|
||||
|
||||
-------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Q: Can dnsmasq do DHCP on IP-alias interfaces?
|
||||
|
||||
A: Yes, from version-2.21. The support is only available running under
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
The iaid argument is numeric string and mandatory. Normally
|
||||
it can be found in leases file both on client and server.
|
||||
|
||||
IP is an IPv6 adress to release
|
||||
IP is an IPv6 address to release
|
||||
|
||||
If --dry-run is specified, dhcp_release6 just prints hexadecimal representation of
|
||||
packet to send to stdout and exits.
|
||||
|
||||
@@ -301,7 +301,8 @@ attached to. Currently this facility is limited to IPv4.
|
||||
.B \-b, --bogus-priv
|
||||
Bogus private reverse lookups. All reverse lookups for private IP ranges (ie 192.168.x.x, etc)
|
||||
which are not found in /etc/hosts or the DHCP leases file are answered
|
||||
with "no such domain" rather than being forwarded upstream.
|
||||
with "no such domain" rather than being forwarded upstream. The
|
||||
set of prefixes affected is the list given in RFC6303, for IPv4 and IPv6.
|
||||
.TP
|
||||
.B \-V, --alias=[<old-ip>]|[<start-ip>-<end-ip>],<new-ip>[,<mask>]
|
||||
Modify IPv4 addresses returned from upstream nameservers; old-ip is
|
||||
@@ -1476,7 +1477,7 @@ DUID automatically when it is first needed. When given, this option
|
||||
provides dnsmasq the data required to create a DUID-EN type DUID. Note
|
||||
that once set, the DUID is stored in the lease database, so to change between DUID-EN and
|
||||
automatically created DUIDs or vice-versa, the lease database must be
|
||||
re-intialised. The enterprise-id is assigned by IANA, and the uid is a
|
||||
re-initialised. The enterprise-id is assigned by IANA, and the uid is a
|
||||
string of hex octets unique to a particular device.
|
||||
.TP
|
||||
.B \-6 --dhcp-script=<path>
|
||||
@@ -1606,7 +1607,7 @@ the arrival of a new entry in the ARP or neighbour table, and "arp-del" indicate
|
||||
.B --dhcp-luascript=<path>
|
||||
Specify a script written in Lua, to be run when leases are created,
|
||||
destroyed or changed. To use this option, dnsmasq must be compiled
|
||||
with the correct support. The Lua interpreter is intialised once, when
|
||||
with the correct support. The Lua interpreter is initialised once, when
|
||||
dnsmasq starts, so that global variables persist between lease
|
||||
events. The Lua code must define a
|
||||
.B lease
|
||||
|
||||
@@ -518,7 +518,8 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
||||
} while ((crecp = cache_find_by_name(crecp, name, now, F_IPV4 | F_IPV6)));
|
||||
}
|
||||
|
||||
if (!found)
|
||||
/* Only supply CNAME if no record for any type is known. */
|
||||
if (nxdomain)
|
||||
{
|
||||
/* Check for possible wildcard match against *.domain
|
||||
return length of match, to get longest.
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#define FORWARD_TEST 50 /* try all servers every 50 queries */
|
||||
#define FORWARD_TIME 20 /* or 20 seconds */
|
||||
#define SERVERS_LOGGED 30 /* Only log this many servers when logging state */
|
||||
#define LOCALS_LOGGED 8 /* Only log this many local addresses when logging state */
|
||||
#define RANDOM_SOCKS 64 /* max simultaneous random ports */
|
||||
#define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RETRY seconds */
|
||||
#define CACHESIZ 150 /* default cache size */
|
||||
@@ -131,7 +132,7 @@ NO_SCRIPT
|
||||
NO_LARGEFILE
|
||||
NO_AUTH
|
||||
NO_INOTIFY
|
||||
these are avilable 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
|
||||
which are enabled by default in the distributed source tree. Building dnsmasq
|
||||
with something like "make COPTS=-DNO_SCRIPT" will do the trick.
|
||||
|
||||
@@ -496,7 +496,7 @@ static int check_listen_addrs(struct in_addr local, int if_index, char *label,
|
||||
3) Fills in local (this host) and router (this host or relay) addresses.
|
||||
4) Links contexts which are valid for hosts directly connected to the arrival interface on ->current.
|
||||
|
||||
Note that the current chain may be superceded later for configured hosts or those coming via gateways. */
|
||||
Note that the current chain may be superseded later for configured hosts or those coming via gateways. */
|
||||
|
||||
static int complete_context(struct in_addr local, int if_index, char *label,
|
||||
struct in_addr netmask, struct in_addr broadcast, void *vparam)
|
||||
|
||||
@@ -485,6 +485,7 @@ union mysockaddr {
|
||||
#define SERV_FROM_FILE 4096 /* read from --servers-file */
|
||||
#define SERV_LOOP 8192 /* server causes forwarding loop */
|
||||
#define SERV_DO_DNSSEC 16384 /* Validate DNSSEC when using this server */
|
||||
#define SERV_GOT_TCP 32768 /* Got some data from the TCP connection */
|
||||
|
||||
struct serverfd {
|
||||
int fd;
|
||||
|
||||
195
src/forward.c
195
src/forward.c
@@ -1328,7 +1328,7 @@ void receive_query(struct listener *listen, time_t now)
|
||||
struct irec *iface;
|
||||
|
||||
/* get the netmask of the interface which has the address we were sent to.
|
||||
This is no neccessarily the interface we arrived on. */
|
||||
This is no necessarily the interface we arrived on. */
|
||||
|
||||
for (iface = daemon->interfaces; iface; iface = iface->next)
|
||||
if (iface->addr.sa.sa_family == AF_INET &&
|
||||
@@ -1459,14 +1459,15 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
|
||||
unsigned char *payload = NULL;
|
||||
struct dns_header *new_header = NULL;
|
||||
u16 *length = NULL;
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
int type = SERV_DO_DNSSEC;
|
||||
char *domain;
|
||||
size_t m;
|
||||
unsigned char c1, c2;
|
||||
|
||||
struct server *firstsendto = NULL;
|
||||
|
||||
/* limit the amount of work we do, to avoid cycling forever on loops in the DNS */
|
||||
if (--(*keycount) == 0)
|
||||
new_status = STAT_ABANDONED;
|
||||
@@ -1504,81 +1505,86 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
|
||||
/* Find server to forward to. This will normally be the
|
||||
same as for the original query, but may be another if
|
||||
servers for domains are involved. */
|
||||
if (search_servers(now, NULL, F_QUERY, keyname, &type, &domain, NULL) == 0)
|
||||
{
|
||||
struct server *start = server, *new_server = NULL;
|
||||
type &= ~SERV_DO_DNSSEC;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (type == (start->flags & SERV_TYPE) &&
|
||||
(type != SERV_HAS_DOMAIN || hostname_isequal(domain, start->domain)) &&
|
||||
!(start->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
|
||||
{
|
||||
new_server = start;
|
||||
if (server == start)
|
||||
{
|
||||
new_server = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(start = start->next))
|
||||
start = daemon->servers;
|
||||
if (start == server)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (new_server)
|
||||
{
|
||||
server = new_server;
|
||||
/* may need to make new connection. */
|
||||
if (server->tcpfd == -1)
|
||||
{
|
||||
if ((server->tcpfd = socket(server->addr.sa.sa_family, SOCK_STREAM, 0)) == -1)
|
||||
{
|
||||
new_status = STAT_ABANDONED;
|
||||
break;
|
||||
}
|
||||
|
||||
#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));
|
||||
#endif
|
||||
|
||||
if (!local_bind(server->tcpfd, &server->source_addr, server->interface, 1) ||
|
||||
connect(server->tcpfd, &server->addr.sa, sa_len(&server->addr)) == -1)
|
||||
{
|
||||
close(server->tcpfd);
|
||||
server->tcpfd = -1;
|
||||
new_status = STAT_ABANDONED;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!read_write(server->tcpfd, packet, m + sizeof(u16), 0) ||
|
||||
!read_write(server->tcpfd, &c1, 1, 1) ||
|
||||
!read_write(server->tcpfd, &c2, 1, 1) ||
|
||||
!read_write(server->tcpfd, payload, (c1 << 8) | c2, 1))
|
||||
if (search_servers(now, NULL, F_QUERY, keyname, &type, &domain, NULL) != 0)
|
||||
{
|
||||
new_status = STAT_ABANDONED;
|
||||
break;
|
||||
}
|
||||
|
||||
m = (c1 << 8) | c2;
|
||||
|
||||
type &= ~SERV_DO_DNSSEC;
|
||||
|
||||
new_status = tcp_key_recurse(now, new_status, new_header, m, class, name, keyname, server, have_mark, mark, keycount);
|
||||
while (1)
|
||||
{
|
||||
if (!firstsendto)
|
||||
firstsendto = server;
|
||||
else
|
||||
{
|
||||
if (!(server = server->next))
|
||||
server = daemon->servers;
|
||||
if (server == firstsendto)
|
||||
{
|
||||
/* can't find server to accept our query. */
|
||||
new_status = STAT_ABANDONED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (type != (server->flags & SERV_TYPE) ||
|
||||
(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 */
|
||||
|
||||
#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));
|
||||
#endif
|
||||
|
||||
if (!local_bind(server->tcpfd, &server->source_addr, server->interface, 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) ||
|
||||
!read_write(server->tcpfd, &c2, 1, 1) ||
|
||||
!read_write(server->tcpfd, payload, (c1 << 8) | c2, 1))
|
||||
{
|
||||
close(server->tcpfd);
|
||||
server->tcpfd = -1;
|
||||
/* We get data then EOF, reopen connection to same server,
|
||||
else try next. This avoids DoS from a server which accepts
|
||||
connections and then closes them. */
|
||||
if (server->flags & SERV_GOT_TCP)
|
||||
goto retry;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
server->flags |= SERV_GOT_TCP;
|
||||
|
||||
m = (c1 << 8) | c2;
|
||||
new_status = tcp_key_recurse(now, new_status, new_header, m, class, name, keyname, server, have_mark, mark, keycount);
|
||||
break;
|
||||
}
|
||||
|
||||
if (new_status != STAT_OK)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (packet)
|
||||
free(packet);
|
||||
|
||||
@@ -1820,7 +1826,8 @@ unsigned char *tcp_request(int confd, time_t now,
|
||||
(type == SERV_HAS_DOMAIN && !hostname_isequal(domain, last_server->domain)) ||
|
||||
(last_server->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
|
||||
continue;
|
||||
|
||||
|
||||
retry:
|
||||
if (last_server->tcpfd == -1)
|
||||
{
|
||||
if ((last_server->tcpfd = socket(last_server->addr.sa.sa_family, SOCK_STREAM, 0)) == -1)
|
||||
@@ -1840,25 +1847,27 @@ unsigned char *tcp_request(int confd, time_t now,
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DNSSEC
|
||||
if (option_bool(OPT_DNSSEC_VALID) && (last_server->flags & SERV_DO_DNSSEC))
|
||||
{
|
||||
new_size = add_do_bit(header, size, ((unsigned char *) header) + 65536);
|
||||
|
||||
if (size != new_size)
|
||||
{
|
||||
added_pheader = 1;
|
||||
size = new_size;
|
||||
}
|
||||
|
||||
/* For debugging, set Checking Disabled, otherwise, have the upstream check too,
|
||||
this allows it to select auth servers when one is returning bad data. */
|
||||
if (option_bool(OPT_DNSSEC_DEBUG))
|
||||
header->hb4 |= HB4_CD;
|
||||
}
|
||||
#endif
|
||||
last_server->flags &= ~SERV_GOT_TCP;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DNSSEC
|
||||
if (option_bool(OPT_DNSSEC_VALID) && (last_server->flags & SERV_DO_DNSSEC))
|
||||
{
|
||||
new_size = add_do_bit(header, size, ((unsigned char *) header) + 65536);
|
||||
|
||||
if (size != new_size)
|
||||
{
|
||||
added_pheader = 1;
|
||||
size = new_size;
|
||||
}
|
||||
|
||||
/* For debugging, set Checking Disabled, otherwise, have the upstream check too,
|
||||
this allows it to select auth servers when one is returning bad data. */
|
||||
if (option_bool(OPT_DNSSEC_DEBUG))
|
||||
header->hb4 |= HB4_CD;
|
||||
}
|
||||
#endif
|
||||
|
||||
*length = htons(size);
|
||||
|
||||
/* get query name again for logging - may have been overwritten */
|
||||
@@ -1872,9 +1881,17 @@ unsigned char *tcp_request(int confd, time_t now,
|
||||
{
|
||||
close(last_server->tcpfd);
|
||||
last_server->tcpfd = -1;
|
||||
continue;
|
||||
}
|
||||
/* We get data then EOF, reopen connection to same server,
|
||||
else try next. This avoids DoS from a server which accepts
|
||||
connections and then closes them. */
|
||||
if (last_server->flags & SERV_GOT_TCP)
|
||||
goto retry;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
last_server->flags |= SERV_GOT_TCP;
|
||||
|
||||
m = (c1 << 8) | c2;
|
||||
|
||||
if (last_server->addr.sa.sa_family == AF_INET)
|
||||
|
||||
@@ -104,7 +104,7 @@ void inotify_dnsmasq_init()
|
||||
|
||||
strcpy(path, res->name);
|
||||
|
||||
/* Follow symlinks until we reach a non-symlink, or a non-existant file. */
|
||||
/* Follow symlinks until we reach a non-symlink, or a non-existent file. */
|
||||
while ((new_path = my_readlink(path)))
|
||||
{
|
||||
if (links-- == 0)
|
||||
|
||||
@@ -1438,6 +1438,7 @@ void check_servers(void)
|
||||
struct server *serv;
|
||||
struct serverfd *sfd, *tmp, **up;
|
||||
int port = 0, count;
|
||||
int locals = 0;
|
||||
|
||||
/* interface may be new since startup */
|
||||
if (!option_bool(OPT_NOWILD))
|
||||
@@ -1541,7 +1542,11 @@ void check_servers(void)
|
||||
s1 = _("domain"), s2 = serv->domain;
|
||||
|
||||
if (serv->flags & SERV_NO_ADDR)
|
||||
my_syslog(LOG_INFO, _("using local addresses only for %s %s"), s1, s2);
|
||||
{
|
||||
count--;
|
||||
if (++locals <= LOCALS_LOGGED)
|
||||
my_syslog(LOG_INFO, _("using local addresses only for %s %s"), s1, s2);
|
||||
}
|
||||
else if (serv->flags & SERV_USE_RESOLV)
|
||||
my_syslog(LOG_INFO, _("using standard nameservers for %s %s"), s1, s2);
|
||||
else
|
||||
@@ -1558,6 +1563,8 @@ void check_servers(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (locals > LOCALS_LOGGED)
|
||||
my_syslog(LOG_INFO, _("using %d more local addresses"), locals - LOCALS_LOGGED);
|
||||
if (count - 1 > SERVERS_LOGGED)
|
||||
my_syslog(LOG_INFO, _("using %d more nameservers"), count - SERVERS_LOGGED - 1);
|
||||
|
||||
|
||||
@@ -426,6 +426,19 @@ int private_net(struct in_addr addr, int ban_localhost)
|
||||
((ip_addr & 0xFFFFFFFF) == 0xFFFFFFFF) /* 255.255.255.255/32 (broadcast)*/ ;
|
||||
}
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
static int private_net6(struct in6_addr *a)
|
||||
{
|
||||
return
|
||||
IN6_IS_ADDR_UNSPECIFIED(a) || /* RFC 6303 4.3 */
|
||||
IN6_IS_ADDR_LOOPBACK(a) || /* RFC 6303 4.3 */
|
||||
IN6_IS_ADDR_LINKLOCAL(a) || /* RFC 6303 4.5 */
|
||||
((unsigned char *)a)[0] == 0xfd || /* RFC 6303 4.4 */
|
||||
((u32 *)a)[0] == htonl(0x20010db8); /* RFC 6303 4.6 */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static unsigned char *do_doctor(unsigned char *p, int count, struct dns_header *header, size_t qlen, char *name, int *doctored)
|
||||
{
|
||||
int i, qtype, qclass, rdlen;
|
||||
@@ -1184,7 +1197,7 @@ static unsigned long crec_ttl(struct crec *crecp, time_t now)
|
||||
if (crecp->flags & F_IMMORTAL)
|
||||
return crecp->ttd;
|
||||
|
||||
/* Return the Max TTL value if it is lower then the actual TTL */
|
||||
/* Return the Max TTL value if it is lower than the actual TTL */
|
||||
if (daemon->max_ttl == 0 || ((unsigned)(crecp->ttd - now) < daemon->max_ttl))
|
||||
return crecp->ttd - now;
|
||||
else
|
||||
@@ -1440,20 +1453,22 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
||||
anscount++;
|
||||
}
|
||||
}
|
||||
else if (is_arpa == F_IPV4 &&
|
||||
option_bool(OPT_BOGUSPRIV) &&
|
||||
private_net(addr.addr.addr4, 1))
|
||||
else if (option_bool(OPT_BOGUSPRIV) && (
|
||||
#ifdef HAVE_IPV6
|
||||
(is_arpa == F_IPV6 && private_net6(&addr.addr.addr6)) ||
|
||||
#endif
|
||||
(is_arpa == F_IPV4 && private_net(addr.addr.addr4, 1))))
|
||||
{
|
||||
/* if not in cache, enabled and private IPV4 address, return NXDOMAIN */
|
||||
ans = 1;
|
||||
sec_data = 0;
|
||||
nxdomain = 1;
|
||||
if (!dryrun)
|
||||
log_query(F_CONFIG | F_REVERSE | F_IPV4 | F_NEG | F_NXDOMAIN,
|
||||
log_query(F_CONFIG | F_REVERSE | is_arpa | F_NEG | F_NXDOMAIN,
|
||||
name, &addr, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (flag = F_IPV4; flag; flag = (flag == F_IPV4) ? F_IPV6 : 0)
|
||||
{
|
||||
unsigned short type = T_A;
|
||||
@@ -1520,7 +1535,7 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
||||
|
||||
enumerate_interfaces(0);
|
||||
|
||||
/* See if a putative address is on the network from which we recieved
|
||||
/* See if a putative address is on the network from which we received
|
||||
the query, is so we'll filter other answers. */
|
||||
if (local_addr.s_addr != 0 && option_bool(OPT_LOCALISE) && type == T_A)
|
||||
for (intr = daemon->int_names; intr; intr = intr->next)
|
||||
|
||||
@@ -38,7 +38,7 @@ static void log_packet(char *type, void *addr, unsigned char *ext_mac,
|
||||
static unsigned char *option_find(struct dhcp_packet *mess, size_t size, int opt_type, int minsize);
|
||||
static unsigned char *option_find1(unsigned char *p, unsigned char *end, int opt, int minsize);
|
||||
static size_t dhcp_packet_size(struct dhcp_packet *mess, unsigned char *agent_id, unsigned char *real_end);
|
||||
static void clear_packet(struct dhcp_packet *mess, unsigned char *end);
|
||||
static void clear_packet(struct dhcp_packet *mess, unsigned char *end, unsigned int sz);
|
||||
static int in_list(unsigned char *list, int opt);
|
||||
static void do_options(struct dhcp_context *context,
|
||||
struct dhcp_packet *mess,
|
||||
@@ -611,7 +611,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
now);
|
||||
lease_set_interface(lease, int_index, now);
|
||||
|
||||
clear_packet(mess, end);
|
||||
clear_packet(mess, end, 0);
|
||||
do_options(context, mess, end, NULL, hostname, get_domain(mess->yiaddr),
|
||||
netid, subnet_addr, 0, 0, -1, NULL, vendor_class_len, now, 0xffffffff, 0);
|
||||
}
|
||||
@@ -814,7 +814,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
if (!service || !service->basename || !context)
|
||||
return 0;
|
||||
|
||||
clear_packet(mess, end);
|
||||
clear_packet(mess, end, sz);
|
||||
|
||||
mess->yiaddr = mess->ciaddr;
|
||||
mess->ciaddr.s_addr = 0;
|
||||
@@ -882,7 +882,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
mess->flags |= htons(0x8000); /* broadcast */
|
||||
}
|
||||
|
||||
clear_packet(mess, end);
|
||||
clear_packet(mess, end, sz);
|
||||
|
||||
/* Redirect EFI clients to port 4011 */
|
||||
if (pxearch >= 6)
|
||||
@@ -1062,7 +1062,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
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));
|
||||
clear_packet(mess, end);
|
||||
clear_packet(mess, end, sz);
|
||||
option_put(mess, end, OPTION_MESSAGE_TYPE, 1, DHCPOFFER);
|
||||
option_put(mess, end, OPTION_SERVER_IDENTIFIER, INADDRSZ, ntohl(server_id(context, override, fallback).s_addr));
|
||||
option_put(mess, end, OPTION_LEASE_TIME, 4, time);
|
||||
@@ -1245,7 +1245,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
log_packet("DHCPNAK", &mess->yiaddr, emac, emac_len, iface_name, NULL, message, mess->xid);
|
||||
|
||||
mess->yiaddr.s_addr = 0;
|
||||
clear_packet(mess, end);
|
||||
clear_packet(mess, end, sz);
|
||||
option_put(mess, end, OPTION_MESSAGE_TYPE, 1, DHCPNAK);
|
||||
option_put(mess, end, OPTION_SERVER_IDENTIFIER, INADDRSZ, ntohl(server_id(context, override, fallback).s_addr));
|
||||
option_put_string(mess, end, OPTION_MESSAGE, message, borken_opt);
|
||||
@@ -1401,7 +1401,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
|
||||
log_packet("DHCPACK", &mess->yiaddr, emac, emac_len, iface_name, hostname, NULL, mess->xid);
|
||||
|
||||
clear_packet(mess, end);
|
||||
clear_packet(mess, end, sz);
|
||||
option_put(mess, end, OPTION_MESSAGE_TYPE, 1, DHCPACK);
|
||||
option_put(mess, end, OPTION_SERVER_IDENTIFIER, INADDRSZ, ntohl(server_id(context, override, fallback).s_addr));
|
||||
option_put(mess, end, OPTION_LEASE_TIME, 4, time);
|
||||
@@ -1452,7 +1452,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
override = lease->override;
|
||||
}
|
||||
|
||||
clear_packet(mess, end);
|
||||
clear_packet(mess, end, sz);
|
||||
option_put(mess, end, OPTION_MESSAGE_TYPE, 1, DHCPACK);
|
||||
option_put(mess, end, OPTION_SERVER_IDENTIFIER, INADDRSZ, ntohl(server_id(context, override, fallback).s_addr));
|
||||
|
||||
@@ -2180,12 +2180,23 @@ static struct dhcp_opt *pxe_opts(int pxe_arch, struct dhcp_netid *netid, struct
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void clear_packet(struct dhcp_packet *mess, unsigned char *end)
|
||||
|
||||
static void clear_packet(struct dhcp_packet *mess, unsigned char *end, unsigned int sz)
|
||||
{
|
||||
unsigned char *opt;
|
||||
unsigned int clid_tot = 0;
|
||||
|
||||
/* If sz is non-zero, save any client-id option by copying it as the first
|
||||
option in the new packet */
|
||||
if (sz != 0 && (opt = option_find(mess, sz, OPTION_CLIENT_ID, 1)))
|
||||
{
|
||||
clid_tot = option_len(opt) + 2u;
|
||||
memmove(&mess->options[0] + sizeof(u32), opt, clid_tot);
|
||||
}
|
||||
|
||||
memset(mess->sname, 0, sizeof(mess->sname));
|
||||
memset(mess->file, 0, sizeof(mess->file));
|
||||
memset(&mess->options[0] + sizeof(u32), 0, end - (&mess->options[0] + sizeof(u32)));
|
||||
memset(&mess->options[0] + sizeof(u32) + clid_tot, 0, end - (&mess->options[0] + sizeof(u32) + clid_tot));
|
||||
mess->siaddr.s_addr = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# The root DNSSEC trust anchor, valid as at 30/01/2014
|
||||
# The root DNSSEC trust anchor, valid as at 10/02/2017
|
||||
|
||||
# Note that this is a DS record (ie a hash of the root Zone Signing Key)
|
||||
# If was downloaded from https://data.iana.org/root-anchors/root-anchors.xml
|
||||
|
||||
trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
|
||||
trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user