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
Mark Drobnak
adecb56f1c
Merge branch 'development' into fix/externally_blocked_use_RA
2019-03-11 22:47:20 -04:00
DL6ER
f2ac2362fa
Merge branch 'development' into fix/externally_blocked_use_RA
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-11 17:16:22 +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
0d6f424f1f
Enforce prototyping. This ensures that function that are not explicitly made globally available across files (through an explicit prototype in a header file) need to be marked static such that their scope is limited to where they are actually used. This also enforces strict prototyping, i.e., a function with zero arguments needs to be written explicitly as function(void) as a non-strict prototype such as function() would in fact allow an arbitrary amount of parameters.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-03-10 15:31:14 +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
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
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
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
Mark Drobnak
341dd8f90b
Merge pull request #511 from pi-hole/sqlite/3.27.1
...
Update SQLite3 to v3.27.1
2019-02-17 14:18:33 -05:00
Mcat12
ab082a4857
Fix spelling error
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2019-02-17 11:16:12 -08:00
Mcat12
d04c0aa3a4
Fix last timestamp getting set to zero if no queries were saved
...
If no queries were saved to the database, the last timestamp field would
be set to zero instead of left as it was. In addition, this commit skips
adding zero to the other counters in the database if there were no saved
queries.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2019-02-16 14:57:36 -08:00
DL6ER
f54f5d413c
As of SQLite3 v3.27.0, string literals need to be single-quotes. Double-quoted string literals are still accepted but issue a warning (see https://sqlite.org/quirks.html#dblquote )
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-02-16 09:41:14 +01:00
DL6ER
756fd0055d
Add SQLite3 logging callback. SQLite can be configured to invoke a callback function containing an error code and a terse error message whenever anomalies occur. This mechanism is very helpful in tracking obscure problems that occur rarely and in the field. Application developers are encouraged to take advantage of the error logging facility of SQLite in their products, as it is very low CPU and memory cost but can be a huge aid for debugging.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-02-16 09:17:35 +01:00
Mcat12
3cc4cca280
Remove OVERTIME_NOT_AVAILABLE
...
There is now no case where the overTime ID is invalid. GC will run
before the overTime slots run out.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com >
2019-02-10 13:55:10 -08: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
5bee17bd24
Implement finer-grained externally blocked displaying. This updates the shared memory version to 3
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-02-04 17:42:11 +01:00
DL6ER
f3235f107c
Merge branch 'development' into fix/externally_blocked_use_RA
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-02-03 08:35:02 +01:00
DL6ER
be18b0745e
Several microoptimizations around the code that checks the AD bit. Remove the now obsolete AD boolean in the queries struct
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-02-01 20:38:11 +01:00
DL6ER
72d91e8288
Merge branch 'release/v4.2' into update/devel_v4.2
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
Conflicts:
database.c
docker/arm/Dockerfile
2019-01-24 10:18:27 +01:00
DL6ER
608458edfd
Only include sqlite3.h in those files that need it. This should improve the compiling time slightly
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-01-22 17:26:25 +01:00
DL6ER
9d0346a424
Ensure lastdbindex in properly set after reading in queries from the database
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-01-22 17:23:34 +01:00
DL6ER
2c41ae7b73
Offer fine grained debugging options through independentally configurable debug flags. The debugging output of FTL gre considerable over the last year and became overwhelming for users that are not used to it. With this addition, users will be able to switch on only what they want to see.
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-01-16 09:14:35 +01:00
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
DL6ER
486e497d8a
Review comments
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2019-01-07 02:17:22 +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
ac6ee9e1ef
Add config option to disable ARP cache parsing
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-26 11:29:28 +01:00
DL6ER
3a8c87907a
Initialize new devices with lastQuery property if available
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-26 11:14:25 +01:00
DL6ER
68a584ad8b
Reduce code duplication
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-26 01:21:00 +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
82b43c332b
Parse ARP cache after storing queries into long-term database(usen the dedicated database thread)
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-25 17:56:44 +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
40fd4d317e
Add / update rows in table network depending on what we see in the ARP cache
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-24 13:19:18 +01:00
DL6ER
36d1499804
Add network table. This will update the database to version 3. Furthermore, we make some database routines globally (add prototypes to routines.h) and mark some internal database variables as static. This commit also improves on the speed of the database routines as the main loop is changed to run from the last saved query to the most recent one instead of looping over all queries in memory. This ID is corrected when queries are removed in gc.c
...
Signed-off-by: DL6ER <dl6er@dl6er.de >
2018-12-23 12:51:03 +01: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