Commit Graph

53 Commits

Author SHA1 Message Date
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
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
538779d1b4 Merge branch 'development' into tweak/remove_global_objects
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-11 12:09:00 +01:00
DL6ER
671ca07d23 Add further attributes that give the compiler a hint how large the returned pointers might be.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-11 11:58:10 +01:00
DL6ER
f7b0108d86 Only use new warning flags when gcc is at least in version 8 (doesn't work on the CI, otherwise)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-08 12:07:03 +01:00
DL6ER
32be41ed5d Declare attributes for functions in FTL. These attributes help the compiler to optimize functions calls and to check our code more carefully during compilation. See pull reqeust text for details.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-08 11:36:11 +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
bbebb6edcf Remove validate_access() subroutine. We don't need it any longer.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-06 17:33:48 +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
DL6ER
92d819899e Add MAC->Vendor database support. We will provide the database as an optional auxiliary file.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-12-30 23:35:15 +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
109861f5d0 Make AUDITLISTFILE customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 17:15:45 +01:00
DL6ER
f7a5ef022b Make SETUPVARSFILE customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 17:14:12 +01:00
DL6ER
5e1743988e Make REGEXLISTFILE customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 17:12:55 +01:00
DL6ER
ee6cf89607 Make GRAVITYFILE customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 17:11:32 +01:00
DL6ER
2f8a67f495 Make WHITELISTFILE customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 17:09:30 +01:00
DL6ER
ce95d08d6a Remove hard-coded location of preEventHorizon and 01-pihole.conf. They are not used anywhere anymore.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 16:59:23 +01:00
DL6ER
32498b5d5d Remove files.log. It is not used anymore and a relict from pre-v4.0 times.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 16:57:09 +01:00
DL6ER
f5d8adfb1d Make SOCKETFILE customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 16:54:17 +01:00
DL6ER
42403734b0 Make PORTFILE customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 16:52:48 +01:00
DL6ER
c747023424 Make PID file path customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 16:44:40 +01:00
DL6ER
d104d6b271 Make log file path customizable
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 16:37:49 +01:00
DL6ER
7fc77c67a2 Search for readable config file in alternative location in case the default path is not available.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-11-07 16:21:00 +01: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
eb1d851ed2 Allocate more struct memory earlier
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-04 09:26:37 +02:00
DL6ER
77f932be47 Move query type determination further up
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-03 15:42:15 +02:00
DL6ER
edf74617ae Fix wrong pointer reference
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-03 09:15:04 +02:00
DL6ER
5d22aa774e Also store queries struct in shared memory object
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-02 20:09:39 +02:00
DL6ER
584c23dc26 Also store forwarded struct in shared memory object
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-02 20:04:47 +02:00
DL6ER
249d236673 Also store clients struct in shared memory object
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-02 20:00:05 +02:00
DL6ER
0ced77c93b Also store domains struct in shared memory object
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-02 19:51:36 +02:00
DL6ER
2e12558f04 Allocate shared memory in units of pages
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-02 17:40:26 +02:00
DL6ER
1b7e08419c Add shared memory components to store strings in shared memory
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-02 13:23:12 +02:00
DL6ER
d7d851860a Store size in string buffer + use long long for string position indices
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-02 12:19:11 +02:00
DL6ER
1a508fc40b Rename last_pos to next_pos and use struct for string buffer
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-02 12:08:21 +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
d50494b8f4 Get rid of numBlocked file, FTLDNS can now determine number of domains thanks to the new lists format
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-21 23:57:25 +02:00
DL6ER
821e64e514 Accept gravity.list and black.list in simple domain list format. Speeds up list importing by about 2x
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-21 23:26:44 +02:00
DL6ER
c5f34a4dea Use number of effectively blocked domains from /etc/pihole/numBlocked if available. Fall back to counting number of entries in preEventHorizon if this file is not found (e.g. updated gravity didn't run yet)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-03-30 21:02:25 +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