mirror of https://github.com/aya-rs/aya
bpf: Implement BPF_PROG_TYPE_CGROUP_SOCK
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>pull/315/head
parent
3f6b2507b6
commit
6f51b616e1
@ -0,0 +1,19 @@
|
|||||||
|
use core::ffi::c_void;
|
||||||
|
|
||||||
|
use crate::{bindings::bpf_sock, BpfContext};
|
||||||
|
|
||||||
|
pub struct SockContext {
|
||||||
|
pub sock: *mut bpf_sock,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SockContext {
|
||||||
|
pub fn new(sock: *mut bpf_sock) -> SockContext {
|
||||||
|
SockContext { sock }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BpfContext for SockContext {
|
||||||
|
fn as_ptr(&self) -> *mut c_void {
|
||||||
|
self.sock as *mut _
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue