From b75efc8efe2897857da0e3094c065d303cad3b24 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Thu, 21 Jan 2021 19:45:52 +0000 Subject: [PATCH] bpf: fix loading socket filters from obj files --- src/bpf.rs | 3 +++ src/obj/mod.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bpf.rs b/src/bpf.rs index d23d2735..e06a98e6 100644 --- a/src/bpf.rs +++ b/src/bpf.rs @@ -85,6 +85,9 @@ impl Bpf { crate::obj::ProgramKind::KProbe => Program::KProbe(KProbe { data }), crate::obj::ProgramKind::UProbe => Program::UProbe(UProbe { data }), crate::obj::ProgramKind::TracePoint => Program::TracePoint(TracePoint { data }), + crate::obj::ProgramKind::SocketFilter => { + Program::SocketFilter(SocketFilter { data }) + } crate::obj::ProgramKind::Xdp => Program::Xdp(Xdp { data }), }; diff --git a/src/obj/mod.rs b/src/obj/mod.rs index 85b2c082..6f859413 100644 --- a/src/obj/mod.rs +++ b/src/obj/mod.rs @@ -56,8 +56,9 @@ pub(crate) struct Program { pub enum ProgramKind { KProbe, UProbe, - Xdp, TracePoint, + SocketFilter, + Xdp, } impl FromStr for ProgramKind { @@ -70,6 +71,7 @@ impl FromStr for ProgramKind { "uprobe" => UProbe, "xdp" => Xdp, "trace_point" => TracePoint, + "socket_filter" => SocketFilter, _ => { return Err(ParseError::InvalidProgramKind { kind: kind.to_string(),