pub struct SockMap<T> { /* private fields */ }Expand description
An array of TCP or UDP sockets.
A SockMap is used to store TCP or UDP sockets. eBPF programs can then be
attached to the map to inspect, filter or redirect network buffers on those
sockets.
A SockMap can also be used to redirect packets to sockets contained by the
map using bpf_redirect_map(), bpf_sk_redirect_map() etc.
§Minimum kernel version
The minimum kernel version required to use this feature is 4.14.
§Examples
use aya::maps::SockMap;
use aya::programs::SkSkb;
let intercept_ingress = SockMap::try_from(bpf.map("INTERCEPT_INGRESS").unwrap())?;
let map_fd = intercept_ingress.fd().try_clone()?;
let prog: &mut SkSkb = bpf.program_mut("intercept_ingress_packet").unwrap().try_into()?;
prog.load()?;
prog.attach(&map_fd)?;
Implementations§
Source§impl<T: Borrow<MapData>> SockMap<T>
impl<T: Borrow<MapData>> SockMap<T>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SockMap<T>where
T: Freeze,
impl<T> RefUnwindSafe for SockMap<T>where
T: RefUnwindSafe,
impl<T> Send for SockMap<T>where
T: Send,
impl<T> Sync for SockMap<T>where
T: Sync,
impl<T> Unpin for SockMap<T>where
T: Unpin,
impl<T> UnwindSafe for SockMap<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more