* Give our ok for a hook to be added */
| 575 | * Give our ok for a hook to be added |
| 576 | */ |
| 577 | static int |
| 578 | ng_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 |
nothing calls this directly
no test coverage detected