|
|
|
@ -80,6 +80,30 @@ impl ProgramArray {
|
|
|
|
|
///
|
|
|
|
|
/// On success, this function **does not return** into the original program.
|
|
|
|
|
/// On failure, a negative error is returned, wrapped in `Err()`.
|
|
|
|
|
#[cfg(not(unstable))]
|
|
|
|
|
pub unsafe fn tail_call<C: BpfContext>(&self, ctx: &C, index: u32) -> Result<(), c_long> {
|
|
|
|
|
let res = bpf_tail_call(ctx.as_ptr(), self.def.get() as *mut _, index);
|
|
|
|
|
if res != 0 {
|
|
|
|
|
Err(res)
|
|
|
|
|
} else {
|
|
|
|
|
unreachable_unchecked()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Perform a tail call into a program indexed by this map.
|
|
|
|
|
///
|
|
|
|
|
/// # Safety
|
|
|
|
|
///
|
|
|
|
|
/// This function is inherently unsafe, since it causes control flow to jump into
|
|
|
|
|
/// another eBPF program. This can have side effects, such as drop methods not being
|
|
|
|
|
/// called. Note that tail calling into an eBPF program is not the same thing as
|
|
|
|
|
/// a function call -- control flow never returns to the caller.
|
|
|
|
|
///
|
|
|
|
|
/// # Return Value
|
|
|
|
|
///
|
|
|
|
|
/// On success, this function **does not return** into the original program.
|
|
|
|
|
/// On failure, a negative error is returned, wrapped in `Err()`.
|
|
|
|
|
#[cfg(unstable)]
|
|
|
|
|
pub unsafe fn tail_call<C: BpfContext>(&self, ctx: &C, index: u32) -> Result<!, c_long> {
|
|
|
|
|
let res = bpf_tail_call(ctx.as_ptr(), self.def.get() as *mut _, index);
|
|
|
|
|
if res != 0 {
|
|
|
|
|