mirror of https://github.com/aya-rs/aya
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
958 B
Rust
28 lines
958 B
Rust
//! Cgroup socket programs.
|
|
use crate::generated::bpf_attach_type;
|
|
|
|
/// Defines where to attach a `CgroupSock` program.
|
|
#[derive(Copy, Clone, Debug, Default)]
|
|
pub enum CgroupSockAttachType {
|
|
/// Called after the IPv4 bind events.
|
|
PostBind4,
|
|
/// Called after the IPv6 bind events.
|
|
PostBind6,
|
|
/// Attach to IPv4 connect events.
|
|
#[default]
|
|
SockCreate,
|
|
/// Attach to IPv6 connect events.
|
|
SockRelease,
|
|
}
|
|
|
|
impl From<CgroupSockAttachType> for bpf_attach_type {
|
|
fn from(s: CgroupSockAttachType) -> bpf_attach_type {
|
|
match s {
|
|
CgroupSockAttachType::PostBind4 => bpf_attach_type::BPF_CGROUP_INET4_POST_BIND,
|
|
CgroupSockAttachType::PostBind6 => bpf_attach_type::BPF_CGROUP_INET6_POST_BIND,
|
|
CgroupSockAttachType::SockCreate => bpf_attach_type::BPF_CGROUP_INET_SOCK_CREATE,
|
|
CgroupSockAttachType::SockRelease => bpf_attach_type::BPF_CGROUP_INET_SOCK_RELEASE,
|
|
}
|
|
}
|
|
}
|