Commit Graph

48 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
e9f7449bf8 Improve inner-struct alignment of variables. Due to reduced padding, we save a lot of space. This will directly reduce FTL's memory footprint.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-12 11:45:38 +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
cace456d4b Add const to more char* which should have this qualifier.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-10 11:39:27 +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
af3302652b Remove globally defined domains array.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-06 17:10:19 +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
DL6ER
ea7cdfb0ba Merge branch 'development' into new/shmem 2018-09-26 23:14:09 +02:00
DL6ER
3e0b580f1a Don't return -1 as number of read whitelist domains if there is no whitelist file. Also, don't try to free the array of whitelist domains if there are none.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-09-26 12:47:54 +02: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
12e6c6dd8a it should be "regex on line ..." not "regex in line ..." + avoid double printing of the error
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-05 14:31:24 +02:00
DL6ER
e7c7ff5f10 Make more clear that the number is the line of the regex in regex.list
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-05 14:26:34 +02:00
DL6ER
201cdfc9be Fix incorrect log_regex_error() subroutine
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-05 14:19:33 +02:00
DL6ER
1b728f33ec Review comments 2
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-07-18 20:54:08 +02:00
DL6ER
a7bbdfa065 Review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-07-18 17:02:48 +02:00
DL6ER
b71f2400c1 Show not only matching line but also the matching regex itself to ease regex debugging
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-07-17 17:47:31 +02:00
DL6ER
9bf325c66f Line match is actually in index+1
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-07-16 18:51:23 +02:00
DL6ER
c4a19c3401 Add REGEX_DEBUGMODE config option
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-07-16 18:48:49 +02:00
Mcat12
4a3f26597d Log which regexes failed to compile.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-07-12 21:31:21 -04:00
Mcat12
13394b1522 Skip regex lines which are commented out with #
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-07-12 21:30:02 -04:00
DL6ER
0950f051f6 Review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-30 21:03:21 +02:00
DL6ER
6236a73224 Fix typo in comment
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-30 14:03:32 +02:00
DL6ER
fc5e4a2790 Explicitly mark skipped regex filters as not initialized and correct displayed number of imported regex domains by the number of skipped lines
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-30 14:00:45 +02:00
DL6ER
767dbf11c1 Log warning when empty regex line is found
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-30 13:57:48 +02:00
DL6ER
0fb9c2cd53 Skip empty regex filters
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-30 13:52:00 +02:00
DL6ER
15ee0f6b79 Extend countlines() to account for a final line in a file that has no newline character at its end. Also put in a failsafe guard in the regex loop.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-18 18:09:51 +02:00
DL6ER
b47c312985 Move in_whitelist() check into FTL_new_query) routine to keep the match_regex() code clean
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-05 10:08:44 +02:00
DL6ER
614672a502 Minor code change
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-04 22:40:33 +02:00
DL6ER
4de151b5ba Merge branch 'development' into new/regex_whitelist
Signed-off-by: DL6ER <dl6er@dl6er.de>

Conflicts:
	regex.c
2018-06-04 22:37:36 +02:00
DL6ER
82ffa86f3d Worked on review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-04 22:33:06 +02:00
DL6ER
8e995a46f5 Additional safety mechanism to no read further as we have allocated memory
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-04 17:22:19 +02:00
DL6ER
21ee38affa Add the ability to whitelist regex blocked. This significantly improves the flexibility of whitelisting and implements full wildcard whitelisting support.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-04 17:00:05 +02:00
DL6ER
c699c41bc1 Always print timing when in debug mode
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-02 12:02:30 +02:00
DL6ER
dbfa382bc5 Reduce regex evaluation warning to be shown only if evaluation took longer than 10.0 milliseconds
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-02 11:11:39 +02:00
Mcat12
a925e04602 Only log regex evaluation times if they are over 100ms
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-06-02 01:07:57 -04:00
DL6ER
9d62af3428 Set deallocated pointers to NULL as good practice measure
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-27 11:58:23 +02:00
DL6ER
77e85ad144 Re-parse regex.list on receive of SIGHUP and use possibly changed blocking mode for regex blocked domains
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-27 11:40:40 +02:00
DL6ER
d52482168a Switch to compiling on GNU-C11 standard. According to https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/C-Dialect-Options.html#C-Dialect-Options this dialect will become standard in a future gcc.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-26 23:12:12 +02:00
DL6ER
7e31c8e797 Remove debug print statement
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-19 17:27:44 +02:00
DL6ER
7a1d037709 Remove obsolete variables
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-19 17:25:54 +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
0f40cd19be Only check regex that have been compiled
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-28 22:40:14 +02:00
DL6ER
e31d686d64 Implement method for having multiple regex + add timer output (to be removed after beta testing phase)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-25 11:43:15 +02:00
DL6ER
2f6e24045f Add regex blocking support
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-24 17:22:17 +02:00