Commit Graph

2749 Commits

Author SHA1 Message Date
DL6ER c02dfddebc Add quiet regex test mode for inclusion in pihole -q
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:27:04 +02:00
DL6ER dde020ea54 Modify regex-test mode for better batch-processing capabilities
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:27:04 +02:00
DL6ER d51224cb57 Mark get_regex_from_rowid as pure.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER 0aecef5b5c Tests: Add tests for useful error hints for incorrect regex.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER ce84f6d56a Adjust empty lines
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER 094b1ed828 Use info box for step reporting
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER a246a2d458 Mark all the new cli_{}() functions as ((const)) to make them subject to common subexpression elimination.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER 4cb64d17f0 Tests: Bats ignored empty lines
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER 89960e3698 Make regex-text output more user-friendly
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER 66fa3190d3 Add 26 regex tests (following https://discourse.pi-hole.net/t/regex-engine-improvements/34751)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER c4689c158f Reduce overall costs by not always calling the approximate matching algorithm.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:25:49 +02:00
DL6ER 22c8ccefd5 Allow test-regex mode to be started without log ans shared memory (alleviates write permission issues when running pihole-FTL as a different user)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:24:30 +02:00
DL6ER 87b2b42e44 Add regex-test mode
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:24:30 +02:00
DL6ER 2144857d93 Improve regex engine. This adds new features such as in-code comments, approximate matching (fuzzy matching)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-10 23:19:04 +02:00
DL6ER f4270f3ada Merge pull request #862 from pi-hole/master
Merge Pi-hole v5.2 code into development
2020-08-10 22:48:19 +02:00
Adam Warner dbd4a696af Merge pull request #853 from pi-hole/release/v5.2
Pi-hole FTL v5.2
v5.2
2020-08-09 22:09:43 +01:00
DL6ER 3414def38b Merge pull request #859 from pi-hole/fix/domainstring_validity
Create and use a temporary copy of the domain string during the analysis
2020-08-09 22:59:50 +02:00
DL6ER 115ee1e73c Create and use a temporary copy of the domain string during the analysis
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-05 13:26:21 +02:00
DL6ER c9af9c9dad Merge pull request #844 from DDoSolitary/patch-setcap-path
Fix setcap target path.
2020-08-05 09:28:41 +02:00
DL6ER 905994e668 Merge pull request #857 from pi-hole/fix/read_should_not_bind
Fix rare database importing issue
2020-08-04 05:47:21 +02:00
DL6ER 8ee044d130 Do not try to bind a value when we should actually read one. This glitch was harmless, however, it prevented regex ID from being loaded from the database.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-08-03 19:34:47 +02:00
DL6ER b4903554f5 Merge pull request #848 from pi-hole/update/dnsmasq-v2.82
Update embedded dnsmasq to v2.82
2020-07-25 22:04:17 +02:00
Simon Kelley 8f1a8398b2 Change default lease time for DHCPv6 to one day.
Also remove floor on valid and preffered times in RA when
no time is specified.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Simon Kelley 3c23651a1d Apply floor of 60s to TTL of DNSKEY and DS records in cache.
Short TTLs and specifically zero TTLs can mess up DNSSEC validation.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Simon Kelley 94821f98f7 Suppress logging of listen addresses during startup.
The initial call to enumerate_interfaces() happens before the
logging subsystem in initialised and the startup banner logged.
It's not intended that syslog be written at this point.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Petr Menšík 956b83ddf8 Remove duplicate address family from listener
Since address already contain family, remove separate family from
listener. Use now family from address itself.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Petr Menšík 85c788d7c3 Handle listening on duplicate addresses
Save listening address into listener. Use it to find existing listeners
before creating new one. If it exist, increase just used counter.
Release only listeners not already used.

Duplicates family in listener.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Petr Mensik 0912dbe8a9 Cleanup interfaces no longer available
Clean addresses and interfaces not found after enumerate. Free unused
records to speed up checking active interfaces and reduce used memory.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Petr Mensik 3be8e6ce7b Compare address and interface index for allowed interface
If interface is recreated with the same address but different index, it
would not change any other parameter.

Test also address family on incoming TCP queries.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Petr Mensik a3f4b2b45a Explicitly mark address port not used
On many places return value is ignored. Usually it means port is always
the same and not needed to be displayed. Unify warnings.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Petr Mensik ab62db1607 Log listening on new interfaces
Log in debug mode listening on interfaces. They can be dynamically
found, include interface number, since it is checked on TCP connections.
Print also addresses found on them.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Simon Kelley b53f7ee63c Workaround for reported recvmsg() ignoring MSG_PEEK.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
Simon Kelley e0e53590d4 Allow IPv6 addresses ofthe form [::ffff:1.2.3.4] in --dhcp-option.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-24 16:48:45 +02:00
DL6ER 58ebe22460 Merge pull request #852 from pi-hole/tweak/make_build_faster
Make FTL builds faster
2020-07-24 07:39:31 +02:00
DL6ER 5f4582e436 Merge pull request #832 from pi-hole/new/cname_inspection_logging
Add logging for CNAME inspection
2020-07-23 06:19:17 +02:00
DL6ER a70cd5279f Merge pull request #847 from pi-hole/fix/guard_gravity_reopening
Safely reopen gravity database
2020-07-23 06:18:32 +02:00
DL6ER 86823df403 Merge pull request #850 from pi-hole/tweak/cache_cleaning
Enhance reload speed
2020-07-23 06:17:05 +02:00
DL6ER 8c791961b3 Factor out FTL sources into a separate object. This slightly enhances compilation speed.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-21 20:24:22 +02:00
DL6ER 9d0979431a Do not loop over known domains in addition to looping over all FTL-DNS-cache entries.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-21 20:01:35 +02:00
DL6ER 2a0697412f Merge pull request #845 from pi-hole/fix/sqlite_concurrent_TCP_termination_crash
Improve TCP worker handling
2020-07-20 05:46:58 +02:00
DL6ER 3af4f87dd5 Wrap gravity reopening in locking to avoid a race collision with API requests (performed from independent threads).
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-20 05:43:27 +02:00
DDoSolitary 04a0e91546 Fix setcap target path.
- Take the `DESTDIR` variable into consideration.
- Delay expansion of `${CMAKE_INSTALL_PREFIX}`, which can be a different value at install time.

Signed-off-by: DDoSolitary <DDoSolitary@gmail.com>
2020-07-19 21:30:15 +08:00
DL6ER b338fa78fb Use atomic_flag_test_and_set to ensure that FTL_TCP_worker_terminating() cannot run two times even when called exactly at the same time.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-18 21:28:06 +02:00
DL6ER de8c633009 Increase limit for concurrently active TCP workers from 20 to 60. We've seen reports where 20 wasn't sufficient in user networks. Given that TCP workers do not really consume all that much more memory, this limit may even be increased further in case we recognize that 60 still isn't sufficient.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-17 14:49:48 +02:00
DL6ER 4ed1b7420c Double time until TCP worker timeout from 150 seconds to 300 seconds. RFC 1035 says: "If the server needs to close a dormant connection to reclaim resources, it should wait until the connection has been idle for a period on the order of two minutes." We are unlikely to run into a limit here as the total number of allowed TCP workers is fixed as well.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-17 14:46:51 +02:00
DL6ER 738b490d2f Include the information for which client we have forked. Examplary message: "TCP worker forked for client 192.168.0.42 on interface enp0s25 (192.168.0.12)"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-17 13:05:14 +02:00
DL6ER f07f0dfaac Skip second termiantion if there is already a termination event in progress. This has been observed with clients clsoing their connection exactly at the same time when dnsmasq wants to close the connection itself due to a timeout (it thinks this client is stale).
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-17 12:04:35 +02:00
DL6ER 4b9eeb83ec Merge pull request #839 from pi-hole/development
Import test fix from development
2020-07-17 11:43:38 +02:00
DL6ER 21de148f03 Merge pull request #838 from pi-hole/fix/revert_portfile
Revert "Remove portfile not used by the current web interface any longer"
2020-07-17 11:35:51 +02:00
DL6ER 41b49782c2 Test: Check port file exists and contains the expected number (4711)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-17 10:16:45 +02:00