|
|
|
@ -4,9 +4,9 @@ use aya_bpf_cty::c_void;
|
|
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
|
bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_SOCKHASH, bpf_sock_ops},
|
|
|
|
|
helpers::{bpf_msg_redirect_hash, bpf_sock_hash_update},
|
|
|
|
|
helpers::{bpf_msg_redirect_hash, bpf_sk_redirect_hash, bpf_sock_hash_update},
|
|
|
|
|
maps::PinningType,
|
|
|
|
|
programs::SkMsgContext,
|
|
|
|
|
programs::{SkMsgContext, SkSkbContext},
|
|
|
|
|
BpfContext,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -66,7 +66,7 @@ impl<K> SockHash<K> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub unsafe fn redirect(&mut self, ctx: &SkMsgContext, key: &mut K, flags: u64) -> i64 {
|
|
|
|
|
pub unsafe fn redirect_msg(&mut self, ctx: &SkMsgContext, key: &mut K, flags: u64) -> i64 {
|
|
|
|
|
bpf_msg_redirect_hash(
|
|
|
|
|
ctx.as_ptr() as *mut _,
|
|
|
|
|
&mut self.def as *mut _ as *mut _,
|
|
|
|
@ -74,4 +74,13 @@ impl<K> SockHash<K> {
|
|
|
|
|
flags,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub unsafe fn redirect_skb(&mut self, ctx: &SkSkbContext, key: &mut K, flags: u64) -> i64 {
|
|
|
|
|
bpf_sk_redirect_hash(
|
|
|
|
|
ctx.as_ptr() as *mut _,
|
|
|
|
|
&mut self.def as *mut _ as *mut _,
|
|
|
|
|
key as *mut _ as *mut _,
|
|
|
|
|
flags,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|