Commit Graph

155 Commits

Author SHA1 Message Date
DL6ER 1bc8e7fc06 Rename query_storage.regex_id to query_storage.list_id as it is already now used to also store exact matching domainlist entries by their ID. This commit further extends this to also store the (first) matching anti-/gravity list (if available)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-12-25 04:57:05 +01:00
DL6ER 34e44f2453 Set imported database query IDs to counter value and fix GC pointer magic (update comment to explain better what happens here)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-28 15:44:58 +01:00
DL6ER 399ca11038 Add extra debug statements
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-26 21:44:55 +01:00
DL6ER d3826c9743 Remove obsolete overTime structure stored for each upstream. This reduces memory consumption per upstream destination from 640 to 56 bytes each
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-26 10:48:59 +01:00
DL6ER 91b0c23f84 Merge branch 'development-v6' into new/recycle 2023-11-04 08:05:03 +01:00
DL6ER 08245ce21a Merge branch 'fix/numbers' into new/recycle 2023-11-04 08:04:01 +01:00
DL6ER 6b5f58dbf8 Merge pull request #1711 from pi-hole/fix/query-table
Improve query table parsing warnings
2023-10-30 05:31:15 +01:00
DL6ER 0b4abb2bd3 Optimize status and reply handling in the code. Add status object to /api/stats/summary
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-26 19:13:57 +02:00
DL6ER 2aff05c78a Reuse existing shared clients, domains, and cache memory slots which are not referenced by any active query within the past 24 hours. Furthermore, always scan the shared strings and reuse them before allocating new memory with the same content
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-23 18:13:12 +02:00
DL6ER 36965ffd7b Add descriptions to the ftl database table. This updates the database to version 14
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-10 19:28:14 +02:00
DL6ER 13f0ed7335 Ensure all database upgrade steps are wrapped into transactions. When the database upgrade is interrupted (FTL is killed, or crashed or power loss, ...), then the rollback journal file is left on disk. The next time another application attempts to open the database file, it notices the presence of the abandoned rollback journal (we call it a "hot journal" in this circumstance) and uses the information in the journal to restore the database to its state prior to the start of the incomplete transaction. This fixes sporadic issues with only partially initialized databases mostly seen on devices with unstable power supply.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-10 19:28:14 +02:00
DL6ER f4e0a904ac Implement Query Log sorting (server-side pagination)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-12 04:55:43 +02:00
DL6ER 392db953b3 Merge pull request #1607 from pi-hole/tweak/query_details
Provide regex ID for API
2023-09-15 17:25:17 +02:00
DL6ER 9704455591 Always set regex_id when available
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-09-13 16:44:40 +02:00
DL6ER d1b2f03f10 Update src/database/query-table.c
Co-authored-by: yubiuser <ckoenig@posteo.de>
Signed-off-by: DL6ER <DL6ER@users.noreply.github.com>
2023-08-12 09:44:55 +02:00
DL6ER 6f77d4ed91 Improve warning messages printed during query table parsing (history import)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-08-06 21:09:46 +02:00
DL6ER c498fb9db2 We need to get the MAX(id) from the on-disk database even if database.DBimport is false
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-08-04 19:42:50 +02:00
DL6ER e42779533b Ensure disk database is detached on SQL issues
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-08-01 21:55:14 +02:00
DL6ER a9d47713e4 Provide regex ID for API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-07-30 21:49:23 +02:00
Christian König 62cfc25b95 Fix spelling in v6
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-05-30 22:42:13 +02:00
DL6ER 7774e3724d Fix GC removing too many queries from the in-memory database
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-05-27 14:00:31 +02:00
DL6ER b88e8d282a Update number of queries in databases when they are changed
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-05-27 13:35:11 +02:00
DL6ER 3b404ff9a0 Add /api/actions/flush/logs
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-05-24 20:39:18 +02:00
DL6ER 7281da34b4 Add /api/clients/_suggestions
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-05-06 07:31:21 +02:00
DL6ER 7359b496ff Move database.maxHistory to webserver.api.maxHistory
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-04-25 22:26:25 +02:00
DL6ER b3ef031a22 Various memory improvements to (a) avoid crash during the final cleanup (don't allow reusing of pointer to memory that may already have been munmapped) , and (b) ensure we have release all memory after exporting to the on-disk database (finalize all prepared statements in queries_to_database())
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-04-18 21:13:48 +02:00
DL6ER 4ea0bf7dea Always update last_disk_db_idx after storing queries on disk as sqlite3_changes() sometimes reports to few rows being inserted. This was a rather tedious debugging...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-25 18:23:13 +01:00
DL6ER cf82495d6c Create new webtheme() PHP function and make the webtheme an enum
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-03 18:12:55 +01:00
DL6ER 8753a8d69b Add more compiler warnings and fix a few things they pointed out worth improving/being more explicit about. This adds GCC-12 compatibility out of the box.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-29 18:12:19 +01:00
DL6ER 0856153699 Add ability to list allowed values (for enums) in JSON form. Add pretty-printing for TOML and update all help test descriptions from the official Pi-hole documentation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-22 12:01:42 +01:00
DL6ER e145d20d28 Rewrite the entire config-related code to allow for changing data without having to restart. Hereby, we greatly reduce code duplication in the TOML routines so we won't have to touch tme in the future when adding additional options.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-07 18:06:41 +01:00
DL6ER f2d68f20d7 Also verify endpoint structure: Query endpoints from FTL and check if all properties mentioned in the docs are present (and of correct type) and that there are no extra properties we forgot to document. Furthermore, also verify that the provided examples are of correct type, too.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-03 21:51:13 +01:00
DL6ER c7803df604 Add /api/stats/upstreams and /api/stats/database/upstreams documentation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-02 21:19:11 +01:00
DL6ER 3389b1f0c2 Add /api/ftl/config which can be used to retrieve the entire configuration of FTL. This endpoint only supports GET so far, however, we will add POST in the future so that configuration values can be changed through the API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-01 18:19:36 +01:00
DL6ER a9ea62a3fc Merge branch 'development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-12-30 15:12:14 +01:00
DL6ER f0b133b285 Always store time we start to save to the database (not only in debug mode). This avoids errorneous timing reports in case of errors.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-12-27 07:31:39 +01:00
DL6ER 3f1be06814 Fix logic for status code parsing
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-12-09 16:43:43 +01:00
DL6ER 983544e6d3 Fix incorrect DNSSEC-related warning during history import
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-12-03 12:43:20 +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 1ccfd9a081 Ensure the API does not try to create DNS cache records for queries that don't have one
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-08-20 15:27:38 +02:00
DL6ER 15942b17ce Store domainlist IDs for blocked/permitted queries
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-08-19 19:44:11 +02:00
DL6ER 8437519c24 Remove newdb and directly store in memdb to avoid database complexity and unnecessary in-memory data duplication
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-06-28 21:10:05 +02:00
DL6ER 26ccee3f4c Merge branch 'development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-06-29 11:12:59 +02:00
DL6ER 613014e81a Merge branch 'development' into new/query_special_domain
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-04-24 09:26:46 +02:00
DL6ER 7acd0f31e4 Add QUERY_SPECIAL_DOMAIN as new query status
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-04-24 09:10:38 +02:00
Adam Warner 671a438c4d Fix some spellings, ignore others
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-22 18:26:31 +01:00
DL6ER 8734b60a53 Ensure we subtract from the old reply counter when reply type changes
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-03-26 13:24:08 +01:00
DL6ER 213b7eb7f4 Adjust query type counters when importing from the database
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-03-18 13:05:19 +01:00
DL6ER 2c91e487fd Store NULL in the REPLY_TIME column when the reply time is not available
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-02-05 10:11:20 +01:00
DL6ER 9a257a9bb1 Set response_calculated to true when imported reply_time is not 0.0
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-02-01 21:11:55 +01:00