1670742a1SGleb Smirnoff /*- 2*fe267a55SPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*fe267a55SPedro F. Giffuni * 4670742a1SGleb Smirnoff * Copyright 2005, Gleb Smirnoff <glebius@FreeBSD.org> 5670742a1SGleb Smirnoff * All rights reserved. 6670742a1SGleb Smirnoff * 7670742a1SGleb Smirnoff * Redistribution and use in source and binary forms, with or without 8670742a1SGleb Smirnoff * modification, are permitted provided that the following conditions 9670742a1SGleb Smirnoff * are met: 10670742a1SGleb Smirnoff * 1. Redistributions of source code must retain the above copyright 11670742a1SGleb Smirnoff * notice, this list of conditions and the following disclaimer. 12670742a1SGleb Smirnoff * 2. Redistributions in binary form must reproduce the above copyright 13670742a1SGleb Smirnoff * notice, this list of conditions and the following disclaimer in the 14670742a1SGleb Smirnoff * documentation and/or other materials provided with the distribution. 15670742a1SGleb Smirnoff * 16670742a1SGleb Smirnoff * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17670742a1SGleb Smirnoff * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18670742a1SGleb Smirnoff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19670742a1SGleb Smirnoff * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20670742a1SGleb Smirnoff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21670742a1SGleb Smirnoff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22670742a1SGleb Smirnoff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23670742a1SGleb Smirnoff * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24670742a1SGleb Smirnoff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25670742a1SGleb Smirnoff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26670742a1SGleb Smirnoff * SUCH DAMAGE. 27670742a1SGleb Smirnoff * 28670742a1SGleb Smirnoff * $FreeBSD$ 29670742a1SGleb Smirnoff */ 30670742a1SGleb Smirnoff 31f2a66f8eSAndrey V. Elsukov #include "opt_inet.h" 32f2a66f8eSAndrey V. Elsukov #include "opt_inet6.h" 33f2a66f8eSAndrey V. Elsukov 34670742a1SGleb Smirnoff #include <sys/param.h> 35670742a1SGleb Smirnoff #include <sys/systm.h> 36670742a1SGleb Smirnoff #include <sys/kernel.h> 37385195c0SMarko Zec #include <sys/lock.h> 38670742a1SGleb Smirnoff #include <sys/mbuf.h> 39670742a1SGleb Smirnoff #include <sys/malloc.h> 40670742a1SGleb Smirnoff #include <sys/ctype.h> 41670742a1SGleb Smirnoff #include <sys/errno.h> 42385195c0SMarko Zec #include <sys/rwlock.h> 43670742a1SGleb Smirnoff #include <sys/socket.h> 44670742a1SGleb Smirnoff #include <sys/syslog.h> 45670742a1SGleb Smirnoff 46670742a1SGleb Smirnoff #include <net/if.h> 4776039bc8SGleb Smirnoff #include <net/if_var.h> 48670742a1SGleb Smirnoff 49670742a1SGleb Smirnoff #include <netinet/in.h> 50670742a1SGleb Smirnoff #include <netinet/in_systm.h> 51670742a1SGleb Smirnoff #include <netinet/in_var.h> 521aa00918SLuigi Rizzo #include <netinet/ip_var.h> 53670742a1SGleb Smirnoff #include <netinet/ip_fw.h> 54670742a1SGleb Smirnoff #include <netinet/ip.h> 55f2a66f8eSAndrey V. Elsukov #include <netinet/ip6.h> 56f2a66f8eSAndrey V. Elsukov #include <netinet6/ip6_var.h> 57670742a1SGleb Smirnoff 583b3a8eb9SGleb Smirnoff #include <netpfil/ipfw/ip_fw_private.h> 593b3a8eb9SGleb Smirnoff 60670742a1SGleb Smirnoff #include <netgraph/ng_message.h> 61670742a1SGleb Smirnoff #include <netgraph/ng_parse.h> 62670742a1SGleb Smirnoff #include <netgraph/ng_ipfw.h> 63670742a1SGleb Smirnoff #include <netgraph/netgraph.h> 64670742a1SGleb Smirnoff 65670742a1SGleb Smirnoff static int ng_ipfw_mod_event(module_t mod, int event, void *data); 66670742a1SGleb Smirnoff static ng_constructor_t ng_ipfw_constructor; 67670742a1SGleb Smirnoff static ng_shutdown_t ng_ipfw_shutdown; 68670742a1SGleb Smirnoff static ng_newhook_t ng_ipfw_newhook; 69670742a1SGleb Smirnoff static ng_connect_t ng_ipfw_connect; 70670742a1SGleb Smirnoff static ng_findhook_t ng_ipfw_findhook; 71670742a1SGleb Smirnoff static ng_rcvdata_t ng_ipfw_rcvdata; 72670742a1SGleb Smirnoff static ng_disconnect_t ng_ipfw_disconnect; 73670742a1SGleb Smirnoff 74670742a1SGleb Smirnoff static hook_p ng_ipfw_findhook1(node_p, u_int16_t ); 75670742a1SGleb Smirnoff static int ng_ipfw_input(struct mbuf **, int, struct ip_fw_args *, 76670742a1SGleb Smirnoff int); 77670742a1SGleb Smirnoff 78670742a1SGleb Smirnoff /* We have only one node */ 79670742a1SGleb Smirnoff static node_p fw_node; 80670742a1SGleb Smirnoff 81670742a1SGleb Smirnoff /* Netgraph node type descriptor */ 82670742a1SGleb Smirnoff static struct ng_type ng_ipfw_typestruct = { 83670742a1SGleb Smirnoff .version = NG_ABI_VERSION, 84670742a1SGleb Smirnoff .name = NG_IPFW_NODE_TYPE, 85670742a1SGleb Smirnoff .mod_event = ng_ipfw_mod_event, 86670742a1SGleb Smirnoff .constructor = ng_ipfw_constructor, 87670742a1SGleb Smirnoff .shutdown = ng_ipfw_shutdown, 88670742a1SGleb Smirnoff .newhook = ng_ipfw_newhook, 89670742a1SGleb Smirnoff .connect = ng_ipfw_connect, 90670742a1SGleb Smirnoff .findhook = ng_ipfw_findhook, 91670742a1SGleb Smirnoff .rcvdata = ng_ipfw_rcvdata, 92670742a1SGleb Smirnoff .disconnect = ng_ipfw_disconnect, 93670742a1SGleb Smirnoff }; 94670742a1SGleb Smirnoff NETGRAPH_INIT(ipfw, &ng_ipfw_typestruct); 95f9ab623bSAlexander V. Chernikov MODULE_DEPEND(ng_ipfw, ipfw, 3, 3, 3); 96670742a1SGleb Smirnoff 97670742a1SGleb Smirnoff /* Information we store for each hook */ 98670742a1SGleb Smirnoff struct ng_ipfw_hook_priv { 99670742a1SGleb Smirnoff hook_p hook; 100670742a1SGleb Smirnoff u_int16_t rulenum; 101670742a1SGleb Smirnoff }; 102670742a1SGleb Smirnoff typedef struct ng_ipfw_hook_priv *hpriv_p; 103670742a1SGleb Smirnoff 104670742a1SGleb Smirnoff static int 105670742a1SGleb Smirnoff ng_ipfw_mod_event(module_t mod, int event, void *data) 106670742a1SGleb Smirnoff { 107670742a1SGleb Smirnoff int error = 0; 108670742a1SGleb Smirnoff 109670742a1SGleb Smirnoff switch (event) { 110670742a1SGleb Smirnoff case MOD_LOAD: 111670742a1SGleb Smirnoff 112670742a1SGleb Smirnoff if (ng_ipfw_input_p != NULL) { 113670742a1SGleb Smirnoff error = EEXIST; 114670742a1SGleb Smirnoff break; 115670742a1SGleb Smirnoff } 116670742a1SGleb Smirnoff 117670742a1SGleb Smirnoff /* Setup node without any private data */ 118670742a1SGleb Smirnoff if ((error = ng_make_node_common(&ng_ipfw_typestruct, &fw_node)) 119670742a1SGleb Smirnoff != 0) { 120670742a1SGleb Smirnoff log(LOG_ERR, "%s: can't create ng_ipfw node", __func__); 121670742a1SGleb Smirnoff break; 12274b8d63dSPedro F. Giffuni } 123670742a1SGleb Smirnoff 124670742a1SGleb Smirnoff /* Try to name node */ 125670742a1SGleb Smirnoff if (ng_name_node(fw_node, "ipfw") != 0) 126670742a1SGleb Smirnoff log(LOG_WARNING, "%s: failed to name node \"ipfw\"", 127670742a1SGleb Smirnoff __func__); 128670742a1SGleb Smirnoff 129670742a1SGleb Smirnoff /* Register hook */ 130670742a1SGleb Smirnoff ng_ipfw_input_p = ng_ipfw_input; 131670742a1SGleb Smirnoff break; 132670742a1SGleb Smirnoff 133670742a1SGleb Smirnoff case MOD_UNLOAD: 134670742a1SGleb Smirnoff /* 135670742a1SGleb Smirnoff * This won't happen if a node exists. 136670742a1SGleb Smirnoff * ng_ipfw_input_p is already cleared. 137670742a1SGleb Smirnoff */ 138670742a1SGleb Smirnoff break; 139670742a1SGleb Smirnoff 140670742a1SGleb Smirnoff default: 141670742a1SGleb Smirnoff error = EOPNOTSUPP; 142670742a1SGleb Smirnoff break; 143670742a1SGleb Smirnoff } 144670742a1SGleb Smirnoff 145670742a1SGleb Smirnoff return (error); 146670742a1SGleb Smirnoff } 147670742a1SGleb Smirnoff 148670742a1SGleb Smirnoff static int 149670742a1SGleb Smirnoff ng_ipfw_constructor(node_p node) 150670742a1SGleb Smirnoff { 151670742a1SGleb Smirnoff return (EINVAL); /* Only one node */ 152670742a1SGleb Smirnoff } 153670742a1SGleb Smirnoff 154670742a1SGleb Smirnoff static int 155670742a1SGleb Smirnoff ng_ipfw_newhook(node_p node, hook_p hook, const char *name) 156670742a1SGleb Smirnoff { 157670742a1SGleb Smirnoff hpriv_p hpriv; 158670742a1SGleb Smirnoff u_int16_t rulenum; 159670742a1SGleb Smirnoff const char *cp; 160ad1376ccSGleb Smirnoff char *endptr; 161670742a1SGleb Smirnoff 162bbc8878eSGleb Smirnoff /* Protect from leading zero */ 163bbc8878eSGleb Smirnoff if (name[0] == '0' && name[1] != '\0') 164bbc8878eSGleb Smirnoff return (EINVAL); 165bbc8878eSGleb Smirnoff 166670742a1SGleb Smirnoff /* Check that name contains only digits */ 167ad1376ccSGleb Smirnoff for (cp = name; *cp != '\0'; cp++) 168bbc8878eSGleb Smirnoff if (!isdigit(*cp)) 169670742a1SGleb Smirnoff return (EINVAL); 170670742a1SGleb Smirnoff 171670742a1SGleb Smirnoff /* Convert it to integer */ 172ad1376ccSGleb Smirnoff rulenum = (u_int16_t)strtol(name, &endptr, 10); 173ad1376ccSGleb Smirnoff if (*endptr != '\0') 174670742a1SGleb Smirnoff return (EINVAL); 175670742a1SGleb Smirnoff 176670742a1SGleb Smirnoff /* Allocate memory for this hook's private data */ 1771ede983cSDag-Erling Smørgrav hpriv = malloc(sizeof(*hpriv), M_NETGRAPH, M_NOWAIT | M_ZERO); 178670742a1SGleb Smirnoff if (hpriv== NULL) 179670742a1SGleb Smirnoff return (ENOMEM); 180670742a1SGleb Smirnoff 181670742a1SGleb Smirnoff hpriv->hook = hook; 182670742a1SGleb Smirnoff hpriv->rulenum = rulenum; 183670742a1SGleb Smirnoff 184670742a1SGleb Smirnoff NG_HOOK_SET_PRIVATE(hook, hpriv); 185670742a1SGleb Smirnoff 186670742a1SGleb Smirnoff return(0); 187670742a1SGleb Smirnoff } 188670742a1SGleb Smirnoff 189670742a1SGleb Smirnoff /* 190670742a1SGleb Smirnoff * Set hooks into queueing mode, to avoid recursion between 191670742a1SGleb Smirnoff * netgraph layer and ip_{input,output}. 192670742a1SGleb Smirnoff */ 193670742a1SGleb Smirnoff static int 194670742a1SGleb Smirnoff ng_ipfw_connect(hook_p hook) 195670742a1SGleb Smirnoff { 196670742a1SGleb Smirnoff NG_HOOK_FORCE_QUEUE(hook); 197670742a1SGleb Smirnoff return (0); 198670742a1SGleb Smirnoff } 199670742a1SGleb Smirnoff 200670742a1SGleb Smirnoff /* Look up hook by name */ 201fe4ead27SGleb Smirnoff static hook_p 202670742a1SGleb Smirnoff ng_ipfw_findhook(node_p node, const char *name) 203670742a1SGleb Smirnoff { 204670742a1SGleb Smirnoff u_int16_t n; /* numeric representation of hook */ 205ad1376ccSGleb Smirnoff char *endptr; 206670742a1SGleb Smirnoff 207ad1376ccSGleb Smirnoff n = (u_int16_t)strtol(name, &endptr, 10); 208ad1376ccSGleb Smirnoff if (*endptr != '\0') 209670742a1SGleb Smirnoff return NULL; 210670742a1SGleb Smirnoff return ng_ipfw_findhook1(node, n); 211670742a1SGleb Smirnoff } 212670742a1SGleb Smirnoff 213670742a1SGleb Smirnoff /* Look up hook by rule number */ 214670742a1SGleb Smirnoff static hook_p 215670742a1SGleb Smirnoff ng_ipfw_findhook1(node_p node, u_int16_t rulenum) 216670742a1SGleb Smirnoff { 217670742a1SGleb Smirnoff hook_p hook; 218670742a1SGleb Smirnoff hpriv_p hpriv; 219670742a1SGleb Smirnoff 220670742a1SGleb Smirnoff LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { 221670742a1SGleb Smirnoff hpriv = NG_HOOK_PRIVATE(hook); 222670742a1SGleb Smirnoff if (NG_HOOK_IS_VALID(hook) && (hpriv->rulenum == rulenum)) 223670742a1SGleb Smirnoff return (hook); 224670742a1SGleb Smirnoff } 225670742a1SGleb Smirnoff 226670742a1SGleb Smirnoff return (NULL); 227670742a1SGleb Smirnoff } 228670742a1SGleb Smirnoff 229670742a1SGleb Smirnoff 230670742a1SGleb Smirnoff static int 231670742a1SGleb Smirnoff ng_ipfw_rcvdata(hook_p hook, item_p item) 232670742a1SGleb Smirnoff { 233956000b8SGleb Smirnoff struct m_tag *tag; 234956000b8SGleb Smirnoff struct ipfw_rule_ref *r; 235670742a1SGleb Smirnoff struct mbuf *m; 236f2a66f8eSAndrey V. Elsukov struct ip *ip; 237670742a1SGleb Smirnoff 238670742a1SGleb Smirnoff NGI_GET_M(item, m); 239670742a1SGleb Smirnoff NG_FREE_ITEM(item); 240670742a1SGleb Smirnoff 241956000b8SGleb Smirnoff tag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL); 2427173b6e5SLuigi Rizzo if (tag == NULL) { 243670742a1SGleb Smirnoff NG_FREE_M(m); 244670742a1SGleb Smirnoff return (EINVAL); /* XXX: find smth better */ 24574b8d63dSPedro F. Giffuni } 246670742a1SGleb Smirnoff 2470a1a279eSGleb Smirnoff if (m->m_len < sizeof(struct ip) && 2480a1a279eSGleb Smirnoff (m = m_pullup(m, sizeof(struct ip))) == NULL) 2497aabe9d9SAlexander V. Chernikov return (ENOBUFS); 2500a1a279eSGleb Smirnoff 2510a1a279eSGleb Smirnoff ip = mtod(m, struct ip *); 252670742a1SGleb Smirnoff 253f2a66f8eSAndrey V. Elsukov r = (struct ipfw_rule_ref *)(tag + 1); 254f2a66f8eSAndrey V. Elsukov if (r->info & IPFW_INFO_IN) { 255f2a66f8eSAndrey V. Elsukov switch (ip->ip_v) { 256f2a66f8eSAndrey V. Elsukov #ifdef INET 257f2a66f8eSAndrey V. Elsukov case IPVERSION: 258f2a66f8eSAndrey V. Elsukov ip_input(m); 2597aabe9d9SAlexander V. Chernikov return (0); 260f2a66f8eSAndrey V. Elsukov #endif 261f2a66f8eSAndrey V. Elsukov #ifdef INET6 262f2a66f8eSAndrey V. Elsukov case IPV6_VERSION >> 4: 263f2a66f8eSAndrey V. Elsukov ip6_input(m); 264f2a66f8eSAndrey V. Elsukov return (0); 2657aabe9d9SAlexander V. Chernikov #endif 2667aabe9d9SAlexander V. Chernikov } 267f2a66f8eSAndrey V. Elsukov } else { 268f2a66f8eSAndrey V. Elsukov switch (ip->ip_v) { 269f2a66f8eSAndrey V. Elsukov #ifdef INET 270f2a66f8eSAndrey V. Elsukov case IPVERSION: 271f2a66f8eSAndrey V. Elsukov return (ip_output(m, NULL, NULL, IP_FORWARDING, 272f2a66f8eSAndrey V. Elsukov NULL, NULL)); 273f2a66f8eSAndrey V. Elsukov #endif 274f2a66f8eSAndrey V. Elsukov #ifdef INET6 275f2a66f8eSAndrey V. Elsukov case IPV6_VERSION >> 4: 276f2a66f8eSAndrey V. Elsukov return (ip6_output(m, NULL, NULL, 0, NULL, 277f2a66f8eSAndrey V. Elsukov NULL, NULL)); 278f2a66f8eSAndrey V. Elsukov #endif 279f2a66f8eSAndrey V. Elsukov } 280670742a1SGleb Smirnoff } 2817aabe9d9SAlexander V. Chernikov 2827aabe9d9SAlexander V. Chernikov /* unknown IP protocol version */ 2837aabe9d9SAlexander V. Chernikov NG_FREE_M(m); 2847aabe9d9SAlexander V. Chernikov return (EPROTONOSUPPORT); 285670742a1SGleb Smirnoff } 286670742a1SGleb Smirnoff 287670742a1SGleb Smirnoff static int 288670742a1SGleb Smirnoff ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_args *fwa, int tee) 289670742a1SGleb Smirnoff { 290670742a1SGleb Smirnoff struct mbuf *m; 29119b55776SGleb Smirnoff struct ip *ip; 292670742a1SGleb Smirnoff hook_p hook; 293670742a1SGleb Smirnoff int error = 0; 294670742a1SGleb Smirnoff 295670742a1SGleb Smirnoff /* 296670742a1SGleb Smirnoff * Node must be loaded and corresponding hook must be present. 297670742a1SGleb Smirnoff */ 298670742a1SGleb Smirnoff if (fw_node == NULL || 2997418c6e1SGleb Smirnoff (hook = ng_ipfw_findhook1(fw_node, fwa->rule.info)) == NULL) 300670742a1SGleb Smirnoff return (ESRCH); /* no hook associated with this rule */ 301670742a1SGleb Smirnoff 302670742a1SGleb Smirnoff /* 303670742a1SGleb Smirnoff * We have two modes: in normal mode we add a tag to packet, which is 304670742a1SGleb Smirnoff * important to return packet back to IP stack. In tee mode we make 305670742a1SGleb Smirnoff * a copy of a packet and forward it into netgraph without a tag. 306670742a1SGleb Smirnoff */ 307670742a1SGleb Smirnoff if (tee == 0) { 3087173b6e5SLuigi Rizzo struct m_tag *tag; 3097173b6e5SLuigi Rizzo struct ipfw_rule_ref *r; 310670742a1SGleb Smirnoff m = *m0; 311670742a1SGleb Smirnoff *m0 = NULL; /* it belongs now to netgraph */ 312670742a1SGleb Smirnoff 3137173b6e5SLuigi Rizzo tag = m_tag_alloc(MTAG_IPFW_RULE, 0, sizeof(*r), 3147173b6e5SLuigi Rizzo M_NOWAIT|M_ZERO); 3157173b6e5SLuigi Rizzo if (tag == NULL) { 316670742a1SGleb Smirnoff m_freem(m); 317670742a1SGleb Smirnoff return (ENOMEM); 318670742a1SGleb Smirnoff } 3197173b6e5SLuigi Rizzo r = (struct ipfw_rule_ref *)(tag + 1); 3207173b6e5SLuigi Rizzo *r = fwa->rule; 321b9bff254SGleb Smirnoff r->info &= IPFW_ONEPASS; /* keep this info */ 322b9bff254SGleb Smirnoff r->info |= dir ? IPFW_INFO_IN : IPFW_INFO_OUT; 3237173b6e5SLuigi Rizzo m_tag_prepend(m, tag); 324670742a1SGleb Smirnoff 325670742a1SGleb Smirnoff } else 326eb1b1807SGleb Smirnoff if ((m = m_dup(*m0, M_NOWAIT)) == NULL) 327670742a1SGleb Smirnoff return (ENOMEM); /* which is ignored */ 328670742a1SGleb Smirnoff 3298c6f9629SGleb Smirnoff if (m->m_len < sizeof(struct ip) && 3308c6f9629SGleb Smirnoff (m = m_pullup(m, sizeof(struct ip))) == NULL) 3318c6f9629SGleb Smirnoff return (EINVAL); 3328c6f9629SGleb Smirnoff 33319b55776SGleb Smirnoff ip = mtod(m, struct ip *); 33419b55776SGleb Smirnoff 335670742a1SGleb Smirnoff NG_SEND_DATA_ONLY(error, hook, m); 336670742a1SGleb Smirnoff 337670742a1SGleb Smirnoff return (error); 338670742a1SGleb Smirnoff } 339670742a1SGleb Smirnoff 340670742a1SGleb Smirnoff static int 341670742a1SGleb Smirnoff ng_ipfw_shutdown(node_p node) 342670742a1SGleb Smirnoff { 343670742a1SGleb Smirnoff 344670742a1SGleb Smirnoff /* 345670742a1SGleb Smirnoff * After our single node has been removed, 346670742a1SGleb Smirnoff * the only thing that can be done is 347670742a1SGleb Smirnoff * 'kldunload ng_ipfw.ko' 348670742a1SGleb Smirnoff */ 349670742a1SGleb Smirnoff ng_ipfw_input_p = NULL; 350670742a1SGleb Smirnoff NG_NODE_UNREF(node); 351670742a1SGleb Smirnoff return (0); 352670742a1SGleb Smirnoff } 353670742a1SGleb Smirnoff 354670742a1SGleb Smirnoff static int 355670742a1SGleb Smirnoff ng_ipfw_disconnect(hook_p hook) 356670742a1SGleb Smirnoff { 357670742a1SGleb Smirnoff const hpriv_p hpriv = NG_HOOK_PRIVATE(hook); 358670742a1SGleb Smirnoff 3591ede983cSDag-Erling Smørgrav free(hpriv, M_NETGRAPH); 360670742a1SGleb Smirnoff NG_HOOK_SET_PRIVATE(hook, NULL); 361670742a1SGleb Smirnoff 362670742a1SGleb Smirnoff return (0); 363670742a1SGleb Smirnoff } 364