Commit Graph
1735 Commits
Author SHA1 Message Date
DL6ER bfd2c988ce Merge pull request #1491 from pi-hole/update/dnsmasq
Update embedded dnsmasq to v2.88rc3
2022-11-19 09:34:44 +01:00
Simon Kelley b7c858f6b5 Fix SEGV on --local= added by immediately previous commit.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-19 08:17:35 +01:00
Simon Kelley 576e766b59 Fix struct hostinfo free code and BSD compile.
The code added in6 c596f1cc1d92b2b90ef5ce043ace314eefa868b
fails to free the returned datastructures from gethostinfo()
because sdetails.hostinfo is used to loop through the addresses
and ends up NULL. In some libc implementations this results
in a SEGV when freeaddrinfo() is called.

Also fix FTBFS under BSD. Thanks to Johnny S. Lee for the bug report.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-19 08:17:28 +01:00
DL6ER fe4077ea9f Increase default SQLite3 cache size from 2000 kiB to 16 MiB
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-18 10:51:43 +01:00
DL6ER f4c9460f21 Merge pull request #1485 from pi-hole/fix/forked_shmSettings
Fix shared memory crashes in TCP forks
2022-11-17 12:59:07 +01:00
DL6ER cafa2eff8f Merge pull request #1482 from pi-hole/update/sqlite_3.40.0
Update embedded SQLite3 engine to version 3.40.0
2022-11-17 12:51:42 +01:00
DL6ER 9dd37ecafb Merge pull request #1480 from pi-hole/tweak/unique_messages
Always ensure FTL messages are unique
2022-11-17 12:51:34 +01:00
DL6ER 78597ddf1c Verify PID of shared memory without remapping global shmSettings object
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-16 21:57:13 +01:00
Simon Kelley bc1acb24e8 Handle DS records for unsupported crypto algorithms correctly.
Such a DS, as long as it is validated, should allow answers
in the domain is attests to be returned as unvalidated, and not
as a validation error.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-16 21:44:27 +01:00
Simon Kelley b6e61c2da0 Fix GOST signature algorithms for DNSSEC validation.
Use CryptoPro version of the hash function.
Handle the little-endian wire format of key data.
Get the wire order of S and R correct.

Note that Nettle version 3.6 or later is required for GOST support.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-16 21:44:23 +01:00
Simon Kelley c030b2d610 Handle known DNSSEC signature algorithms which are not supported.
This fixes a confusion if certain algorithms are not supported
because the version is the crypto library is too old.  The validation
should be treated the same as for a completely unknown algorithm,
(ie return unverified answer) and not as a validation failure
(ie return SERVFAIL).

The algorithems affected are GOST and ED448.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-16 21:44:19 +01:00
DL6ER bb57105001 Update embedded SQLite3 engine to version 3.40.0
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-16 17:58:46 +01:00
DL6ER c689cf23ff Add debugging output to verify_shmem_pid()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-16 04:26:55 +01:00
DL6ER af495664f9 Adlist warning -> ADLIST WARNING
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-15 21:28:38 +01:00
DL6ER fc212c383a Always ensure FTL messages are unique
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-15 19:33:47 +01:00
DL6ER b63a37281d Force 8 digits to display git object names
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-14 22:52:53 +01:00
DL6ER 64d5b3af4e Fix CMake ENV var comparison to restore compilation in environments where this variable is unset
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-14 22:41:31 +01:00
DL6ER a052113364 Add "pihole-FTL --hash" printing the current git hash of the binary's source code
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-14 22:21:10 +01:00
DL6ER 9fe7fb5686 Merge pull request #1472 from pi-hole/special/CI_development
Update CI to ftl-build:v1.23 containers
2022-11-14 08:19:50 +01:00
DL6ER eec622c687 Add shortcut to compile an all-options build of dnsmasq inside FTL. Note that this does not include ubus as it is an OpenWRT-native thing that cannot be setup easily on any other distro.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-10 20:36:25 +01:00
DL6ER 4b798e8aec Fix incorrect three-way merge happened when importing the stale-cache patch
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:49 +01:00
Simon Kelley 2a94aef407 Fix --server=/domain/#
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:49 +01:00
Simon Kelley 1449829f1d Fix --server with multiple domains.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:49 +01:00
Simon Kelley ed8d37bf0b Make specifying nameservers by name work for DBus API.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:49 +01:00
Simon Kelley 0ae86d2641 Call freeaddrinfo() in domain_rev[46]()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
DL6ER 7ecd358f96 Allow FTL to analyze stale cache replies. They are assigned to a new query type (17)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
DL6ER 42c71058a9 Add support for dnsmasq flags F_SRV and F_STALE
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 891acaa301 Extend specifying DNS servers by domain-name to --rev-server
Also Dbus SetDomainServers method.

Revert getaddrinfo hints.ai_socktype to SOCK_DGRAM to eliminate
duplicating every address three times for DGRAM, STREAM and RAW
in the results.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 1b2612cff6 Fix breakage of --local=/domain.name/1.2.3.4 in immediately previous commit.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Dominik Derigs 703ee7e2b0 Allow domain names as well is IP addresses in --server options.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 2bf2863224 Reconcile "names" and "address" counts when reading hostfiles.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 8aba33f751 Inotify: make "flushed" log message more understandable.
Saying we've "flushed x outdated entries" is confusing, since
the count is the total number of entries in the modified file,
most of which are going	to get added straight back when	the file
is re-read.

The log now looks like

dnsmasq: inotify: /tmp/dir/1 (new or modified)
dnsmasq: inotify: flushed 1 addresses read from /tmp/dir/1
dnsmasq: read /tmp/dir/1 - 2 addresses

which hopefully make it more obvious that /tmp/dir/1 contained one
address before, and now contains two.

Signed-off-by: Dominik Derigs <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Dominik Derigs 779ba107fa Do not (try to) re-read deleted files inside a --hostsdir.
Signed-off-by: Dominik Derigs <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 3a6dd32f91 Fix in dhcpv4 rapid-commit code.
1) Cosmetic: don't log the tags twice.

2) Functional. If a host has an old lease for a different address,
   the rapid-commit will appear to work, but the old lease will
   not be removed and the new lease will not be recorded, so
   the client and server will have conflicting state, leading to
   problems later.

Signed-off-by: Dominik Derigs <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley cdf9d9d5ab Add --no-round-robin option.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 4cfb84ae99 Fix loss of DNS servers on config reload.
A bug, introduced in 2.87, which could result in DNS
servers being removed from the configuration when reloading
server configuration from DBus, or re-reading /etc/resolv.conf
Only servers from the same source should be replaced, but some
servers from other sources (ie hard coded or another dynamic source)
could mysteriously disappear.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Dominik Derigs a1b66e89d2 Handle multiple addresses when removing duplicates in host files.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Dominik Derigs e8d19f71cc Enhance --hostdir so that records are automatically removed when re-reading.
Initial patch from Dominik Derigs, re-written by Simon Kelley.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Dominik Derigs 652c1e8a90 Improve logging of DNS record source from --hostsdir files.
Patch author Dominik Derigs <dl6er@dl6er.de> with subsequent bugfixes
and tweaks from Simon Kelley.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
DL6ER 0dc053364b Locally blocked queries are not stale
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 5929989ff9 Fix bug in --dynamic-host when interface has /16 IPv4 address.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 976e9321ed Add ClearMetrics Dbus method.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley f4e359296d Optimise cache code when stale caching in use.
Exclude DNSSEC entries from stale caching.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 0fd2a136c6 Don't exclude stale-cache answers from "local answered" metric.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 5935160b7b Initialise modified-moving-average latency calc better.
Use the first value, rather than initialising at zero,
which takes many queries to converge.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley a59927835f Split failed queries in retries in stat counting.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 861f529980 Tweak server-selection logic in the fast-retry case.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley b9957e4ca1 Keep a per-DNS-server moving average of query latency.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 7cae4bd3c3 Combine server stats from all records for the same server in DBUS method.
The DBUS per-server stats method should combine the stats from
different records (for different domains) in the same way at the
logging code.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00
Simon Kelley 3d5b4e20ec Count NXDOMAIN replies from each server.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-09 20:09:48 +01:00