Skip to main content

aya_obj/programs/
cgroup_skb.rs

1//! Cgroup skb programs.
2use crate::generated::bpf_attach_type;
3
4/// Defines where to attach a `CgroupSkb` program.
5#[derive(Copy, Clone, Debug)]
6pub enum CgroupSkbAttachType {
7    /// Attach to ingress.
8    Ingress,
9    /// Attach to egress.
10    Egress,
11}
12
13impl From<CgroupSkbAttachType> for bpf_attach_type {
14    fn from(s: CgroupSkbAttachType) -> Self {
15        match s {
16            CgroupSkbAttachType::Ingress => Self::BPF_CGROUP_INET_INGRESS,
17            CgroupSkbAttachType::Egress => Self::BPF_CGROUP_INET_EGRESS,
18        }
19    }
20}