Commit Graph

449 Commits

Author SHA1 Message Date
DL6ER 5b0cfb5a97 Merge pull request #736 from pi-hole/new/dnsmasq_dropin_replacement
Add dnsmasq drop-in replacement support
2020-04-28 21:05:08 +02:00
DL6ER fe976334c0 Merge pull request #732 from pi-hole/tweak/regex_caseinsensitive
Make regex matching case-insensitive by default
2020-04-28 21:04:52 +02:00
DL6ER de5f041f49 Merge pull request #731 from pi-hole/revert/e119ef8ace49bcc1d0c099257d7774e870d4cc1c
Install proper qemu fix
2020-04-28 20:05:36 +02:00
DL6ER 06e3a709e1 Merge pull request #733 from pi-hole/new/block_esni
Automatically block _esni.* subdomains of blocked domains
2020-04-28 20:04:03 +02:00
DL6ER fb5cfe06fd Do not decide whether we are blocking or not based on the gravity count (pre-v5.0 measure) but use the dedicated blockingstatus variable.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-23 10:08:42 +02:00
DL6ER 894a3c74a8 Add a shortcut for dnsmasq syntax test
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-22 21:35:50 +02:00
DL6ER a30e5f3aff Add full drop-in replacement mode pihole-FTL can use to mimic the dnsmasq binary.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-22 21:07:25 +02:00
DL6ER 83bf576043 Simplify blocking metadata forcing code.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-22 20:07:31 +02:00
DL6ER 1bdb5ce677 Automatically block _esni.* subdomains of blocked domains. This can be disabled by setting BLOCK_ESNI=false in pihole-FTL.conf
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-21 14:10:33 +02:00
DL6ER bcb4789538 Make regex matching case-insensitive by default and remove config option to control this.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-20 09:40:29 +02:00
Simon Kelley 73acc1adb4 Convert failure of setsockopt(..., SOL_NETLINK, NETLINK_NO_ENOBUFS, ...) into warning.
We call this, which avoids POLLERR returns from netlink on a loaded system,
if the kernel is new enough to support it. Sadly, qemu-user doesn't support
the socket option, so if it fails despite the kernel being new enough to
support it, we just emit a warning, rather than failing hard.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-20 08:43:19 +02:00
DL6ER bdc5ae7920 Revert "Don't try setsockopt of non-existing NETLINK_NO_ENOBUFS option (fixes qemu issue)."
This reverts commit e119ef8ace.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-20 08:43:13 +02:00
DL6ER e119ef8ace Don't try setsockopt of non-existing NETLINK_NO_ENOBUFS option (fixes qemu issue).
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-18 19:35:10 +02:00
DL6ER 7a78a1ff69 Merge branch 'release/v5.0' into update/dnsmasq 2020-04-12 09:55:55 +02:00
Geert Stappers 13edf137f2 src/dnsmasq/dnsmasq.c: Labeled a lonely #endif
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-12 07:31:02 +02:00
DL6ER d395b3bbd9 Merge pull request #728 from pi-hole/tweak/resolver_try_FTL_first_then_others
Improve internal resolver algorithm
2020-04-10 10:33:14 +02:00
DL6ER dbcf5142de Convert port from host to network byte order
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-09 13:43:44 +02:00
DL6ER b7a6fa9bfd Modify FTL's internal resolver to work in two phases: First, try to obtain a host name by using the internal resolver (i.e., FTL). In a second step, when FTL didn't know the answer, ask the resolvers as configured by resolv.conf. We've seen that the latter is necessary to get proper name resolution in docker environments.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-09 11:58:34 +02:00
DL6ER a7ad39d8bd Correct, indent and simplify wildcard-compatible auditlog SQL logic.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-07 11:37:21 +02:00
Kevin 'silibum' Böhme 951fe084ef Restored astrisk match for auditlog
Signed-off-by: Kevin 'silibum' Böhme <kboehme@silibum.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-07 11:22:20 +02:00
DL6ER 92c582e542 Merge branch 'release/v5.0' into update/dnsmasq 2020-04-07 10:16:42 +02:00
Simon Kelley 3cfa4199aa Tweak to DNSSEC logging.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-07 10:15:15 +02:00
Simon Kelley 3b627c725b Fix rare problem allocating frec for DNSSEC.
A call to get_new_frec() for a DNSSEC query could manage to
free the original frec that we're doing the DNSSEC query to validate.
Bad things then happen.

This requires that the original frec is old, so it doesn't happen
in practice. I found it when running under gdb, and there have been
reports of SEGV associated with large system-clock warps which are
probably the same thing.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-07 10:15:07 +02:00
DL6ER 536ef08ce5 Free allocated memory after ordinary termination of TCP workers (TCP connection closed)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 15:11:32 +02:00
DL6ER 7d3e960324 Musl's realloc() does not zero any memory. Do this manually.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 14:14:49 +02:00
DL6ER c9eb4a1265 Remove append and delete instructions as we will always identify clients exactly by their IDs
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 13:08:02 +02:00
DL6ER 163629774d Explicitly include type definition of int16_t in config.h as needed by the musl-compiler
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 12:50:34 +02:00
DL6ER 1246f1616e Silently increase size of vector if trying to read out-of-bounds
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 12:46:32 +02:00
DL6ER 3aa6edcf07 Implement process-private prepared gravity database client statements. This fixes an incompatibility across forks when serving TCP traffic using dedicated workers.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 12:17:04 +02:00
DL6ER 48dc5ea073 Memorize PID of this thread to avoid re-opening the gravity database connection multiple times for the same fork
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 10:17:12 +02:00
DL6ER f1f817ab31 Re-open gravity database (and re-prepare database statements) before accessing the database in case FTL forked.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 09:56:14 +02:00
DL6ER f9e0413d19 Merge branch 'release/v5.0' into fix/TCP_forks 2020-04-06 09:32:44 +02:00
DL6ER e7e2dbe975 Print arguments passed to embedded dnsmasq when at least one DEBUG flag is set.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 09:32:21 +02:00
DL6ER 41b12961fe Merge branch 'release/v5.0' into update/dnsmasq 2020-04-02 19:41:21 +00:00
DL6ER 53bc882925 Exiting instead of aborting may be benefitial in FTL forks.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 19:33:50 +00:00
DL6ER c8caf546ed Ensure ARP strings are NULL-terminated
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:18:37 +00:00
DL6ER 564b286954 Do not import unknown clients from the ARP cache into FTL's memory. It is not our job to care about them if they are not doing any DNS queries.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:17:00 +00:00
DL6ER 7fae126ac4 Only check/set client status when size of the array is not exceeded. Skip otherwise.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:17:00 +00:00
DL6ER 06497d779d Initialize resolver subroutines if trying to resolve for the first time
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:17:00 +00:00
DL6ER fdb8664f4a Check arguments are of type SQLITE3_TEXT
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:17:00 +00:00
DL6ER 35353b2623 Add a comment that gethostbyaddr() may leak memory (only once, not seen leakage of more than 110 bytes)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:17:00 +00:00
DL6ER 6d612678e6 Also return NO MATCH when invoking subnet_match() with non-TEXT arguments.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:16:58 +00:00
DL6ER ff24111a6d Ensure we don't loose memory after ARP cache parsing.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:16:00 +00:00
DL6ER 1636a81041 Explicitly log failures in creating the new sqlite3 function.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:15:55 +00:00
DL6ER 2ed01382a7 Some general tweaks
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:15:10 +00:00
DL6ER 30032b02cf Fix possible memory leak in config.c
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-02 15:14:25 +00:00
DL6ER ceb6f049f8 Ensure blocking also works when the long-term database is not used. This was broken before as we returned too early (the SQLite3 engine was not yet fully initialized) when the long-term database was disabled.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-03-31 17:07:38 +00:00
DL6ER d5253f16d3 Merge pull request #712 from pi-hole/tweak/sqlite_debugging
Improvements to overall database handling
2020-03-31 18:22:59 +02:00
DL6ER b6364d005f Merge pull request #716 from pi-hole/new/DELAY_STARTUP
Add DELAY_STARTUP setting to delay startup of the embedded dnsmasq
2020-03-29 23:23:02 +02:00
Oldřich Jedlička 6142ec56da Allow overriding of ubus service name.
Same as for the dbus, allow specifying ubus service name (namespace) on
the command line as an optional argument to --enable-ubus option.

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-03-29 21:14:10 +00:00