pub struct SkLookup { /* private fields */ }
Expand description

A program used to redirect incoming packets to a local socket.

SkLookup programs are attached to network namespaces to provide programmable socket lookup for TCP/UDP when a packet is to be delievered locally.

You may attach multiple programs to the same namespace and they are executed in the order they were attached.

Minimum kernel version

The minimum kernel version required to use this feature is 5.9.

Examples

use std::fs::File;
use std::convert::TryInto;
use aya::programs::SkLookup;

let file = File::open("/var/run/netns/test")?;
let program: &mut SkLookup = bpf.program_mut("sk_lookup").unwrap().try_into()?;
program.load()?;
program.attach(file)?;

Implementations

Loads the program inside the kernel.

Attaches the program to the given network namespace.

The returned value can be used to detach, see SkLookup::detach.

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.

Detaches the program.

See SkLookup::attach.

Unloads the program from the kernel.

Links will be detached before unloading the program. Note that owned links obtained using take_link() will not be detached.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the RawFd of the program if it has been loaded, or None

Returns the RawFd of the program if it has been loaded, or None

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.