Commit Graph

1497 Commits

Author SHA1 Message Date
Simon Kelley
05299fdd5a Fix wrong return code from explore_rrset() with some errors. 2019-07-15 22:04:20 +01:00
Simon Kelley
343b7b4ad0 Support multiple daemon instances with systemd in Debian. 2019-04-08 16:50:13 +01:00
Jan Willem Janssen
a2b8220f4e Improved UBus supported
- aligned the handling of UBus connections with the DBus code as it
makes it a bit easier to comprehend;
- added logging to the various UBus calls to aid debugging from an
enduser point of view, but be careful to not flood the logs;
- show the (lack of) support for UBus in the configuration string.
2019-04-04 15:58:07 +01:00
Simon Kelley
5c464ef62e Allow more then one --conf-file on the command line. 2019-03-29 23:11:05 +00:00
Simon Kelley
5fc639cf9a Don't retry close() syscalls after an EINTR errors.
http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2019q1/012953.html
2019-03-29 21:29:43 +00:00
Simon Kelley
7673013d23 Apply fix from c6cc455dd1 in DHCP code. 2019-03-28 22:04:10 +00:00
Jérémie Courrèges-Anglas
c6cc455dd1 Fix cmsg(3) API usage on OpenBSD
msg_controllen should be set using CMSG_SPACE() to account for padding.
RFC3542 provides more details:

  While sending an application may or may not include padding at the end
  of last ancillary data in msg_controllen and implementations must
  accept both as valid.

At least OpenBSD rejects control messages if msg_controllen doesn't
account for padding, so use CMSG_SPACE() for maximal portability.  This
is consistent with the example provided in the Linux cmsg(3) manpage.
2019-03-28 21:49:48 +00:00
Simon Kelley
1da81f7e23 CHANGELOG typo fix. 2019-03-28 13:51:11 +00:00
Simon Kelley
ae5b7e04a1 Add --shared-network DHCP configuration. 2019-03-27 22:33:28 +00:00
Simon Kelley
305ffb5ef0 Improve kernel-capability manipulation code under Linux.
Dnsmasq now fails early if a required capability is not available,
and tries not to request capabilities not required by its
configuration.
2019-03-16 18:17:17 +00:00
Simon Kelley
608aa9fcfc Support TCP fastopen on incoming and outgoing connections. 2019-03-10 22:52:54 +00:00
Dominik DL6ER
c61c7bb225 Remove redundant prototypes from dnsmasq.h
Dear Simon,

the attached patch removes three redundant prototypes from dnsmasq.h. There is no functional change.

Best regards,
Dominik

From c0b2ccfd20c4eec9d09468fdfe9b4ca8a8f8591e Mon Sep 17 00:00:00 2001
From: DL6ER <dl6er@dl6er.de>
Date: Sun, 10 Mar 2019 19:34:07 +0100
Subject: [PATCH] Remove redundant prototypes from dnsmasq.h

Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-10 20:31:57 +00:00
Simon Kelley
5ed82ae5f2 Remove unclear gcc-ism in conditional expression. 2019-03-05 16:38:34 +00:00
Simon Kelley
6799320edb Don't attempt to parse a sequence of hex digits without any colons as IPv6 address.
Another confusion in the heuristic dhcp-option parsing. Sigh.
2019-03-04 22:59:42 +00:00
Simon Kelley
c406fd60be Add Vcs-* fields to Debian control file. 2019-03-01 17:23:01 +00:00
Simon Kelley
5d514f22a9 Fix nodocs/nodoc confusion in Debian packaging. 2019-03-01 16:52:02 +00:00
Simon Kelley
a066aac332 Fix to credits in 162e5e0062 2019-03-01 16:18:07 +00:00
Simon Kelley
8bd28a87a2 Small error-message tweak, for clarity. 2019-03-01 15:00:12 +00:00
Simon Kelley
065e5bb0b1 More /etc/hosts linecount fixing. 2019-03-01 14:38:51 +00:00
Florent Fourcot
df6636bff6 lease: prune lease as soon as expired
We detected a performance issue on a dnsmasq running many dhcp sessions
(more than 10 000). At the end of the day, the server was only releasing
old DHCP leases but was consuming a lot of CPU.

It looks like curent dhcp pruning:
 1) it's pruning old sessions (iterate on all current leases). It's
 important to note that it's only pruning session expired since more
 than one second
 2) it's looking for next lease to expire (iterate on all current leases
 again)
 3) it launchs an alarm to catch next expiration found in step 2). This
 value can be zero for leases just expired (but not pruned).

So, for a second, dnsmasq could fall in a "prune loop" by doing:
 * Not pruning anything, since difftime() is not > 0
 * Run alarm again with zero as argument

On a server with very large number of leases and releasing often
sessions, that can waste a very big CPU time.

Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>
2019-02-27 21:28:32 +00:00
Sven Mueller
162e5e0062 Fix bug added in 2.80 non-terminal code which returns NODATA instead of NXDOMAIN.
Thanks to Sven Muleller and Maciej Żenczykowski for work on this.

https://bugzilla.redhat.com/show_bug.cgi?id=1674067 refers.
2019-02-27 21:17:37 +00:00
Simon Kelley
4219adeeef Fix line counting when reading /etc/hosts. 2019-02-27 20:30:21 +00:00
Brian Haley
28cfe36e1e Change read_leases() to skip invalid entries.
There's no reason to stop reading the existing lease file
when dnsmasq is started and an invalid entry is found, it
can just be ignored.  This was fallout from an Openstack
bug where the file was being written incorrectly with []
around IPv6 addresses.
2019-01-17 23:21:23 +00:00
Steven Siloti
d2d4990743 Fix missing braces in 8eac67c0a15b673c8d27002c248651b308093e4 2019-01-17 22:52:13 +00:00
Steven Siloti
18eac67c0a Fix entries in /etc/hosts disabling static leases.
It is possible for a config entry to have one address family specified by a
dhcp-host directive and the other added from /etc/hosts. This is especially
common on OpenWrt because it uses odhcpd for DHCPv6 and IPv6 leases are
imported into dnsmasq via a hosts file.

To handle this case there need to be separate *_HOSTS flags for IPv4 and IPv6.
Otherwise when the hosts file is reloaded it will clear the CONFIG_ADDR(6) flag
which was set by the dhcp-host directive.
2019-01-13 22:56:36 +00:00
Simon Kelley
f8c77edbdf Fix removal of DHCP_CLIENT_MAC options from DHCPv6 relay replies. 2019-01-10 21:58:18 +00:00
Simon Kelley
4bf62f616b Tidy cache_blockdata_free() 2019-01-10 21:54:22 +00:00
Simon Kelley
9c0d445ef4 Fix e7bfd556c0 to actually work. 2019-01-09 18:04:39 +00:00
Simon Kelley
2896e2485e Check for not(DS or DNSKEY) in is_outdated_cname_pointer()
Previous check was _for_ IPV4, IPv6 CNAME, and I missed adding SRV.
2019-01-09 15:12:34 +00:00
Simon Kelley
a90f09db4c Fix crash freeing negative SRV cache entries.
Thanks to Daniel for finding this one.
2019-01-09 15:08:16 +00:00
Simon Kelley
5b99eae59d Cache SRV records.
Inpsired by a patch from Jeremy Allison, but completely re-rolled
by srk. All bugs are mine.
2019-01-06 23:09:50 +00:00
Christian Weiske
2daca52b80 Fix typo in ra-param man page section. 2019-01-03 20:10:14 +00:00
Simon Kelley
2c594732eb File logic bug in cache-marshalling code. Introduced a couple of commits back. 2019-01-03 13:42:03 +00:00
Simon Kelley
cc921df9ce Remove nested struct/union in cache records and all_addr. 2019-01-02 22:48:59 +00:00
Simon Kelley
ab194ed7ca Futher address union tidying.
Pass DNSKEY and DS data into cache_insert via the address argument,
now these data types are included in struct all_addr.
2019-01-01 01:35:30 +00:00
Simon Kelley
65a01b71bb Tidy address-union handling: move class into explicit argument.
This moves the class argument to cache-insert into an argument,
rather then overloading a union in the address argument. Note that
tha class is NOT stored in the cache other than for DS/DNSKEY entries,
so must always be C_IN except for these. The data-extraction code
ensures this as it only attempts to cache C_IN class records.
2018-12-31 23:56:33 +00:00
Simon Kelley
bde46476ee Tidy all_addr union, merge log and rcode fields. 2018-12-31 23:28:24 +00:00
Simon Kelley
e7bfd556c0 Alter DHCP address selection after DECLINE in consec-addr mode.
Avoid offering the same address after a recieving a DECLINE message
to stop an infinite protocol loop. This has long been done in
default address allocation mode: this adds similar behaviour
when allocaing addresses consecutively.
2018-12-31 20:51:15 +00:00
Kevin Darbyshire-Bryant
b683cf37f9 build failure on master with NO_DHCPv6 and fix....
Hi Simon,

master has a build error when building without HAVE_DHCPv6

option.c: In function 'dhcp_context_free':
option.c:1042:15: error: 'struct dhcp_context' has no member named 'template_interface'
       free(ctx->template_interface);

Sadly, need to put in a little conditional compilation ifdef'erey

Simplest patch in the world attached

Cheers,

Kevin D-B

012C ACB2 28C6 C53E 9775  9123 B3A2 389B 9DE2 334A

From 061eb8599636bb360e0b7fa5986935b86db39497 Mon Sep 17 00:00:00 2001
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Date: Mon, 10 Dec 2018 10:07:33 +0000
Subject: [PATCH] option: fix non DHCPv6 build error

option.c: In function 'dhcp_context_free':
option.c:1042:15: error: 'struct dhcp_context' has no member named 'template_interface'
       free(ctx->template_interface);
		^~

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2018-12-16 21:35:35 +00:00
Kevin Darbyshire-Bryant
3becf468ba fix ipv6 ipset bug in master
Hi Simon,

Another one fallen out of the openwrt tree shake :-)

ipv6 ipset addresses weren’t being set correctly.  patch attached

Cheers,

Kevin D-B

012C ACB2 28C6 C53E 9775  9123 B3A2 389B 9DE2 334A
From b50fc0491e374186f982b019f293379955afd203 Mon Sep 17 00:00:00 2001
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Date: Wed, 12 Dec 2018 11:35:12 +0000
Subject: [PATCH] ipset fix ternary order swap

ee87504 Remove ability to compile without IPv6 support introduced a
ternary operator for ip address size.  Unfortunately the true/false
order was incorrect which meant ipv6 ipset addresses were added
incorrectly.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2018-12-16 21:32:05 +00:00
Petr Menšík
137e9f878f Fix option parsing errors introduced in 59e470381f
Thanks to Kevin Darbyshire-Bryant for spotting this.
2018-12-16 21:25:29 +00:00
Simon Kelley
07e25da5bf Treat DS and DNSKEY queries being forwarded the same as those locally originated.
The queries will not be forwarded to a server for a domain, unless
there's a trust anchor provided for that domain. This allows, especially,
suitable proof of non-existance for DS records to come from
the parent domain for domains which are not signed.
2018-12-16 18:21:58 +00:00
Simon Kelley
d46ee724fc Bump Debian version. 2018-11-02 23:10:00 +00:00
Petr Menšík
59e470381f Free config file values on parsing errors.
This time I have a little bit more controversal patches. But I think
still useful. They fixes memory leaks that might occur in some cases.
Most dnsmasq errors is fatal, so it does not matter. But some are not.
Some parts are reloaded on SIGHUP signal, so it might leak more than once.

Some example when it changes the failures. Use dhcp-options file with
this content:

tag:error,vendor:redhat
option:ntp-server,1.2.3.4.5
option6:ntp-server,[:::]

Is not fatal and dnsmasq will start. On each reload command, it would
leak some memory. I validated it using valgrind --leak-check=full
dnsmasq -d. This patch fixes it. It introduces something that might be
considered constructor and destructor of selected structures.
2018-11-02 22:39:39 +00:00
Simon Kelley
48d12f14c9 Remove the NO_FORK compile-time option, and support for uclinux.
In an era where everything has an MMU, this looks like
an anachronism, and it adds to (Ok, multiplies!) the
combinatorial explosion of compile-time options.
2018-11-02 21:55:04 +00:00
Simon Kelley
122392e0b3 Revert 68f6312d4b
The above is intended to increase robustness, but actually does the
opposite. The problem is that by ignoring SERVFAIL messages and hoping
for a better answer from another of the servers we've forwarded to,
we become vulnerable in the case that one or more of the configured
servers is down or not responding.

Consider the case that a domain is indeed BOGUS, and we've send the
query to n servers. With 68f6312d4b
we ignore the first n-1 SERVFAIL replies, and only return the
final n'th answer to the client. Now, if one of the servers we are
forwarding to is down, then we won't get all n replies, and the
client will never get an answer! This is a far more likely scenario
than a temporary SERVFAIL from only one of a set of notionally identical
servers, so, on the ground of robustness, we have to believe
any SERVFAIL answers we get, and return them to the client.

The client could be using the same recursive servers we are,
so it should, in theory, retry on SERVFAIL anyway.
2018-10-31 22:24:02 +00:00
Simon Kelley
3a5a84cdd1 Fix Makefile lines generating UBUS linker config.
If arg2 of pkg-wrapper is "--copy", then arg1 is NOT the name of
the package manager (--copy doesn't invoke it) it's a secondary
config string that inhibts the copy if found. This patch allows that
to be the empty string, for unconditional copy, and modifies the
ubus linker config to use it. It worked by coincidence before, because
there was no config string called "pkg-config".
2018-10-31 21:30:13 +00:00
Petr Menšík
24b87607c1 Do not rely on dead code elimination, use array instead.
Make options bits derived from size and count. Use size of option bits
and last supported bit in computation. No new change would be required
when new options are added. Just change OPT_LAST constant.
2018-10-24 22:30:18 +01:00
Simon Kelley
6f7812d97b Fix spurious AD flags in some DNS replies from local config. 2018-10-23 23:54:44 +01:00
Simon Kelley
cbb5b17ad8 Fix logging in cf5984367b 2018-10-23 23:45:57 +01:00