Lines Matching full:hook
39 /// As such a BPF program using a TC Hook (`SEC("classifier")` or `SEC("tc")`) must be operated
52 hook: libbpf_sys::bpf_tc_hook, field
61 hook: libbpf_sys::bpf_tc_hook::default(), in new()
65 tc_hook.hook.sz = size_of::<libbpf_sys::bpf_tc_hook>() as libbpf_sys::size_t; in new()
74 /// If a [`TcHook`] already exists with the same parameters as the hook calling
77 /// Will always fail on a `TC_CUSTOM` hook
79 let err = unsafe { libbpf_sys::bpf_tc_hook_create(&mut self.hook as *mut _) }; in create()
82 // the hook may already exist, this is not an error in create()
97 self.hook.ifindex = idx; in ifindex()
105 /// An `TC_EGRESS|TC_INGRESS` hook can be used as an attach point for calling
109 self.hook.attach_point = ap; in attach_point()
113 /// Set the parent of a hook
116 /// `TC_EGRESS/TC_INGRESS/(TC_EGRESS|TC_INGRESS)` hook
118 /// Must be set on a `TC_CUSTOM` hook
125 self.hook.parent = parent; in parent()
129 /// Set whether this hook should replace an existing hook
131 /// If replace is not true upon attach, and a hook already exists
142 /// Set the handle of a hook.
143 /// If unset upon attach, the kernel will assign a handle for the hook
149 /// Get the handle of a hook.
150 /// Only has meaning after hook is attached
155 /// Set the priority of a hook
156 /// If unset upon attach, the kernel will assign a priority for the hook
162 /// Get the priority of a hook
163 /// Only has meaning after hook is attached
168 /// Query a hook to inspect the program identifier (prog_id)
175 let err = unsafe { libbpf_sys::bpf_tc_query(&self.hook as *const _, &mut opts as *mut _) }; in query()
185 /// Once the hook is processing, changing the values will have no effect unless the hook is
188 /// Users can create a second hook by changing the handle, the priority or the attach_point and
190 /// Copy the TcHook and change the values on the copied hook for easier [`Self::detach()`]
197 unsafe { libbpf_sys::bpf_tc_attach(&self.hook as *const _, &mut self.opts as *mut _) }; in attach()
212 let err = unsafe { libbpf_sys::bpf_tc_detach(&self.hook as *const _, &opts as *const _) }; in detach()
223 /// If called on a hook with an attach_point of `TC_EGRESS`, will detach all egress hooks
225 /// If called on a hook with an attach_point of `TC_INGRESS`, will detach all ingress hooks
227 /// If called on a hook with an attach_point of `TC_EGRESS|TC_INGRESS`, will destroy the clsact
235 let err = unsafe { libbpf_sys::bpf_tc_hook_destroy(&mut self.hook as *mut _) }; in destroy()
249 /// Once a `TcHook` is created via the [`Self::hook()`] method, the `TcHook`'s values can still
277 /// Set the initial interface index to attach the hook on
283 /// Set the initial parent of a hook
296 /// Set the initial handle for a hook
302 /// Set the initial priority for a hook
310 /// Once a hook is created, the values can still be changed on the `TcHook`
312 pub fn hook(&self, attach_point: TcAttachPoint) -> TcHook { in hook() method
313 let mut hook = TcHook::new(self.fd); in hook() localVariable
314 hook.ifindex(self.ifindex) in hook()
321 hook in hook()