generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from amosproj/sendmsg-setup
feat: sendmsg collection and config
- Loading branch information
Showing
13 changed files
with
277 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
// SPDX-FileCopyrightText: 2024 Benedikt Zinn <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Felix Hilgers <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Robin Seidl <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
use clap::Parser; | ||
use shared::{ | ||
config::{Configuration, VfsWriteConfig}, | ||
config::{Configuration, SysSendmsgConfig, VfsWriteConfig}, | ||
ziofa::ziofa_client::ZiofaClient, | ||
}; | ||
use tonic::transport::Channel; | ||
|
@@ -48,6 +49,7 @@ async fn test_get_configuration(client: &mut ZiofaClient<Channel>, verbose: bool | |
Configuration { | ||
uprobes: vec![], | ||
vfs_write: Some(VfsWriteConfig { pids: vec![] }), | ||
sys_sendmsg: Some(SysSendmsgConfig { pids: vec![] }), | ||
} | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
// SPDX-FileCopyrightText: 2024 Felix Hilgers <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Franz Schlicht <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Robin Seidl <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Tom Weisshuhn <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
use aya::{Ebpf, EbpfError}; | ||
use shared::config::Configuration; | ||
use thiserror::Error; | ||
|
||
use crate::features::VfsFeature; | ||
use crate::features::{SysSendmsgFeature, VfsFeature}; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum EbpfErrorWrapper { | ||
|
@@ -23,27 +25,31 @@ impl From<EbpfErrorWrapper> for tonic::Status { | |
|
||
pub struct State { | ||
vfs_write_feature: VfsFeature, | ||
sys_sendmsg_feature: SysSendmsgFeature, | ||
} | ||
|
||
impl State { | ||
pub fn new() -> State { | ||
State { | ||
vfs_write_feature: VfsFeature::new(), | ||
sys_sendmsg_feature: SysSendmsgFeature::new(), | ||
} | ||
} | ||
|
||
pub fn init(&mut self, ebpf: &mut Ebpf) -> Result<(), EbpfError> { | ||
self.vfs_write_feature.create(ebpf)?; | ||
self.sys_sendmsg_feature.create(ebpf)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn update_from_config( | ||
&mut self, | ||
ebpf: &mut Ebpf, | ||
_config_path: &str, | ||
config: &Configuration, | ||
) -> Result<(), EbpfError> { | ||
self.vfs_write_feature.attach(ebpf)?; | ||
self.sys_sendmsg_feature.apply(ebpf, config.sys_sendmsg.as_ref())?; | ||
|
||
Ok(()) | ||
} | ||
|
Oops, something went wrong.