DL6ER
b02c69fff4
Combine shmem.h and shmem_r.h
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-07-01 12:23:50 +02:00
DL6ER
602bd07a50
Only include smaller header files in the source code files. Remove routines.h
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-06-29 21:39:58 +02:00
DL6ER
7a100aed53
Modularize header files
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-06-29 18:01:37 +02:00
DL6ER
93d17a332a
Merge branch 'development' into tweak/remove_global_objects
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-04-16 18:04:40 +02:00
DL6ER
6fcbce6c34
Improve code based on a full static analysis of our code. There are no real bugs, nowever, we use the obtained knowledge to improve the code such as unify declarations and function definitions, reduce the scope of local variables, mark many function arguments and local variables const when they are, fix the type expected by %x and fix one if-condition
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-04-15 22:35:14 +02:00
DL6ER
9992258563
getDomainString() needs to be called with queryID not domainID
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-16 10:47:32 +01:00
DL6ER
36fee76052
Merge branch 'development' into tweak/remove_global_objects
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-14 21:39:58 +01:00
DL6ER
0257b273bd
Declare several more pointers to queries, domains, and clients pointers as read-only when this is currently the case.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-12 20:08:58 +01:00
DL6ER
a3924c06cf
Declare return value of getstr() as const char* because the returned strings should not be modifiable. Similarly, neither pack_fixstr() nor pack_str32() should be able to modify strings they are given. Furthermore, getDomainString(), getClientIPString(), getClientNameString(), getSetupVarsArray(), insetupVarsArray(), and getSetupVarsBool() should never modify the strings they receive as arguments.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-10 11:24:51 +01:00
DL6ER
0842524037
Add -Wshadow to extra warning flags. It defaults to -Wshadow=global and implies -Wshadow=local. Apply correspsonding changes due to shadowing of variables in the current codebase.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-08 10:08:11 +01:00
DL6ER
8c11628e71
Skip magic byte validation when we're just about to create the entry for the first time (magic byte hasn't ben initialized yet)
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-06 18:53:33 +01:00
DL6ER
0b5d6c3eae
Shorten name of structs. This is only of cosmetic nature and does not change any functionality in the code.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-06 17:47:34 +01:00
DL6ER
dd2ae55811
Remove globally defined forwarded array.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-06 17:30:44 +01:00
DL6ER
af3302652b
Remove globally defined domains array.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-06 17:10:19 +01:00
DL6ER
6466a69da4
Remove globally defined clients array.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-06 16:52:20 +01:00
DL6ER
810e36bef8
Remove globally defined queries array.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-06 16:26:54 +01:00
DL6ER
2f74929d2a
Merge branch 'development' into tweak/overhaul_overTime
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-02-18 19:00:09 +01:00
DL6ER
cde008177f
Redesign overTime data structure to use a known size, avoiding the need for on-the-fly resizing of the nested structs
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-02-10 09:30:41 +01:00
Mcat12
52c2148c78
Fix counters->clients getting incremented twice due to v4.2 merge
...
In release/v4.2, the `counters->clients++` call was moved to be after
`newOverTimeClient`. When that change was merged to development, the
first call was accidentally not deleted, causing it to happen twice
(before and after `newOverTimeClient`).
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2019-01-27 19:40:23 -08:00
DL6ER
a2496a7f25
Merge branch 'release/v4.2' into update/development/release/v4.2
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-01-27 22:36:22 +01:00
DL6ER
d2b6b96df6
Explicitly use clientID for newOVerTimeClient() instead of using the private variable overTimeClientCount to avoid (possibly) error-prone double-entry bookkeeping.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-01-25 11:09:41 +01:00
DL6ER
f2f543c8d6
Do not count in findClient() if search is triggered from parse_arp_cache()
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-28 20:39:03 +01:00
DL6ER
d8fdf76ceb
Store number of queries per client in the database
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-28 12:18:35 +01:00
DL6ER
95d3c02c5f
Store lastQuery property for known clients
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-25 22:35:16 +01:00
DL6ER
c7bdf9bd60
Update if device uses Pi-hole and store host name if available
...
Print executed SQL statements when in debug mode
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-25 13:45:34 +01: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
515f14f35f
Ensure findOverTimeID() cannot return negative indices. Fixes #397
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-10-13 11:01:57 +02: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
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
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
25eb416f92
Remove memory sub-structure
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-06-23 15:02:36 +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
df9d119810
Merge pull request #277 from pi-hole/fix/wildcard_warning
...
Suppress wrong warning
2018-05-12 15:58:12 +02:00
DL6ER
c71cb022f7
Return early if no wildcard domains are defined to avoid warning to be printed although for-loop will anyhow be skipped
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-05-11 16:48:27 +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
a464798d95
Don't call validate_access() when the for-loop afterwards will be skipped
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-30 22:42:34 +02:00
DL6ER
76924b9425
Merge pull request #260 from pi-hole/new/regex
...
Add regex blocking support to FTLDNS
2018-04-29 17:57:09 +02:00
DL6ER
49c79add6c
Optimize several datastructure sunroutines
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-29 11:32:23 +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
2f6e24045f
Add regex blocking support
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-24 17:22:17 +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
dfc32a6204
Move reply type and dnssec status to per-query (not per-domain) for more accurate data at negligible additional costs
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-04-06 23:32:32 +02:00
DL6ER
2ae4b52bb3
A number of improvements:
...
- use "extern" for the glibal variable specifications in the header files (and clarif where the variables are actually defined)
- record number of failed requests to forward destinations
- Add dnsmasq_interface.h to DTLDEPS
- Add new request type ">cacheinfo" to get information about cache usage in the resolver
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-02-26 17:24:09 +01:00
DL6ER
ea3309e7b1
Initial commit for FTLDNS
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-02-22 20:21:06 +01:00