MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_iface_newhook

Function ng_iface_newhook

freebsd/netgraph/ng_iface.c:577–597  ·  view source on GitHub ↗

* Give our ok for a hook to be added */

Source from the content-addressed store, hash-verified

575 * Give our ok for a hook to be added
576 */
577static int
578ng_iface_newhook(node_p node, hook_p hook, const char *name)
579{
580 const iffam_p iffam = get_iffam_from_name(name);
581 const priv_p priv = NG_NODE_PRIVATE(node);
582 hook_p *hookptr;
583
584 if (iffam == NULL)
585 return (EPFNOSUPPORT);
586 PRIV_WLOCK(priv);
587 hookptr = get_hook_from_iffam(priv, iffam);
588 if (*hookptr != NULL) {
589 PRIV_WUNLOCK(priv);
590 return (EISCONN);
591 }
592 *hookptr = hook;
593 NG_HOOK_HI_STACK(hook);
594 NG_HOOK_SET_TO_INBOUND(hook);
595 PRIV_WUNLOCK(priv);
596 return (0);
597}
598
599/*
600 * Receive a control message

Callers

nothing calls this directly

Calls 2

get_iffam_from_nameFunction · 0.70
get_hook_from_iffamFunction · 0.70

Tested by

no test coverage detected