Add update-set operation for delta updates to sets#404
Add update-set operation for delta updates to sets#404pzmarzly wants to merge 9 commits intofacebook:mainfrom
Conversation
yaakov-stein
left a comment
There was a problem hiding this comment.
I find it's helpful for learning to see how other people add features and the design decisions they make, so I figured I'd give this a look over even though I just joined. Given that I'm still ramping up on the repo, please take any comments with a heavy grain of salt :)
(I didn't look over the tests and wasn't dissecting the code line by line, more just going over it for a general idea.)
Cool feature - looking forward to using it!
There was a problem hiding this comment.
Please ensure you review the tests. For the command line arguments:
- The set key format can be fetched from the API
--set-addand--set-removeshould be simplified to--addand--remove- You should accumulate the arguments from multiple
--addand--remove: the user should be able to do `--add "192.168.1.1" --add "192.168.1.2"
8e4f686 to
9e68a4d
Compare
|
Updated:
|
9e68a4d to
385c48e
Compare
qdeslandes
left a comment
There was a problem hiding this comment.
- Fix the commit names
- The first commit message is not descriptive of the work done
- Definition and implementation of
update-setshould be in the same commit - You need to update the documentation
385c48e to
41de15a
Compare
qdeslandes
left a comment
There was a problem hiding this comment.
A few more changes, but the PR looks good. Looking forward to using this!
41de15a to
12b7755
Compare
qdeslandes
left a comment
There was a problem hiding this comment.
One last comment, otherwise LGTM!
| _clean_bf_list_ bf_list counters = bf_list_default(bf_counter_free, NULL); | ||
| struct bf_set *dest_set = NULL; | ||
| int r; | ||
|
|
There was a problem hiding this comment.
Ensure opts->to_add or opts->to_remove is not empty, in which case you should return an error.
To avoid passing entire chain on every minor update, let's define a new operation that only takes a delta change, and applies it on bpfilter daemon side.
Notes
Currently every change to a set will nonetheless trigger codegen regeneration and reloading of the BPF program, but we decided it's not an issue worth superoptimizing for. We have some ideas how to make it faster (turn deletions into bpf_map deletions, keep track of bpf_map free storage, grow it exponentially if needed).
Example usage