Implementing multi-prog attach support #3456
Replies: 3 comments 7 replies
-
Design Proposal: We implement option 2. ebpfcore translates the UM flags to a 64-bit priority number. Since new programs can be inserted in the middle of the "chain", runtime may need to sometimes reallocate priorities. As an alternative, we can restrict the max chain count to say, 32. Then by using 64-bit numbers for priority, runtime does not need to recompute / update priority for any of the attached programs. eBPF runtime will pass this computed priority to the extensions while attaching the programs. Extensions can then implement their logic of invoking all the programs. Examples:
|
Beta Was this translation helpful? Give feedback.
-
How does the extension know (or notify at compile time) if there is any conflict (same number used by two different programs) in the priority of the ebpf program specified? |
Beta Was this translation helpful? Give feedback.
-
Option 2 above supports multiple flags, like: BPF_F_{BEFORE | AFTER} ID or FD -- controlled by BPF_F_ID Multiple combinations of the above flags are possible.
Questions:
|
Beta Was this translation helpful? Give feedback.
-
This is in context of adding a generic support to attach multiple programs to an attach point (hook) for any program type, a subset of which is currently tracked by #2626.
Looking at the current available solutions on Linux, it looks like there are 2 possible designs we can use:
OPTION 1: XDP dispatcher approach
In Linux,
libxdp
uses XDP dispatcher program to "chain" multiple programs to a hook. Salient features:Windows Implementation:
References:
OPTION 2: Generic attach / detach APIs
This is the second and newer approach in Linux. Salient features:
Windows implementation:
References:
Question: Which design approach should we take?
Interim solution proposal: Since we urgently need support for multi-prog attach for at least SOCK_ADDR hook, while we decide on the approach and design, we can implement this only for SOCK_ADDR in netebbpfext with FIFO logic.
Beta Was this translation helpful? Give feedback.
All reactions