Refactor program management #88
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update the
bf_flavor_ops
to simplify program loading and attachment to the BPF hooks. TC and XDP now use BPF link andBPF_LINK_UPDATE
to attach and update an existing program. ForBPF_NETFILTER
, the program update logic is handle inattach_prog
to, but slightly differently as it doesn't supportBPF_LINK_UPDATE
.The generation and program management logic in
codegen.c
andprogram.c
has been simplified to provide to main paths:bf_codegen_up()
: create thebf_program
objects for a givenbf_codegen
, generate the BPF bytecode and attach the programs to the system.bf_codegen_update()
: update the bytecode of existing BPF programs, and attach them to the system, replacing the out-of-date version of the same program.This updated logic makes the daemon's workflow simpler and easier to work with. Both
ipt
andnft
front-end have been updated.