pub struct SkSkb { /* private fields */ }
Expand description
A program used to intercept ingress socket buffers.
SkSkb
programs are attached to socket maps, and can be used to
inspect, redirect or filter incoming packet. See also SockMap
and
SockHash
.
Minimum kernel version
The minimum kernel version required to use this feature is 4.14.
Examples
use std::convert::{TryFrom, TryInto};
use aya::maps::SockMap;
use aya::programs::SkSkb;
let intercept_ingress = SockMap::try_from(bpf.map_mut("INTERCEPT_INGRESS")?)?;
let prog: &mut SkSkb = bpf.program_mut("intercept_ingress_packet").unwrap().try_into()?;
prog.load()?;
prog.attach(&intercept_ingress)?;
Implementations
sourceimpl SkSkb
impl SkSkb
sourcepub fn load(&mut self) -> Result<(), ProgramError>
pub fn load(&mut self) -> Result<(), ProgramError>
Loads the program inside the kernel.
sourcepub fn attach(
&mut self,
map: &dyn SocketMap
) -> Result<SkSkbLinkId, ProgramError>
pub fn attach(
&mut self,
map: &dyn SocketMap
) -> Result<SkSkbLinkId, ProgramError>
Attaches the program to the given socket map.
The returned value can be used to detach, see SkSkb::detach.
sourcepub fn detach(&mut self, link_id: SkSkbLinkId) -> Result<(), ProgramError>
pub fn detach(&mut self, link_id: SkSkbLinkId) -> Result<(), ProgramError>
Detaches the program.
See SkSkb::attach.
sourcepub fn take_link(
&mut self,
link_id: SkSkbLinkId
) -> Result<OwnedLink<SkSkbLink>, ProgramError>
pub fn take_link(
&mut self,
link_id: SkSkbLinkId
) -> Result<OwnedLink<SkSkbLink>, ProgramError>
Takes ownership of the link referenced by the provided link_id.
The link will be detached on Drop
and the caller is now responsible
for managing its lifetime.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for SkSkb
impl Send for SkSkb
impl Sync for SkSkb
impl Unpin for SkSkb
impl UnwindSafe for SkSkb
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more