Mcat12
2b1a58bf9b
Mark queries imported from the database as having an unknown DNSSEC type
...
Also explicity marks the queries with an unknown reply type. However,
this was already happening before, because `REPLY_UNKNOWN` equals 0,
and the struct is zero-initialized.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2019-01-11 21:51:15 -08:00
Mcat12
ff4d985f9d
Merge branch 'new/shmem' into feature/shm-lock
...
# Conflicts:
# database.c
# request.c
2018-11-21 14:56:15 -05:00
DL6ER
85290bb73e
Merge branch 'development' into new/shmem
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-11-21 20:44:37 +01:00
DL6ER
8de30790f8
Review comments
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-11-10 08:16:36 +01:00
DL6ER
eeae592c58
Ensure regex validation is working as expected if privacylevel > 0. This required a certain rearrangement of how we handle domains and clients internally.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-11-09 19:02:06 +01:00
DL6ER
f8ba1739b3
Remove unused variable queryID
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-10-25 21:33:55 +02:00
DL6ER
100d92bbd9
Set queryID to zero for queries imported from the database on startup
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-10-25 21:29:16 +02:00
DL6ER
f2f3566980
Move resolution of client and upstream host names to a dedicated thread. Fixes #404
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-10-25 19:53:29 +02:00
Mcat12
d7b4ce8a5f
Remove read lock and simplify lock names
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2018-10-11 15:59:52 -04:00
DL6ER
601722d441
Obtain ID before insertion transaction and store IDs only when a query has actually been saved instead of trying to do this in a post-processing step
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-10-11 06:10:18 +02:00
DL6ER
1279b93294
Store database ID in queries struct. This information will be availabe through shmem to the API to support transparent overlap with the SQlite3 database
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-10-07 20:50:21 +02:00
Mcat12
8c68aac456
Add shared memory lock
...
This replaces the previous mutex managed by threads.c. The lock is
stored in shared memory with the name "/FTL-lock", and any clients
connecting to the shared memory are expected to use the lock when
accessing memory.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2018-10-05 01:18:40 -04:00
Mcat12
cd41aaeab4
Put overTime data into shared memory
...
The array of overTime structs is separate from the client data, because
the client data is dynamically sized. Each client has a separate shared
memory block named `/FTL-client-ID` where `ID` is the numerical ID of
the client. The client data is an array of ints, which is indexed using
the overTime time indexes.
Before, the code referenced the client data via
`overTime[timeIndex].clientdata[clientID]`
Now, the code references the data via
`overTimeClientData[clientID][timeIndex]`
The client data is updated whenever a new client or overTime slot is
added, so referencing the client data should always be valid.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2018-09-19 13:00:50 -04:00
Mcat12
e1c8ccc975
Use negative query IDs for queries loaded from the database
...
This is necessary for all queries to have unique IDs. Previously,
all queries loaded from the database had an ID of zero.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2018-09-18 11:40:44 -04:00
Mcat12
ae1bb5b71a
Move counters to shared memory
...
This requires that it be accessed through a pointer, so most of the
changes are just changing `counters.` to `counters->`
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2018-09-03 14:25:16 -04:00
Mcat12
bbfe186dd8
Merge branch 'development' into new/shmem
...
# Conflicts:
# api.c
# dnsmasq_interface.c
2018-09-01 22:34:39 -04:00
DL6ER
dfe27e7c3b
Add PRIVACY_NOSTATS mode that skips all (!) analysis. We furthermore don't even try to import or save anything to the database.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-08-19 14:14:06 +02:00
DL6ER
79b2865bab
Add new query type QUERY_EXTERNAL_BLOCKED triggered by an NXDOMAIN response with set AD bit (this is how Quad9 signals a blocked domain)
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-08-15 23:45:27 +02:00
DL6ER
64a895d720
Allow all query types (not only A and AAAA) during database import
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-08-09 11:57:41 +02:00
DL6ER
96928c73ef
Use strbuffer also for domains
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-08-01 19:04:02 +02:00
DL6ER
b7da12b600
Use strbuffer also for client IPs and host names
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-08-01 18:37:48 +02:00
DL6ER
3e8849049e
Store forward destination IP address and host name in contiguous string buffer
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-08-01 18:04:43 +02:00
DL6ER
9b5eb62263
Don't set regex status for domains read from database as we don't add them to the resolvers cache here (performance reasons)
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-05-19 17:40:34 +02:00
DL6ER
b6dd8ec47f
Implement reading regex from file
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-05-19 17:21:56 +02:00
DL6ER
db7dbda9da
Use status == QUERY_WILDCARD to identify regex blocked queries
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-05-19 16:37:25 +02:00
DL6ER
decef2e5fd
Remove special support for old type of wildcard lists as dnsmasq config file
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-05-19 14:46:21 +02:00
DL6ER
24b98093e8
Merge branch 'development' into ftldns/remove_old_debug_options
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
Conflicts:
args.c
2018-05-12 13:38:36 +02:00
DL6ER
5d2ed0a5a6
Remove database debug callback
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-05-12 13:07:03 +02:00
DL6ER
c606ad75ab
Remove undocumented, old, and unused debug commands
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-05-10 19:24:02 +02:00
DL6ER
f6e4ec4230
Add blocked domains counter for individual clients
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-05-10 14:22:58 +02:00
DL6ER
c7453d5343
Call memory_check() only when needed (before creating a new domain/client record)
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-29 11:05:20 +02:00
DL6ER
2e24b81557
Merge pull request #254 from pi-hole/FTLDNS-IGNORE_LOCALHOST
...
Add IGNORE_LOCALHOST config option
2018-04-14 11:44:51 +02:00
DL6ER
efbe8025d0
Implement IGNORE_LOCALHOST config option
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-11 18:50:36 +02:00
DL6ER
e2d0529993
Implement name resolving power back for FTLDNS. This re-implements lots of already extensively tested code that was present in pre-FTLDNS for over a year. This implementation is only slightly different by ensuring that name resolution is done in a specific non-blocking way.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-11 18:20:06 +02:00
DL6ER
9f940d82e0
Reduce memory footprint by removing unnecessry TTL value
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-06 23:52:07 +02:00
DL6ER
003371fcd3
Don't import AAAA queries from database if config flag AAAA_QUERY_ANALYSIS is set to No
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-05 19:41:02 +02:00
DL6ER
a686cb2792
Ensure that we do not import queries logged in the future
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-03-08 22:08:01 +01:00
DL6ER
e8c1df643d
Merge branch 'development' into FTLDNS
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
Conflicts:
database.c
2018-03-02 22:48:13 +01:00
DL6ER
9315a252fd
Merge pull request #224 from pi-hole/new/DB_integrated_counters
...
Create new table "counters" and store integrated counters therein
2018-03-02 20:52:22 +01:00
DL6ER
ea3309e7b1
Initial commit for FTLDNS
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-02-22 20:21:06 +01:00
DL6ER
91e12dfd6c
Don't close database to early when newly creating database file + some minor improvements
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-02-22 19:42:29 +01:00
DL6ER
459692ce4a
Print query string when db_get_FTL_property() fails
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-02-21 18:43:40 +01:00
DL6ER
d7a14e7e81
- Create new table "counters" and store integrated counters therein.
...
- Update FTL database to version 2
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-02-08 19:04:56 +01:00
DL6ER
4e056dfd7e
Always store client IP in the database (never the host name). We do this for consistency as we will always have IP addresses but not always host names so the current situation can actually be messy in the database. Furthermore, it should be noted that we also only ever store IP addresses (and never host names!) for the forward destinations.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-02-05 17:06:37 +01:00
DL6ER
449a2fc44d
Minor optimizations and one bug fix
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-01-26 17:21:29 +01:00
DL6ER
bfd3f1405d
Add "MAXLOGAGE" config option
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-01-21 15:13:50 +01:00
DL6ER
72ad1970c1
Also try to import data from database after flushing event
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-01-21 11:42:01 +01:00
DL6ER
446bd677f7
Validate all imported database fields
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-01-21 11:24:35 +01:00
Mcat12
587ec590f8
forwardID can be null, so check for that (don't segfault!)
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2018-01-20 20:28:20 -05:00
DL6ER
0f07c9e553
Remove unnecessarily duplicated validate_access() calls
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-01-20 14:07:32 +01:00