Struct aya::programs::CgroupSkb [−][src]
pub struct CgroupSkb { /* fields omitted */ }
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.
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")?.try_into()?; egress.load()?; egress.attach(file, CgroupSkbAttachType::Egress)?;
Implementations
Loads the program inside the kernel.
See also Program::load
.
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
.
pub fn attach<T: AsRawFd>(
&mut self,
cgroup: T,
attach_type: CgroupSkbAttachType
) -> Result<LinkRef, ProgramError>
[src]
pub fn attach<T: AsRawFd>(
&mut self,
cgroup: T,
attach_type: CgroupSkbAttachType
) -> Result<LinkRef, ProgramError>
[src]Attaches the program to the given cgroup.
Trait Implementations
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
Auto Trait Implementations
impl !RefUnwindSafe for CgroupSkb
impl !UnwindSafe for CgroupSkb