Lines Matching full:hook
250 * pfil_head_register() registers a pfil_head with the packet filter hook
282 * pfil_head_unregister() removes a pfil_head from the packet filter hook
283 * mechanism. The producer of the hook promises that all outstanding
284 * invocations of the hook have completed before it unregisters the hook.
309 struct pfil_hook *hook, *list; in pfil_add_hook() local
313 hook = malloc(sizeof(struct pfil_hook), M_PFIL, M_WAITOK | M_ZERO); in pfil_add_hook()
314 hook->hook_mbuf_chk = pa->pa_mbuf_chk; in pfil_add_hook()
315 hook->hook_mem_chk = pa->pa_mem_chk; in pfil_add_hook()
316 hook->hook_ruleset = pa->pa_ruleset; in pfil_add_hook()
317 hook->hook_flags = pa->pa_flags; in pfil_add_hook()
318 hook->hook_type = pa->pa_type; in pfil_add_hook()
319 hook->hook_modname = pa->pa_modname; in pfil_add_hook()
320 hook->hook_rulname = pa->pa_rulname; in pfil_add_hook()
326 printf("pfil: duplicate hook \"%s:%s\"\n", in pfil_add_hook()
329 LIST_INSERT_HEAD(&V_pfil_hook_list, hook, hook_list); in pfil_add_hook()
332 return (hook); in pfil_add_hook()
336 pfil_unlink(struct pfil_link_args *pa, pfil_head_t head, pfil_hook_t hook) in pfil_unlink() argument
343 in = pfil_link_remove(&head->head_in, hook); in pfil_unlink()
346 hook->hook_links--; in pfil_unlink()
351 out = pfil_link_remove(&head->head_out, hook); in pfil_unlink()
354 hook->hook_links--; in pfil_unlink()
376 struct pfil_hook *hook; in pfil_link() local
398 hook = pa->pa_hook; in pfil_link()
400 LIST_FOREACH(hook, &V_pfil_hook_list, hook_list) in pfil_link()
401 if (strcmp(pa->pa_modname, hook->hook_modname) == 0 && in pfil_link()
402 strcmp(pa->pa_rulname, hook->hook_rulname) == 0) in pfil_link()
404 if (head == NULL || hook == NULL) { in pfil_link()
410 return (pfil_unlink(pa, head, hook)); in pfil_link()
412 if (head->head_type != hook->hook_type || in pfil_link()
413 ((hook->hook_flags & pa->pa_flags) & ~head->head_flags)) { in pfil_link()
420 if (link->link_hook == hook) { in pfil_link()
426 if (link->link_hook == hook) { in pfil_link()
432 in->link_hook = hook; in pfil_link()
433 in->link_mbuf_chk = hook->hook_mbuf_chk; in pfil_link()
434 in->link_mem_chk = hook->hook_mem_chk; in pfil_link()
435 in->link_flags = hook->hook_flags; in pfil_link()
436 in->link_ruleset = hook->hook_ruleset; in pfil_link()
441 hook->hook_links++; in pfil_link()
445 out->link_hook = hook; in pfil_link()
446 out->link_mbuf_chk = hook->hook_mbuf_chk; in pfil_link()
447 out->link_mem_chk = hook->hook_mem_chk; in pfil_link()
448 out->link_flags = hook->hook_flags; in pfil_link()
449 out->link_ruleset = hook->hook_ruleset; in pfil_link()
454 hook->hook_links++; in pfil_link()
481 pfil_remove_hook(pfil_hook_t hook) in pfil_remove_hook() argument
489 in = pfil_link_remove(&head->head_in, hook); in pfil_remove_hook()
492 hook->hook_links--; in pfil_remove_hook()
495 out = pfil_link_remove(&head->head_out, hook); in pfil_remove_hook()
498 hook->hook_links--; in pfil_remove_hook()
505 LIST_REMOVE(hook, hook_list); in pfil_remove_hook()
507 MPASS(hook->hook_links == 0); in pfil_remove_hook()
508 free(hook, M_PFIL); in pfil_remove_hook()
512 * Internal: Remove a pfil hook from a hook chain.
515 pfil_link_remove(pfil_chain_t *chain, pfil_hook_t hook) in pfil_link_remove() argument
522 if (link->link_hook == hook) { in pfil_link_remove()
667 struct pfil_hook *hook; in pfilioc_listhooks() local
675 LIST_FOREACH(hook, &V_pfil_hook_list, hook_list) in pfilioc_listhooks()
688 LIST_FOREACH(hook, &V_pfil_hook_list, hook_list) { in pfilioc_listhooks()
694 strlcpy(iohook[hk].pio_module, hook->hook_modname, in pfilioc_listhooks()
696 strlcpy(iohook[hk].pio_ruleset, hook->hook_rulname, in pfilioc_listhooks()
698 iohook[hk].pio_type = hook->hook_type; in pfilioc_listhooks()
699 iohook[hk].pio_flags = hook->hook_flags; in pfilioc_listhooks()