Commit Graph
3825 Commits
Author SHA1 Message Date
Simon Kelley 83ec0e70a8 Fix massive confusion on server reload.
The 2.86 upstream server rewrite severely broke re-reading
of server configuration. It would get everyting right the first
time, but on re-reading /etc/resolv.conf or --servers-file
or setting things with DBUS, the results were just wrong.

This should put things right again.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 19:15:29 +01:00
Simon Kelley 84b0f7e091 Fix logic in add_update_server() to make optimisation actually optimise.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 19:15:16 +01:00
Simon Kelley 6fd459496a Use host byte-order variable for answer counting.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 19:15:12 +01:00
Simon Kelley 40557938a6 Fix crash after re-reading an empty resolv.conf file.
If dnsmasq re-reads a resolv file, and it's empty, it will
retry after a delay. In the meantime, the old servers from the
resolv file have been deleted, but the servers_array doesn't
get updated, leading to dangling pointers and crashes.

Thanks to Brad Jorsch for finding and analysing this bug.

This problem was introduced in 2.86.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 19:15:03 +01:00
Simon Kelley 9deef8458b Fix fail to build when NO_SCRIPT set.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 18:57:35 +01:00
Fabrice Fontaine 7b3df66a39 src/option.c: fix build with gcc 4.8
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 18:57:24 +01:00
Simon Kelley a94e061a08 Tidy code for --umbrella option.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 18:56:32 +01:00
Simon Kelley 3a6b222bef Fix 46312909d9080ff8743133fbd52427b4b2213171 typo.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 18:55:17 +01:00
Fabrice Fontaine 5e4dd996b8 src/option.c: fix build with gcc 4.8
Fix the following build failure with gcc 4.8 raised since version 2.86:

option.c: In function 'one_opt':
option.c:2445:11: error: 'for' loop initial declarations are only allowed in C99 mode
           for (char *p = arg; *p; p++) {
           ^
option.c:2445:11: note: use option -std=c99 or -std=gnu99 to compile your code
option.c:2453:11: error: 'for' loop initial declarations are only allowed in C99 mode
           for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
           ^

Fixes:
 - http://autobuild.buildroot.org/results/39b34a4e69fc10f4bd9d4ddb0ed8c0aae5741c84

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 18:55:13 +01:00
Simon Kelley 15a389bcfc Include client address if TFTP file-not-found errors.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-04 18:54:42 +01:00
Simon Kelley edf70fcd5e Finesse parsing of --dhcp-remoteid and --dhcp-subscrid.
To be treated as hex, the pattern must consist of only hex digits AND
contain at least one ':'. Thanks to Bengt-Erik Sandstrom who tripped
over a pattern consisting of a decimal number which was interpreted
surprisingly.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-31 11:19:33 +01:00
Simon Kelley e519fcfc0d Add snooping of DHCPv6 prefix delegation to the DHCP-relay function.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-31 11:19:28 +01:00
Simon Kelley 5c41929968 Fix wrong client address for dhcp-script when DHCPv4 relay in use.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-31 11:16:55 +01:00
DL6ER 7f61a59fb2 Merge branch 'development' into update/dnsmasq 2021-12-31 11:15:08 +01:00
DL6ER c190eab58b Merge pull request #1267 from pi-hole/tweak/cache_info
Fix cache statistics
2021-12-30 22:39:36 +01:00
DL6ER 7c0a9c1fd6 Count immortal cache entries as valid. They can just never expire.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-30 14:52:23 +01:00
DL6ER e9db358297 Merge pull request #1264 from pi-hole/new/telnet-dns-port
Return DNS port on ">dns-port" telnet command
2021-12-29 11:09:21 +01:00
DL6ER 43f79ae011 Test: API reports DNS server port
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-28 11:22:25 +01:00
DL6ER 6ecc1cf069 Return DNS port on ">dns-port" telnet command
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-28 11:16:13 +01:00
DL6ER 106ef8c767 Merge pull request #1262 from pi-hole/new/human_readable_tables
Add human-readable table output mode
2021-12-26 10:39:07 +01:00
DL6ER db153cc59f Christmas is not Easter
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-26 10:19:10 +01:00
Simon Kelley c7e647ec10 Fix rare "Internal error in cache" messages.
Fix error created in 1ce1c6beae9f683bec54cba4c0d375f85b209b95

Many thanks to Hartmut Birr for finding the bug and bisecting to
the guilty commit.

The breaking commit creates cache entries which have F_NXDOMAIN
set but none of F_IPV4, F_IPV6 or F_SRV. If cache_scan_free() is called
to delete such an entry it will fail to do so.

If the cache has no free slots and the least-recently-used slot is such
an entry, then a new insertion will attempt to make space by calling
cache_scan_free(), which will fail when it should be impossible and
trigger the internal error.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-25 21:16:35 +01:00
Simon Kelley eb9cf5ba3b Generalise --dhcp-relay.
Sending via broadcast/multicast is now supported for both
IPv4 and IPv6 and the configuration syntax made
easier (but backwards compatible).

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-25 21:16:30 +01:00
DL6ER 436623941a Add human-readable table output mode
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-24 13:22:46 +01:00
DL6ER 8a11adbd74 Merge pull request #1259 from pi-hole/fix/locale_stats
Fix locale issue in Telnet API
2021-12-24 07:44:38 +01:00
DL6ER 3511341fb6 Ensure locale LC_NUMERIC is always C to ensure FTL uses a standared form for numbers interchange
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-23 21:30:11 +01:00
DL6ER 92a27e73ba Merge pull request #1230 from pi-hole/update/dnsmasq
Update embedded dnsmasq to v2.87test4-6
2021-12-20 22:21:17 +01:00
DL6ER d294b2f5e2 Update dnsmasq version string
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-20 21:37:21 +01:00
Simon Kelley 89a8864e01 Fix regression in --rebind-domain-ok in 2.86
The 2.86 domain-match rewrite changed matching from
whole-labels to substring matching, so example.com
would match example.com and www.example.com, as before,
but also goodexample.com, which is a regression. This
restores the original behaviour.

Also restore the behaviour of --rebind-domain-ok=//
to match domains with onlt a single label and no dots.

Thanks to Sung Pae for reporting these bugs and supplying
an initial patch.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-19 14:50:20 +01:00
guns 768b10dcfd Correctly return a heap-allocated empty string instead of NULL
Commit 32e15c3f458c2e8838a9ecf7d478ecb6750516bf added the following
change:

  --- a/src/dnsmasq/option.c
  +++ b/src/dnsmasq/option.c
  @@ -654,7 +654,7 @@ static char *canonicalise_opt(char *s)
       return 0;

     if (strlen(s) == 0)
  -    return "";
  +    return opt_string_alloc("");

     unhide_metas(s);
     if (!(ret = canonicalise(s, &nomem)) && nomem)

Unfortunately, opt_string_alloc(const char *cp) returns NULL when
strlen(cp) == 0, which in turn causes --rebind-domain-ok='' to crash
with SIGSEGV.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-19 14:50:14 +01:00
DL6ER d987d3c40b Merge pull request #1252 from pi-hole/tweak/abort
Do not catch SIGABRT
2021-12-02 18:11:13 +01:00
DL6ER 9c16f71ef7 Merge pull request #1246 from pi-hole/test/dnsmasq_warnings
Test for dnsmasq warning messages in source code
2021-12-02 09:31:53 +01:00
DL6ER 5b9eefd120 Merge pull request #1251 from pi-hole/update/sqlite_3.37.0
Update SQLite engine from 3.36.0 to 3.37.0
2021-12-02 06:59:05 +01:00
DL6ER db5e13d361 Update SQLite engine from 3.36.0 to 3.37.0
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-01 19:40:36 +01:00
DL6ER 9c5f14d3f6 Merge branch 'development' into update/dnsmasq 2021-12-01 18:41:42 +01:00
Simon Kelley 2924c2993b Fix confusion with log-IDs and DNS retries.
The IDs logged when --log-queries=extra is in effect
can be wrong in three cases.

1) When query is retried in response to a a SERVFAIL or REFUSED
answer from upstream. In this case the ID of an unrelated query will
appear in the answer log lines.

2) When the same query arrives from two clients. The query is
sent upstream once, as designed, and the result returned to both clients,
as designed, but the reply to the first client gets the log-ID of the
second query in error.

3) When a query arrives, is sent upstream, and the reply comes back,
but the transaction is blocked awaiting a DNSSEC query needed to validate
the reply. If the client retries the query in this state, the blocking
DNSSEC query will be resent, as designed, but that send will be logged with
the ID of the original, currently blocked, query.

Thanks to  Dominik Derigs for his analysis of this problem.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-01 18:41:33 +01:00
DL6ER 50eac5dcda Revert "Ensure correct query ID is stored in forward->frec_src"
This reverts commit 93cf7f844c.
2021-12-01 18:41:15 +01:00
Simon Kelley ea689a2798 Fix problems with upper-case in domain-match.
The domain-match rewrite didn't take into account
that domain names are case-insensitive, so things like

--address=/Example.com/.....

didn't work correctly.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-01 16:33:39 +01:00
DL6ER d53b0f6f0d Merge pull request #1249 from pi-hole/tweak/warn_resources
Warn about resource shortages
2021-12-01 07:08:30 +01:00
DL6ER 1729c2815f Merge pull request #1250 from pi-hole/tweak/conditional_domainsuffix
Add support for conditional domain suffices in HOSTNAMEFQDN mode
2021-11-30 17:06:42 +01:00
DL6ER 49b46d49c1 Fix config logging for new options
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-30 16:05:08 +01:00
DL6ER 9c3ff7e06d Remove redundant warning limit (now defined in config.c)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-30 15:47:44 +01:00
DL6ER ff16446392 Review suggestion + we should not warn about load on the CI as this is out of our control
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-29 18:55:01 +01:00
DL6ER e9bb30142b Add support for conditional domain suffices in HOSTNAMEFQDN mode
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-29 15:58:40 +01:00
DL6ER 6d7bbcb91c Add options CHECK_LOAD, CHECK_SHMEM, and CHECK_DISK to control checking levels and disabling warnings.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-29 15:53:41 +01:00
DL6ER 4c2c59b214 Warn about resource shortages (15min load average exceeding number of cores, available disk space for database and log file, and available shared memory (RAM))
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-29 14:11:15 +01:00
DL6ER 2599cf19ff Test for warnings defined in dnsmasq's source code
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-24 22:06:50 +01:00
DL6ER 0d44449e7e Merge pull request #1244 from pi-hole/tweak/dbclose
Ensure dbclose() is not called multiple times
2021-11-19 13:22:31 +01:00
DL6ER 028989bcae Reduce code duplication by using labels + ensure we do not run dbclose() multiple times on database issues (e.g., when database is locked)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-14 13:01:39 +01:00
DL6ER 827b55af8a Merge pull request #1243 from pi-hole/tweak/warning_messages
Add dnsmasq warnings to message table
2021-11-14 13:00:01 +01:00