Skip to content

Commit

Permalink
Set attach type during load for BPF_PROG_TYPE_CGROUP_SKB
Browse files Browse the repository at this point in the history
As per title, this patch sets `expected_attach_type` during load.
  • Loading branch information
nak3 committed May 19, 2022
1 parent 41a27e3 commit 29c10fa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aya/src/programs/cgroup_skb.rs
Expand Up @@ -62,6 +62,11 @@ pub struct CgroupSkb {
impl CgroupSkb {
/// Loads the program inside the kernel.
pub fn load(&mut self) -> Result<(), ProgramError> {
self.data.expected_attach_type = match self.expected_attach_type {
Some(CgroupSkbAttachType::Ingress) => Some(BPF_CGROUP_INET_INGRESS),
Some(CgroupSkbAttachType::Egress) => Some(BPF_CGROUP_INET_EGRESS),
None => None,
};
load_program(BPF_PROG_TYPE_CGROUP_SKB, &mut self.data)
}

Expand Down

0 comments on commit 29c10fa

Please sign in to comment.