lsm: update program.load() to use new signature with &Btf

pull/15/head
William Findlay 3 years ago
parent a9c18a96cc
commit 7908e8593d
No known key found for this signature in database
GPG Key ID: 7162B44E9E560373

@ -19,7 +19,7 @@ use aya::programs::{CgroupSkb, CgroupSkbAttachType};
{%- when "tracepoint" -%}
use aya::programs::TracePoint;
{%- when "lsm" -%}
use aya::programs::Lsm;
use aya::{programs::Lsm, Btf};
{%- endcase %}
use std::{
convert::{TryFrom,TryInto},
@ -94,8 +94,9 @@ fn try_main() -> Result<(), anyhow::Error> {
program.load()?;
program.attach("{{tracepoint_category}}", "{{tracepoint_name}}")?;
{%- when "lsm" -%}
let btf = Btf::from_sys_fs()?;
let program: &mut Lsm = bpf.program_mut("{{lsm_hook}}")?.try_into()?;
program.load("{{lsm_hook}}")?;
program.load("{{lsm_hook}}", &btf)?;
program.attach()?;
{%- endcase %}

Loading…
Cancel
Save