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

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.

Returns the name of the program.

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

Formats the value using the given formatter. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.