Commit Graph

2204 Commits

Author SHA1 Message Date
DL6ER f9be16e61b Reset per-client domain blocking cache at receipt of SIGUSR2. This is a convenient alternative to sending SIGHUP (which also clears the entire DNS cache).
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-23 22:55:57 +01:00
DL6ER 4269897b58 Fix: Only set domain as not-to-be-blocked when this is true.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-22 10:42:12 +01:00
DL6ER 7fc340c16a Add more debugging output.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-22 10:24:58 +01:00
DL6ER 25a403a7c4 Remove static instruction from query_blocked() as it is called from places that are unlikely to reach (however, still possible). Let the compiler decide itself whether and where it wants to inline this function.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-22 09:58:26 +01:00
DL6ER faac7005d1 Improve performance significantly. We store if (and if: why) a certain domain was blocked for any requesting client and can immediately reply similarly if the same client requests the same domain again. This reduces the O(N^3) problem (number of queries * number of domains * number of clients) to a O(N^2) problem (domains * clients). Note that this state of the code still lacks a possibility to reset when entries in the database have changed. For this, we still have to send either SIGHUP (drawback: clears the cache) or define a new signal for it.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-22 09:42:06 +01:00
DL6ER 7fd801dbc2 Add pure attribute to vGet() to signal that this function might be eliminated without consequences in static data flow analysis.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-21 12:18:53 +01:00
DL6ER 0baa56c3c3 Add a generic dynamic vector implementation. I tested my implementation using gdb and also against valgrind to ensure there are no memory leaks.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-21 12:12:26 +01:00
DL6ER bb8eef38ed Add more checks for the subroutines added in this branch.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-12 07:14:26 +01:00
DL6ER 367d9aebe5 Merge branch 'development' into new/internal-blocking
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-12 07:10:09 +01:00
DL6ER a540a3c058 Merge pull request #657 from diginc/arm-qemu-2
Arm qemu (native) build for Docker
2019-11-12 06:59:52 +01:00
DL6ER e588138f72 Merge pull request #635 from pi-hole/fix/check_pointers
Check pointers before accessing content
2019-11-12 06:58:32 +01:00
Adam Hill 6092d617b9 Merge branch 'development' of github.com:pi-hole/FTL into arm-qemu-2
Signed-off-by: Adam Hill <adam@diginc.us>
2019-11-11 21:52:49 -06:00
Adam Hill 7599734342 arm-qemu/native build & tweak deploy condition
Moved ftl-build dockers to https://github.com/pi-hole/docker-base-images/
squashed commits

Signed-off-by: Adam Hill <adam@diginc.us>
2019-10-30 21:04:44 -05:00
Mark Drobnak dcafd2e21b Merge pull request #656 from pi-hole/tweak/getDatabaseHostname_malloc
Add malloc attribute to getDatabaseHostname()
2019-10-20 16:22:37 -04:00
DL6ER c91c39a541 getDatabaseHostname() is guaranteed to allocate memory. Hence, it should be given the attribute ((malloc)).
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-20 22:02:16 +02:00
Mark Drobnak 1559ce6a0c Merge pull request #653 from pi-hole/tweak/remove-unused-var
Remove unused variable from counters struct
2019-10-20 15:52:11 -04:00
Mark Drobnak 656ba76d23 Merge pull request #648 from pi-hole/new/get_hostname_from_network_table
Use network table as secondary source for client host names
2019-10-20 15:41:19 -04:00
DL6ER 34f3bfe966 Merge branch 'development' into new/internal-blocking 2019-10-20 15:37:21 +02:00
DL6ER 89c1bcbe70 Merge pull request #655 from pi-hole/fix/print_flags
Security: Ensure print_flags() cannot overflow
2019-10-17 16:51:43 +02:00
DL6ER 0bf51cc86f Merge pull request #654 from pi-hole/update/Makefile
Update .gitignore
2019-10-17 16:51:34 +02:00
DL6ER 8b0da22ca4 Ensure print_flags() cannot overflow.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-15 20:04:15 +02:00
DL6ER 6cbdb4ef96 Update Makefile
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-14 12:07:35 +02:00
DL6ER 6c5171cc53 Remove unused variable from counters struct
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-14 11:18:03 +02:00
Mark Drobnak 7f410178f8 Merge pull request #651 from pi-hole/update/sqlite_3.30.1
Update SQLite from 3.30.0 to 3.30.1
2019-10-11 16:03:54 -04:00
DL6ER ab50c5ccc4 Update SQLite from 3.30.0 to 3.30.1
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-11 17:49:12 +02:00
Mark Drobnak 65737e1f74 Merge pull request #650 from pi-hole/update/sqlite_3.30.0
Update SQLite from 3.29.0 to 3.30.0
2019-10-10 12:47:32 -04:00
Mark Drobnak 39317c7466 Merge pull request #647 from pi-hole/fix/database_upgrade_DELETE_in_TRANSACTION
Restructure network table upgrade procedure
2019-10-10 12:45:48 -04:00
DL6ER 5ab2a98c31 Don't finalize SQLite statement too early.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-10 17:30:14 +02:00
DL6ER bd60342ec3 Update SQLite from 3.29.0 to 3.30.0
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-10 17:06:06 +02:00
Mark Drobnak 15d80428ab Merge pull request #646 from pi-hole/fix/sockaddr_un.sun_path
Ensure sockaddr_un.sun_path does not overflow
2019-10-03 13:07:17 -04:00
DL6ER 9acfddbdc9 Update comment.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-02 18:02:46 +02:00
DL6ER 9598f4244e Use network table as secondary source for client host names.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-02 17:47:36 +02:00
DL6ER 6f7b4ea82d Ensure to finalize statement before calling DELETE that might affect the running transaction. SQLite3 does not accept such a DELETE in a running statement.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-01 22:15:13 +02:00
DL6ER 7e634a625f Add proper comment.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-01 21:37:00 +02:00
DL6ER 85f1364911 Ensure sockaddr_un.sun_path does not overflow for very large FTLfiles.socketfile buffers.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-10-01 21:24:52 +02:00
Mark Drobnak 92a41a6128 Merge pull request #644 from pi-hole/tweak/harden_network_table_upgrade_v4_v5
Harden network database upgrading procedure
2019-09-26 14:37:26 -04:00
DL6ER 9dd376b88a Harden network database upgrading procedure. We have at least one bug report that creating the unique index during the upgrade to database version 4 failed. We remove the addition of this unique index as it will anyway be dropped again a second later when upgrading to version 5. Meanwhile, we improve on the upgrading procedure to version 5 by implementing explicit conflict handling for duplicate ID<->IP and duplicate HWADDR entries.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-26 16:36:03 +02:00
DL6ER b37de5ce1a Add test for reporting blocking status correctly to pihole.log file.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-24 12:18:58 +02:00
DL6ER d5a144a05e Remove extra #include in main.c
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-24 11:51:14 +02:00
DL6ER 77e6acb884 Log Pi-hole blocking in dnsmasq's log.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-24 11:36:05 +02:00
DL6ER 0941db9f0d Merge branch 'development' into new/internal-blocking 2019-09-23 21:03:28 +02:00
DL6ER e638a96f71 Use boolean return type for FTL_new_query().
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-23 21:03:02 +02:00
Mark Drobnak eb38c759dc Merge pull request #643 from pi-hole/fix/do-not-access-unprepared-statement
Fix bug seen with incomplete databases
2019-09-22 16:49:06 -04:00
DL6ER 12df978432 Do not try to bind to statements that might not be available when preparing the database failed.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-20 22:53:49 +02:00
DL6ER 685d4a7c5b Add tests for a third client that is member of an empty group. This client bypasses Pi-hole entirely as no adlists, exact or regex blacklists are enabled for it.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-19 18:55:41 +02:00
DL6ER bb0b7b6ab1 Ensure we're not calling answer_request() when the query is to be blocked. This might otherwise spark a (delayed) reply in case the queried domain is already in cache.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-19 18:36:06 +02:00
DL6ER 268312249a Run FTL in DEBUG_ALL mode to increase log verbosity during tests.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-19 18:18:34 +02:00
DL6ER fe416709db Count DISTINCT domains when showing the size of gravity, blacklist, etc. Otherwise, we would show the domains once for each group so they might show up multiple times.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-19 16:14:07 +02:00
DL6ER 382e8dd43b Tests: add third client that does not block anything (tagged with an empty group)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-19 16:00:02 +02:00
DL6ER 3a11628c3b Display rowid in regex debugging mode as this is more useful when trying to find the respective line in the database.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-09-19 15:56:37 +02:00