Commit graph

483 commits

Author SHA1 Message Date
ppom
dcc2e1ec4c
v2.2.0 v2.2.0 2025-08-08 12:00:00 +02:00
ppom
ca89c7f72a
Fix filter commands executing before start commands
Now creating the socket file before starting its manager.
So I can launch start commands after its creation, and before creating
the filter managers.
2025-08-08 12:00:00 +02:00
ppom
e8f13dc9ff
cargo fmt 2025-08-08 12:00:00 +02:00
ppom
a7b63b69a8
Database: finish writing entries when quitting 2025-08-08 12:00:00 +02:00
ppom
10bd0a1859
Tree::fetch_update: Do not remove and re-add entries.
Better cloning the value than writing another entry!
2025-08-08 12:00:00 +02:00
ppom
f4b5ed20ab
Add debug on start/stop commands 2025-08-08 12:00:00 +02:00
ppom
58f4793308
Fix triggers being forgotten on after actions with on_exit: true
decrement_trigger do not delete triggers anymore when exiting

test still failing because filters start before start commands
2025-08-08 12:00:00 +02:00
ppom
607141f22f
Fix after action commands not being correctly awaited
We were scheduling the action with exec_now, but it spawns a new task
itself, which did not have the ShutdownToken.

Persistance part of the start_stop test doesn't work
because when the after actions are executed, they decrement the trigger,
which is then removed from DB.
So they should not decrement it anymore, just check that it's still
there. Next commit!
2025-08-06 12:00:00 +02:00
ppom
c824583613
Add new failing tests on start / stop sequences.
They fail because reaction don't correctly order stop commands after
2025-08-06 12:00:00 +02:00
ppom
91885e49bd
Ignore new tests that fail for now
FIXME check this later
2025-08-06 12:00:00 +02:00
ppom
eea708883b
Add example config equality test 2025-08-06 12:00:00 +02:00
Baptiste Careil
0337fcab1f
Automate some tests 2025-08-06 12:00:00 +02:00
ppom
90ec56902a
Add tests for triggers tree migration 2025-08-06 12:00:00 +02:00
ppom
eaf40cb579
test Filter::regex conformity after setup 2025-08-06 12:00:00 +02:00
ppom
441d981a20
Duplicate::Ignore: do not show ignored matches
move match logging from concepts/filter to daemon/filter
2025-08-06 12:00:00 +02:00
ppom
f36464299a
Duplicate::Extend: reschedule correctly actions not already triggered
Before, it rescheduled all actions with an `after` directive,
which is wrong when some after actions have already been executed
(in case of different actions with different after durations)
2025-08-06 12:00:00 +02:00
ppom
a1df62077c
cargo clippy 2025-08-05 12:00:00 +02:00
ppom
56e4d77854
Deduplication of triggers on start 2025-08-05 12:00:00 +02:00
ppom
f4d002c615
Fix trigger count on start
schedule_exec was called before inserting the data in triggers,
resulting in action count being set again after decrement in schedule
exec.
This could lead to:
- trigger not disappearing after done
- second action with no "after" not being run
- ...
2025-08-05 12:00:00 +02:00
ppom
f477310a29
duplicates: Add failing tests for Deduplication on start 2025-08-05 12:00:00 +02:00
ppom
773eb76f92
Update README to advertise ip-specific features 2025-08-04 12:00:00 +02:00
ppom
59c7bfdd1d
Move action filtering logic from daemon to concepts and use at 3 places
Used in Filter::schedule_exec, Filter::handle_order, State::add_trigger
Add proper testing.
This also fix previously failing test.
2025-08-04 12:00:00 +02:00
ppom
cebdbc7ad0
ipv4 regex: do no accept numbers 0[0-9]
The Rust std won't accept it anyway, as it interprets numbers starting
with 0 as octal numbers and forbid that.
2025-08-04 12:00:00 +02:00
ppom
0b2bfe533b
Update example configs to get rid of ip46tables 2025-08-04 12:00:00 +02:00
ppom
a0b804811b
Refacto: make all Config structures' fields public
Config is 'static after setup anyways.
I don't need to hide all this, it's just cumbersome for tests.
2025-08-04 12:00:00 +02:00
ppom
6f63f49acd
Add failing test for flushing ipvXonly actions 2025-08-04 12:00:00 +02:00
ppom
b927ba4fdf
Add ipv4only/ipv6only logic to actions 2025-08-04 12:00:00 +02:00
ppom
e4e50dd03b
cargo clippy 2025-08-04 12:00:00 +02:00
ppom
0a9c7f97df
Split IP pattern code in 3 files 2025-08-04 12:00:00 +02:00
ppom
130607d28f
Add test for pattern deserialization 2025-08-04 12:00:00 +02:00
ppom
19e3b2bf98
Make IP regex much more robust and add tests
IP will be correctly extracted in any regex line, even if it is
surrounded by greedy catch-all: .*<ip>.*

This what actually hard to do!
2025-08-04 12:00:00 +02:00
ppom
421002442e
Add ip tests on daemon::filter
Fix PatternType deserialization
Fix regex deserialization (now optional)
Tests currently failing
2025-08-04 12:00:00 +02:00
ppom
4f79b476aa
Cut ip regexes in smaller blocks and add tests 2025-08-04 12:00:00 +02:00
ppom
6cde89cc4b
rename file 2025-08-04 12:00:00 +02:00
ppom
43f8b66870
Update config documentation 2025-08-04 12:00:00 +02:00
ppom
94b40c4a0b
Add more tests
Done: Tests on PatternIp.
Todo: Tests on Pattern.

Fixed a bug in is_ignore.
Checked a new possible misconfiguration.
2025-08-04 12:00:00 +02:00
ppom
a5f616e295
WIP pattern ip
add ipv{4,6}mask
factorize redundant code in util functions
normalize match
most tests done
2025-08-04 12:00:00 +02:00
ppom
04b5dfd95b
ip: Add includes, tests, more setup constraints 2025-08-04 12:00:00 +02:00
ppom
44e5757ae3
WIP pattern ip 2025-08-04 12:00:00 +02:00
ppom
ea0452f62c
Fix components starting order
Now Database and Socket components are created before start commands are
executed. So in case of error, start commands are not executed.

Also socket syscalls are now async instead of blocking, for better
integration with the async runtime.

New start order:
- DB
- Socket
- Start commands
- Streams
2025-08-04 12:00:00 +02:00
ppom
6b970e74c5
Update configuration reference 2025-07-14 12:00:00 +02:00
ppom
d8db2a1745
Add extensive test on Duplicate and fix related bug 2025-07-14 12:00:00 +02:00
ppom
6f346ff371
Test existing FilterManager tests for each Duplicate enum 2025-07-14 12:00:00 +02:00
ppom
81e5fb4c42
add State tests and fix trigger persistance
Triggers were only persisted for retry duration, instead of longuest
action duration.
As retry is often shorter than after, this would make reaction forget
most triggers on restart.
entry_timeout is now set to longuest_action_duration.
2025-07-14 12:00:00 +02:00
ppom
270a1a9bdf
Duplicate: Fix tests, more tests 2025-07-14 12:00:00 +02:00
ppom
d9842c2340
Duplicate::Extend: Re-Trigger only after actions
- implement schedule_exec's only_after
2025-07-14 12:00:00 +02:00
ppom
22384a2cb4
rename React::Exec to React::Trigger 2025-07-14 12:00:00 +02:00
ppom
2cebb733b5
WIP duplicates
- change remove_trigger to remove all triggers for a Match
- schedule_exec will take only_after boolean
2025-07-14 12:00:00 +02:00
ppom
881fc76bf9
WIP duplicates
- new duplicate option
- change triggers Tree structure to keep O(log(n)) querying:
  now we need to know if a match already has a trigger.
- triggers migration
- triggers adaptations in State & FilterManager
2025-07-14 12:00:00 +02:00
ppom
4ddaf6c195
v2.1.2 v2.1.2 2025-07-14 12:00:00 +02:00