Commit Graph

229 Commits

Author SHA1 Message Date
DL6ER da7c3a7735 Run ANALYZE instead of PRAMGA optimize after some discussion with the SQlite3 developers. Also ensure notices and mere messages are not always logged as errors in FTL's log. Furhtermore, reduce the frequency of running ANALYZE from once per day to once per week.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-04 23:30:14 +01:00
DL6ER 975c46817b Optimize database on close (gravity) or frequently (queries)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-01 08:41:37 +01:00
Dominik 1a0921cd48 Merge pull request #1810 from pi-hole/new/batchDelete
Implement special POST :batchDelete callbacks
2023-12-15 20:19:09 +01:00
DL6ER 34cfc9c465 Remove undocumented audit feature
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-12-08 07:53:49 +01:00
DL6ER 835fcde327 Condition 'hwaddr!=NULL' is always true and reduce amount of allocated memory for synthesized MAC addresses from 324 to 18 bytes
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-12-08 07:53:49 +01:00
DL6ER 0ef89ab3eb Implement special POST :batchDelete callbacks for /api/groups, /api/domains/, /api/clients, and /api/lists
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-12-06 23:27:20 +01:00
DL6ER b2884505ab Merge branch 'development-v6' into new/recycle 2023-11-26 10:41:42 +01:00
DL6ER d6f30b3931 Install safe-guards for string-related functions to not crash when accidentially supplied with a NULL pointer
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-20 22:38:33 +01:00
DL6ER ad5d078193 The group table's column is called "description" but we expose it in the API as "comment". Adjust internally used SQL to translate between them (this was already implemented and working for comment editing)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-19 07:46:58 +01:00
DL6ER ec064d9c6e Use correct type when manipulating domainlist entries
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-10 20:47:33 +01:00
DL6ER c450d488a4 Fix domain modification. The UNIQUE key in the domainlist table is the combination of domain+type, not domain alone so you can add the same domain, e.g. once as allowed and once as denied entries and assign them to different clients using appropriate groups
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-05 20:59:55 +02:00
DL6ER 9345841b10 Fix error message shown when gravityDB_addToTable() fails
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-05 20:58:19 +02:00
DL6ER 91b0c23f84 Merge branch 'development-v6' into new/recycle 2023-11-04 08:05:03 +01:00
DL6ER 87272c2178 Use UPSERT instead of special REPLACE INTO statements to update existing group, adlist, domainlist, and client rows in the gravity database
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-23 22:35:14 +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 71c0d66338 Remove semicolon actually preventing the correct filtering on regex IDs
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-15 11:31:25 +02:00
DL6ER 71f384f999 Fix domain type and kind not being added for certain /api/domains calls
This is a regression of https://github.com/pi-hole/FTL/pull/1649

Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-12 18:12:27 +02:00
DL6ER 88e7b1e5dc Add ABP-support for /api/search and add new optional debug parameter
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-10-07 21:52:39 +02:00
DL6ER 590c1214a9 Optimize ABP comparator generation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-09-29 18:42:50 +02:00
DL6ER 667a98230f Use @@||xyz^ instead of ||xyz^ for antigravity list entries
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-09-26 22:46:20 +02:00
DL6ER 4abc11afb3 Satisfy foreign key constraints when removing subscribed allowlists by deleting related domains in antigravity
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-09-15 21:39:04 +02:00
DL6ER 444fd4c5c9 Ensure subscribed list type is (re)stored to/from database table
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-09-15 21:39:04 +02:00
DL6ER f8b8e63044 Add antigravity (subscribed allowlists with wildcard support)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-09-15 21:39:04 +02:00
DL6ER 2dbfc2b481 Fix SQL used to update existing adlists via the API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-07-08 13:26:30 +02:00
DL6ER 9f808b94ad Pass new abp_entries number to API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-06-15 10:00:43 +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 0564d7d385 Preserve gravity-specific quantities when updating lists via the API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-05-07 13:14:16 +02:00
DL6ER d4f30e4f3d Send more gravity-specific quantities in /search/{domain}
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-05-07 13:10:24 +02:00
DL6ER 7f0bd7481e Ensure both type and enabled are returned when requesting domains through the API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-05-06 20:08:07 +02:00
DL6ER 7281da34b4 Add /api/clients/_suggestions
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-05-06 07:31:21 +02:00
DL6ER 44c3fe4ef4 Merge remote-tracking branch 'origin/development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-03-13 10:30:39 +01:00
DL6ER da118e87ce Remove last traces of temporarily added benchmarking tools. Also remove the hint about ABP domains, this can easily be checked in gravity
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-03-05 13:56:55 +01:00
DL6ER 06f0e0340e Remove debugging timing output
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-26 16:52:23 +01:00
DL6ER ae9b291082 Set abp_domains = 1 during the CI tests.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-26 07:19:48 +01:00
DL6ER ab2f652e22 Use property "abp_domains" from info table to decide whether ABP blocking is to be used or not. Also log when FTL enabled ABP-style blocking
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-25 22:29:17 +01:00
DL6ER ec82cd3dd4 Add timing for ABP style detection
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-25 18:37:40 +01:00
Dan Schaper 6f8ba76077 Update src/database/gravity-db.c
Spespellingllling

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2023-02-15 14:01:37 -08:00
Christian König d9c753be27 Fix spellcheck to get things deployed
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-02-15 21:55:47 +01:00
DL6ER 80b5fa008c Fix handling of rare (but possible) gravity database issues such as "list not available"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-15 21:27:12 +01:00
DL6ER 75cd6913ee Do not use a new option but instead automatically detect if ABP-style domains are present in the database. This ensures that this addition comes at no extra costs to any installs using pure HOSTS-style adlists.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-15 21:19:31 +01:00
DL6ER 8794b1684d Add ABP format blocking support for gravity. Note that the option needs to be switched on by setting GRAVITY_ABP_STYLE=true in pihole-FTL.conf to avoid running this computationally expensive task on the vast majority of user databases only fed from properly formatted HOSTS lists. Gravity can enable the setting when it detects ABP format automatically.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-15 19:48:19 +01:00
DL6ER 9833fe1af0 Reload gravity database when 'updated' property in table 'info' has changed
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-05 16:44:14 +01:00
DL6ER 5bfc1fd122 Add /api/search as a batter replacement of the currently existing "pihole -q" command
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-29 19:55:12 +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 999a9735cb Do not store the payload on the stack but allocate heap memory for it. Using dozens of KB for each API connection is dangerous, hundreds of KB large payloads is surely a very bad idea. (rmemeber, the answer to how-much-it-too-much is the rather vague: too much is when the stack overflows)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-09 20:08:39 +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 a9ea62a3fc Merge branch 'development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-12-30 15:12:14 +01:00
RD WebDesign e24e162da4 Fix comment
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2022-10-11 00:54:01 -03:00
DL6ER b2c3d4725c Fix audit log SQL query
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-10-01 13:27:00 +02:00
DL6ER 4cd68092fe Merge pull request #1409 from pi-hole/tweak/white_regex_id
Store domainlist IDs for blocked/permitted queries
2022-09-11 22:12:33 +02:00