Struct aya::programs::tc::SchedClassifier [−][src]
pub struct SchedClassifier { /* fields omitted */ }
Expand description
A network traffic control classifier.
SchedClassifier
programs can be used to inspect, filter or redirect
network packets in both ingress and egress. They are executed as part of the
linux network traffic control system. See
https://man7.org/linux/man-pages/man8/tc-bpf.8.html.
Examples
Minimum kernel version
The minimum kernel version required to use this feature is 4.1.
use std::convert::TryInto;
use aya::programs::{tc, SchedClassifier, TcAttachType};
// the clsact qdisc needs to be added before SchedClassifier programs can be
// attached
tc::qdisc_add_clsact("eth0")?;
let prog: &mut SchedClassifier = bpf.program_mut("redirect_ingress")?.try_into()?;
prog.load()?;
prog.attach("eth0", TcAttachType::Ingress)?;
Implementations
Loads the program inside the kernel.
See also Program::load
.
pub fn attach(
&mut self,
interface: &str,
attach_type: TcAttachType
) -> Result<LinkRef, ProgramError>
pub fn attach(
&mut self,
interface: &str,
attach_type: TcAttachType
) -> Result<LinkRef, ProgramError>
Attaches the program to the given interface
.
Errors
TcError::NetlinkError
is returned if attaching fails. A common cause
of failure is not having added the clsact
qdisc to the given
interface, see qdisc_add_clsact
Trait Implementations
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
Performs the conversion.
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
Performs the conversion.