Commit Graph

125 Commits

Author SHA1 Message Date
DL6ER
93a06c0124 Remove unused code segments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-10-15 21:36:43 +02:00
DL6ER
33645777e9 Add basic lookup table implementation and create new SHM objects for them. Also simplify code by changing index counters to unsigned types.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-10-12 22:01:57 +02:00
DL6ER
4df3c26ce7 Fix local variable address stored in non-local memory
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-09-16 13:53:15 +02:00
DL6ER
189979284f Store correct database ID when issuing a warning
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-06-03 11:46:39 +02:00
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
dc9dc0d6cf regextest is always true in these cases
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-12-07 22:39:44 +01:00
DL6ER
dd9c4ad52b Add special debug.all config option
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-18 14:42:32 +01:00
DL6ER
9483ed6778 Add new regex extension ";reply=CNAME,target.domain" suitable for defining CNAME records per-group
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-11 22:00:33 +01:00
DL6ER
5e2e6e6fa4 Merge branch 'development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-02-01 21:48:41 +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
49e1c74455 New syntax: querytype=A accepts now also a list (like querytype=A,AAAA,MX). You can use the exclamation mark as before for inversion (querytype=!A) matches everything BUT type A queries. This has now been extended to be able to invert a list, too (like (querytype=!A,AAAA matches everything BUT A and AAAA queries)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-26 20:11:55 +01:00
DL6ER
8b9e6c6c7e Print regex type hints only in debug mode
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-26 20:11:55 +01:00
DL6ER
48fc06d46b Add POST /api/teleporter to upload and install backed up configuration
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-25 21:51:12 +01:00
DL6ER
19d7582896 Free regex memory in final cleanup routine to ensure allocated regex do not show up as definitely lost memory in valgrind analysis
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-20 04:52:54 +01:00
DL6ER
4927442c13 Fix possibly small memory leak in regex compilation when there are regular expressions with certain errors
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-15 21:41:13 +01:00
DL6ER
ffa4d338f1 Allow selection of multiple query types in regex extension, like "abcabc;querytype=HTTPS,SVCB"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-15 13:20:21 +01:00
DL6ER
27b4a6d805 Ensure dhcp-discover and regex-test do not overwrite the config file after parsing
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-01-08 15:06:11 +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
DL6ER
da33517553 Add more debugging output to getstr()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-08-20 14:23:21 +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
26ccee3f4c Merge branch 'development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-06-29 11:12:59 +02:00
DL6ER
c1009ba0ec Print FTL regex extension details in regex-test mode
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-01-22 13:29:15 +01:00
DL6ER
ed1e5a05af Use correct pointer for regex
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-31 01:12:39 +01:00
DL6ER
e52e10ab97 Change wording of routine
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-31 01:11:22 +01:00
DL6ER
2c60083af0 Print if there was a match we might have ignored due to other settings in regex debug mode
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-31 00:24:04 +01:00
DL6ER
efc577a1de Use get_query_reply_str() routine instead of reply_status_str object.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-31 00:03:43 +01:00
DL6ER
e1887235b2 Fix singular/plural when reporting regex client(s)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-12-30 23:49:03 +01:00
DL6ER
d2db645f71 Update tests
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-02 15:09:38 +01:00
DL6ER
c0570c51c2 Merge branch 'development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-02 09:53:13 +01:00
DL6ER
ac0346b9e2 Improvements based on static-analysis of source code
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-09-23 20:24:57 +02:00
DL6ER
42a7948754 Implement support for custom redirection targets in regex extension, e.g., "someregex;reply=1.2.3.4;reply=fe80::1234"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-09-11 12:10:41 +02:00
DL6ER
296f2eb85a Add regex extension ";reply=NXDOMAIN,NODATA,REFUSED,IP,NONE"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-09-09 21:51:09 +02:00
DL6ER
55bf825a81 Implement TOML config file reader/writer and a converter of the pre-v6.0 config file format.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-06-10 12:11:25 +02:00
DL6ER
da83042850 Use specific log routines in regex.c
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-05-27 11:28:33 +02:00
DL6ER
774bd0338a Store in and restore from long-term database: reply type, DNSSEC type, reply delay (if applicable), client hostname (if applicable), TTL and regex ID (if applicable)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-05-25 15:32:38 +02:00
DL6ER
97219d45cf Fix type handling to not offset by 1
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-26 19:18:38 +02:00
DL6ER
1db7c40106 Update tests
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-26 14:40:06 +02:00
DL6ER
45faefa786 Merge branch 'development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-26 14:09:50 +02:00
DL6ER
0136ced707 Log correct database index on regex warnings
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-03-28 08:06:19 +00:00
DL6ER
f0972f6528 Also log ignored extra regex extensions to the message database table
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-03-28 08:06:19 +00:00
DL6ER
4582996482 Tests: Add failed and successful login attempts
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-02-01 12:27:38 +01:00
DL6ER
dfc9dac166 Add OpenAPI schema validation (npm test)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-02-01 12:03:20 +01:00
DL6ER
891c96a43e Fix regex-test mode
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-31 16:51:59 +01:00
DL6ER
d1269c0a8a Move /api/stats/history to /api/history/queries
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-30 16:13:31 +01:00
DL6ER
0358c3b861 Test compile regex before adding to the database (we may want to reject it)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-23 08:31:21 +01:00
DL6ER
deae66ba58 Optimize datastructures using bitfields and item re-arrangement (to minimize padding). This reduces the size of query, client, and regex records by 8 bytes per item. Note that this optimization was done on x86_64 and may not apply for other architectures (32bit architectures already used less padding).
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-17 13:06:16 +01:00
DL6ER
21537822cb Merge pull request #999 from pi-hole/new/iface_change_same_IP
Detect and handle interface changes of clients with the same IP
2021-01-14 20:55:30 +01:00
DL6ER
777c6f2ef4 Do not sync after executing regular expression on a domain
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-12-25 09:45:04 +01:00