pub struct CgroupSkb { /* private fields */ }
Expand description
A program used to inspect or filter network activity for a given cgroup.
CgroupSkb
programs can be used to inspect or filter network activity
generated on all the sockets belonging to a given cgroup. They can be
attached to both ingress and egress.
Minimum kernel version
The minimum kernel version required to use this feature is 4.10.
Examples
use std::fs::File;
use std::convert::TryInto;
use aya::programs::{CgroupSkb, CgroupSkbAttachType};
let file = File::open("/sys/fs/cgroup/unified")?;
let egress: &mut CgroupSkb = bpf.program_mut("egress_filter").unwrap().try_into()?;
egress.load()?;
egress.attach(file, CgroupSkbAttachType::Egress)?;
Implementations
sourceimpl CgroupSkb
impl CgroupSkb
sourcepub fn load(&mut self) -> Result<(), ProgramError>
pub fn load(&mut self) -> Result<(), ProgramError>
Loads the program inside the kernel.
See also Program::load
.
sourcepub fn expected_attach_type(&self) -> &Option<CgroupSkbAttachType>
pub fn expected_attach_type(&self) -> &Option<CgroupSkbAttachType>
Returns the expected attach type of the program.
CgroupSkb
programs can specify the expected attach type in their ELF
section name, eg cgroup_skb/ingress
or cgroup_skb/egress
. This
method returns None
for programs defined with the generic section
cgroup/skb
.
sourcepub fn attach<T: AsRawFd>(
&mut self,
cgroup: T,
attach_type: CgroupSkbAttachType
) -> Result<LinkRef, ProgramError>
pub fn attach<T: AsRawFd>(
&mut self,
cgroup: T,
attach_type: CgroupSkbAttachType
) -> Result<LinkRef, ProgramError>
Attaches the program to the given cgroup.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for CgroupSkb
impl !Send for CgroupSkb
impl !Sync for CgroupSkb
impl Unpin for CgroupSkb
impl !UnwindSafe for CgroupSkb
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