in6_rmx.c revision 215701
1139826Simp/*-
253541Sshin * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
353541Sshin * All rights reserved.
453541Sshin *
553541Sshin * Redistribution and use in source and binary forms, with or without
653541Sshin * modification, are permitted provided that the following conditions
753541Sshin * are met:
853541Sshin * 1. Redistributions of source code must retain the above copyright
953541Sshin *    notice, this list of conditions and the following disclaimer.
1053541Sshin * 2. Redistributions in binary form must reproduce the above copyright
1153541Sshin *    notice, this list of conditions and the following disclaimer in the
1253541Sshin *    documentation and/or other materials provided with the distribution.
1353541Sshin * 3. Neither the name of the project nor the names of its contributors
1453541Sshin *    may be used to endorse or promote products derived from this software
1553541Sshin *    without specific prior written permission.
1653541Sshin *
1753541Sshin * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
1853541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1953541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2053541Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2153541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2253541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2353541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2453541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2553541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2653541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2753541Sshin * SUCH DAMAGE.
28174510Sobrien *
29174510Sobrien *	$KAME: in6_rmx.c,v 1.11 2001/07/26 06:53:16 jinmei Exp $
3053541Sshin */
3153541Sshin
32139826Simp/*-
3353541Sshin * Copyright 1994, 1995 Massachusetts Institute of Technology
3453541Sshin *
3553541Sshin * Permission to use, copy, modify, and distribute this software and
3653541Sshin * its documentation for any purpose and without fee is hereby
3753541Sshin * granted, provided that both the above copyright notice and this
3853541Sshin * permission notice appear in all copies, that both the above
3953541Sshin * copyright notice and this permission notice appear in all
4053541Sshin * supporting documentation, and that the name of M.I.T. not be used
4153541Sshin * in advertising or publicity pertaining to distribution of the
4253541Sshin * software without specific, written prior permission.  M.I.T. makes
4353541Sshin * no representations about the suitability of this software for any
4453541Sshin * purpose.  It is provided "as is" without express or implied
4553541Sshin * warranty.
4653541Sshin *
4753541Sshin * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
4853541Sshin * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
4953541Sshin * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
5053541Sshin * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
5153541Sshin * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
5253541Sshin * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
5353541Sshin * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
5453541Sshin * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
5553541Sshin * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5653541Sshin * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
5753541Sshin * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5853541Sshin * SUCH DAMAGE.
5953541Sshin *
6053541Sshin */
6153541Sshin
6253541Sshin/*
6353541Sshin * This code does two things necessary for the enhanced TCP metrics to
6453541Sshin * function in a useful manner:
6553541Sshin *  1) It marks all non-host routes as `cloning', thus ensuring that
6653541Sshin *     every actual reference to such a route actually gets turned
6753541Sshin *     into a reference to a host route to the specific destination
6853541Sshin *     requested.
6953541Sshin *  2) When such routes lose all their references, it arranges for them
7053541Sshin *     to be deleted in some random collection of circumstances, so that
7153541Sshin *     a large quantity of stale routing data is not kept in kernel memory
7253541Sshin *     indefinitely.  See in6_rtqtimo() below for the exact mechanism.
7353541Sshin */
7453541Sshin
75174510Sobrien#include <sys/cdefs.h>
76174510Sobrien__FBSDID("$FreeBSD: head/sys/netinet6/in6_rmx.c 215701 2010-11-22 19:32:54Z dim $");
77174510Sobrien
7853541Sshin#include <sys/param.h>
7953541Sshin#include <sys/systm.h>
8053541Sshin#include <sys/kernel.h>
81185751Simp#include <sys/lock.h>
8253541Sshin#include <sys/sysctl.h>
8353541Sshin#include <sys/queue.h>
8453541Sshin#include <sys/socket.h>
8553541Sshin#include <sys/socketvar.h>
8653541Sshin#include <sys/mbuf.h>
87185747Skmacy#include <sys/rwlock.h>
8853541Sshin#include <sys/syslog.h>
89120727Ssam#include <sys/callout.h>
9053541Sshin
9153541Sshin#include <net/if.h>
92194714Sbz#include <net/route.h>
93185571Sbz
9453541Sshin#include <netinet/in.h>
9553541Sshin#include <netinet/ip_var.h>
9653541Sshin#include <netinet/in_var.h>
9753541Sshin
9862587Sitojun#include <netinet/ip6.h>
9953541Sshin#include <netinet6/ip6_var.h>
10053541Sshin
10162587Sitojun#include <netinet/icmp6.h>
102121283Sume#include <netinet6/nd6.h>
10353541Sshin
10453541Sshin#include <netinet/tcp.h>
10553541Sshin#include <netinet/tcp_seq.h>
10653541Sshin#include <netinet/tcp_timer.h>
10753541Sshin#include <netinet/tcp_var.h>
10853541Sshin
109175162Sobrienextern int	in6_inithead(void **head, int off);
110193731Szec#ifdef VIMAGE
111193731Szecextern int	in6_detachhead(void **head, int off);
112193731Szec#endif
11353541Sshin
11462587Sitojun#define RTPRF_OURS		RTF_PROTO3	/* set on routes we manage */
11553541Sshin
11653541Sshin/*
11753541Sshin * Do what we need to do when inserting a route.
11853541Sshin */
11953541Sshinstatic struct radix_node *
12053541Sshinin6_addroute(void *v_arg, void *n_arg, struct radix_node_head *head,
121171260Sdelphij    struct radix_node *treenodes)
12253541Sshin{
12353541Sshin	struct rtentry *rt = (struct rtentry *)treenodes;
12453541Sshin	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt);
12553541Sshin	struct radix_node *ret;
12653541Sshin
127186119Sqingli	RADIX_NODE_HEAD_WLOCK_ASSERT(head);
12853541Sshin	if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
12953541Sshin		rt->rt_flags |= RTF_MULTICAST;
13053541Sshin
13153541Sshin	/*
13253541Sshin	 * A little bit of help for both IPv6 output and input:
13353541Sshin	 *   For local addresses, we make sure that RTF_LOCAL is set,
13453541Sshin	 *   with the thought that this might one day be used to speed up
13553541Sshin	 *   ip_input().
13653541Sshin	 *
13753541Sshin	 * We also mark routes to multicast addresses as such, because
13853541Sshin	 * it's easy to do and might be useful (but this is much more
13953541Sshin	 * dubious since it's so easy to inspect the address).  (This
14053541Sshin	 * is done above.)
14153541Sshin	 *
14253541Sshin	 * XXX
14353541Sshin	 * should elaborate the code.
14453541Sshin	 */
14553541Sshin	if (rt->rt_flags & RTF_HOST) {
14653541Sshin		if (IN6_ARE_ADDR_EQUAL(&satosin6(rt->rt_ifa->ifa_addr)
14753541Sshin					->sin6_addr,
14853541Sshin				       &sin6->sin6_addr)) {
14953541Sshin			rt->rt_flags |= RTF_LOCAL;
15053541Sshin		}
15153541Sshin	}
15253541Sshin
153122922Sandre	if (!rt->rt_rmx.rmx_mtu && rt->rt_ifp)
154121283Sume		rt->rt_rmx.rmx_mtu = IN6_LINKMTU(rt->rt_ifp);
15553541Sshin
15653541Sshin	ret = rn_addroute(v_arg, n_arg, head, treenodes);
157186119Sqingli	if (ret == NULL) {
15853541Sshin		struct rtentry *rt2;
15953541Sshin		/*
16053541Sshin		 * We are trying to add a net route, but can't.
16153541Sshin		 * The following case should be allowed, so we'll make a
16253541Sshin		 * special check for this:
16353541Sshin		 *	Two IPv6 addresses with the same prefix is assigned
16453541Sshin		 *	to a single interrface.
16553541Sshin		 *	# ifconfig if0 inet6 3ffe:0501::1 prefix 64 alias (*1)
16653541Sshin		 *	# ifconfig if0 inet6 3ffe:0501::2 prefix 64 alias (*2)
16753541Sshin		 *	In this case, (*1) and (*2) want to add the same
16853541Sshin		 *	net route entry, 3ffe:0501:: -> if0.
16953541Sshin		 *	This case should not raise an error.
17053541Sshin		 */
171186119Sqingli		rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_RNH_LOCKED);
17253541Sshin		if (rt2) {
173186119Sqingli			if (((rt2->rt_flags & (RTF_HOST|RTF_GATEWAY)) == 0)
17453541Sshin			 && rt2->rt_gateway
17553541Sshin			 && rt2->rt_gateway->sa_family == AF_LINK
17653541Sshin			 && rt2->rt_ifp == rt->rt_ifp) {
17753541Sshin				ret = rt2->rt_nodes;
17853541Sshin			}
179120727Ssam			RTFREE_LOCKED(rt2);
18053541Sshin		}
18153541Sshin	}
182186119Sqingli	return (ret);
18353541Sshin}
18453541Sshin
18553541Sshin/*
18653541Sshin * This code is the inverse of in6_clsroute: on first reference, if we
18753541Sshin * were managing the route, stop doing so and set the expiration timer
18853541Sshin * back off again.
18953541Sshin */
19053541Sshinstatic struct radix_node *
19153541Sshinin6_matroute(void *v_arg, struct radix_node_head *head)
19253541Sshin{
19353541Sshin	struct radix_node *rn = rn_match(v_arg, head);
19453541Sshin	struct rtentry *rt = (struct rtentry *)rn;
19553541Sshin
196213225Sdelphij	if (rt) {
197213225Sdelphij		RT_LOCK(rt);
19853541Sshin		if (rt->rt_flags & RTPRF_OURS) {
19953541Sshin			rt->rt_flags &= ~RTPRF_OURS;
20053541Sshin			rt->rt_rmx.rmx_expire = 0;
20153541Sshin		}
202213225Sdelphij		RT_UNLOCK(rt);
20353541Sshin	}
20453541Sshin	return rn;
20553541Sshin}
20653541Sshin
20762604SitojunSYSCTL_DECL(_net_inet6_ip6);
20862604Sitojun
209215701Sdimstatic VNET_DEFINE(int, rtq_reallyold6) = 60*60;
210207369Sbz	/* one hour is ``really old'' */
211195727Srwatson#define	V_rtq_reallyold6		VNET(rtq_reallyold6)
212195699SrwatsonSYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, CTLFLAG_RW,
213195699Srwatson    &VNET_NAME(rtq_reallyold6) , 0, "");
214120913Sume
215215701Sdimstatic VNET_DEFINE(int, rtq_minreallyold6) = 10;
216207369Sbz	/* never automatically crank down to less */
217207369Sbz#define	V_rtq_minreallyold6		VNET(rtq_minreallyold6)
218195699SrwatsonSYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW,
219195699Srwatson    &VNET_NAME(rtq_minreallyold6) , 0, "");
22053541Sshin
221215701Sdimstatic VNET_DEFINE(int, rtq_toomany6) = 128;
222207369Sbz	/* 128 cached routes is ``too many'' */
223207369Sbz#define	V_rtq_toomany6			VNET(rtq_toomany6)
224195699SrwatsonSYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW,
225195699Srwatson    &VNET_NAME(rtq_toomany6) , 0, "");
226120913Sume
22753541Sshinstruct rtqk_arg {
22853541Sshin	struct radix_node_head *rnh;
22953541Sshin	int mode;
23053541Sshin	int updating;
23153541Sshin	int draining;
23253541Sshin	int killed;
23353541Sshin	int found;
23453541Sshin	time_t nextstop;
23553541Sshin};
23653541Sshin
23753541Sshin/*
23853541Sshin * Get rid of old routes.  When draining, this deletes everything, even when
23953541Sshin * the timeout is not expired yet.  When updating, this makes sure that
240181832Sbz * nothing has a timeout longer than the current value of rtq_reallyold6.
24153541Sshin */
24253541Sshinstatic int
24353541Sshinin6_rtqkill(struct radix_node *rn, void *rock)
24453541Sshin{
24553541Sshin	struct rtqk_arg *ap = rock;
24653541Sshin	struct rtentry *rt = (struct rtentry *)rn;
24753541Sshin	int err;
24853541Sshin
249188963Srwatson	RADIX_NODE_HEAD_WLOCK_ASSERT(ap->rnh);
250188963Srwatson
25153541Sshin	if (rt->rt_flags & RTPRF_OURS) {
25253541Sshin		ap->found++;
25353541Sshin
254150351Sandre		if (ap->draining || rt->rt_rmx.rmx_expire <= time_uptime) {
25553541Sshin			if (rt->rt_refcnt > 0)
25653541Sshin				panic("rtqkill route really not free");
25753541Sshin
25853541Sshin			err = rtrequest(RTM_DELETE,
25953541Sshin					(struct sockaddr *)rt_key(rt),
26053541Sshin					rt->rt_gateway, rt_mask(rt),
261186119Sqingli					rt->rt_flags|RTF_RNH_LOCKED, 0);
26253541Sshin			if (err) {
26353541Sshin				log(LOG_WARNING, "in6_rtqkill: error %d", err);
26453541Sshin			} else {
26553541Sshin				ap->killed++;
26653541Sshin			}
26753541Sshin		} else {
26853541Sshin			if (ap->updating
269150351Sandre			   && (rt->rt_rmx.rmx_expire - time_uptime
270181832Sbz			       > V_rtq_reallyold6)) {
271150351Sandre				rt->rt_rmx.rmx_expire = time_uptime
272181832Sbz					+ V_rtq_reallyold6;
27353541Sshin			}
27453541Sshin			ap->nextstop = lmin(ap->nextstop,
27553541Sshin					    rt->rt_rmx.rmx_expire);
27653541Sshin		}
27753541Sshin	}
27853541Sshin
27953541Sshin	return 0;
28053541Sshin}
28153541Sshin
28253541Sshin#define RTQ_TIMEOUT	60*10	/* run no less than once every ten minutes */
283215701Sdimstatic VNET_DEFINE(int, rtq_timeout6) = RTQ_TIMEOUT;
284215701Sdimstatic VNET_DEFINE(struct callout, rtq_timer6);
28553541Sshin
286195727Srwatson#define	V_rtq_timeout6			VNET(rtq_timeout6)
287195727Srwatson#define	V_rtq_timer6			VNET(rtq_timer6)
288195699Srwatson
28953541Sshinstatic void
29053541Sshinin6_rtqtimo(void *rock)
29153541Sshin{
292183550Szec	CURVNET_SET_QUIET((struct vnet *) rock);
293193232Sbz	struct radix_node_head *rnh;
29453541Sshin	struct rtqk_arg arg;
29553541Sshin	struct timeval atv;
29653541Sshin	static time_t last_adjusted_timeout = 0;
29753541Sshin
298193232Sbz	rnh = rt_tables_get_rnh(0, AF_INET6);
299193232Sbz	if (rnh == NULL) {
300193232Sbz		CURVNET_RESTORE();
301193232Sbz		return;
302193232Sbz	}
30353541Sshin	arg.found = arg.killed = 0;
30453541Sshin	arg.rnh = rnh;
305181803Sbz	arg.nextstop = time_uptime + V_rtq_timeout6;
30653541Sshin	arg.draining = arg.updating = 0;
307108250Shsu	RADIX_NODE_HEAD_LOCK(rnh);
30853541Sshin	rnh->rnh_walktree(rnh, in6_rtqkill, &arg);
309108250Shsu	RADIX_NODE_HEAD_UNLOCK(rnh);
31053541Sshin
31153541Sshin	/*
31253541Sshin	 * Attempt to be somewhat dynamic about this:
31353541Sshin	 * If there are ``too many'' routes sitting around taking up space,
31453541Sshin	 * then crank down the timeout, and see if we can't make some more
31553541Sshin	 * go away.  However, we make sure that we will never adjust more
316180084Sjulian	 * than once in rtq_timeout6 seconds, to keep from cranking down too
31753541Sshin	 * hard.
31853541Sshin	 */
319181832Sbz	if ((arg.found - arg.killed > V_rtq_toomany6)
320181803Sbz	   && (time_uptime - last_adjusted_timeout >= V_rtq_timeout6)
321181832Sbz	   && V_rtq_reallyold6 > V_rtq_minreallyold6) {
322181832Sbz		V_rtq_reallyold6 = 2*V_rtq_reallyold6 / 3;
323181832Sbz		if (V_rtq_reallyold6 < V_rtq_minreallyold6) {
324181832Sbz			V_rtq_reallyold6 = V_rtq_minreallyold6;
32553541Sshin		}
32653541Sshin
327160123Soleg		last_adjusted_timeout = time_uptime;
32853541Sshin#ifdef DIAGNOSTIC
329181832Sbz		log(LOG_DEBUG, "in6_rtqtimo: adjusted rtq_reallyold6 to %d",
330181832Sbz		    V_rtq_reallyold6);
33153541Sshin#endif
33253541Sshin		arg.found = arg.killed = 0;
33353541Sshin		arg.updating = 1;
334108250Shsu		RADIX_NODE_HEAD_LOCK(rnh);
33553541Sshin		rnh->rnh_walktree(rnh, in6_rtqkill, &arg);
336108250Shsu		RADIX_NODE_HEAD_UNLOCK(rnh);
33753541Sshin	}
33853541Sshin
33953541Sshin	atv.tv_usec = 0;
340160123Soleg	atv.tv_sec = arg.nextstop - time_uptime;
341181803Sbz	callout_reset(&V_rtq_timer6, tvtohz(&atv), in6_rtqtimo, rock);
342183550Szec	CURVNET_RESTORE();
34353541Sshin}
34453541Sshin
34553541Sshin/*
34653541Sshin * Age old PMTUs.
34753541Sshin */
34853541Sshinstruct mtuex_arg {
34953541Sshin	struct radix_node_head *rnh;
35053541Sshin	time_t nextstop;
35153541Sshin};
352215701Sdimstatic VNET_DEFINE(struct callout, rtq_mtutimer);
353195727Srwatson#define	V_rtq_mtutimer			VNET(rtq_mtutimer)
354195699Srwatson
35553541Sshinstatic int
35653541Sshinin6_mtuexpire(struct radix_node *rn, void *rock)
35753541Sshin{
35853541Sshin	struct rtentry *rt = (struct rtentry *)rn;
35953541Sshin	struct mtuex_arg *ap = rock;
36053541Sshin
36153541Sshin	/* sanity */
36253541Sshin	if (!rt)
36353541Sshin		panic("rt == NULL in in6_mtuexpire");
36453541Sshin
36553541Sshin	if (rt->rt_rmx.rmx_expire && !(rt->rt_flags & RTF_PROBEMTU)) {
366150351Sandre		if (rt->rt_rmx.rmx_expire <= time_uptime) {
36753541Sshin			rt->rt_flags |= RTF_PROBEMTU;
36853541Sshin		} else {
36953541Sshin			ap->nextstop = lmin(ap->nextstop,
37053541Sshin					rt->rt_rmx.rmx_expire);
37153541Sshin		}
37253541Sshin	}
37353541Sshin
37453541Sshin	return 0;
37553541Sshin}
37653541Sshin
37753541Sshin#define	MTUTIMO_DEFAULT	(60*1)
37853541Sshin
37953541Sshinstatic void
38053541Sshinin6_mtutimo(void *rock)
38153541Sshin{
382183550Szec	CURVNET_SET_QUIET((struct vnet *) rock);
383193232Sbz	struct radix_node_head *rnh;
38453541Sshin	struct mtuex_arg arg;
38553541Sshin	struct timeval atv;
38653541Sshin
387193232Sbz	rnh = rt_tables_get_rnh(0, AF_INET6);
388193232Sbz	if (rnh == NULL) {
389193232Sbz		CURVNET_RESTORE();
390193232Sbz		return;
391193232Sbz	}
39253541Sshin	arg.rnh = rnh;
393160123Soleg	arg.nextstop = time_uptime + MTUTIMO_DEFAULT;
394108250Shsu	RADIX_NODE_HEAD_LOCK(rnh);
39553541Sshin	rnh->rnh_walktree(rnh, in6_mtuexpire, &arg);
396108250Shsu	RADIX_NODE_HEAD_UNLOCK(rnh);
39753541Sshin
39853541Sshin	atv.tv_usec = 0;
399160123Soleg	atv.tv_sec = arg.nextstop - time_uptime;
400136184Ssuz	if (atv.tv_sec < 0) {
40153541Sshin		printf("invalid mtu expiration time on routing table\n");
402160123Soleg		arg.nextstop = time_uptime + 30;	/* last resort */
403160123Soleg		atv.tv_sec = 30;
40453541Sshin	}
405181803Sbz	callout_reset(&V_rtq_mtutimer, tvtohz(&atv), in6_mtutimo, rock);
406183550Szec	CURVNET_RESTORE();
40753541Sshin}
40853541Sshin
40953541Sshin/*
41053541Sshin * Initialize our routing tree.
411178888Sjulian * XXX MRT When off == 0, we are being called from vfs_export.c
412178888Sjulian * so just set up their table and leave. (we know what the correct
413178888Sjulian * value should be so just use that).. FIX AFTER RELENG_7 is MFC'd
414178888Sjulian * see also comments in in_inithead() vfs_export.c and domain.h
41553541Sshin */
41653541Sshinint
41753541Sshinin6_inithead(void **head, int off)
41853541Sshin{
41953541Sshin	struct radix_node_head *rnh;
42053541Sshin
421178888Sjulian	if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3))
422178888Sjulian		return 0;		/* See above */
42353541Sshin
424178888Sjulian	if (off == 0)		/* See above */
425178888Sjulian		return 1;	/* only do the rest for the real thing */
42653541Sshin
42753541Sshin	rnh = *head;
428193232Sbz	KASSERT(rnh == rt_tables_get_rnh(0, AF_INET6), ("rnh?"));
42953541Sshin	rnh->rnh_addaddr = in6_addroute;
43053541Sshin	rnh->rnh_matchaddr = in6_matroute;
431181803Sbz	callout_init(&V_rtq_timer6, CALLOUT_MPSAFE);
432181803Sbz	callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE);
433191816Szec	in6_rtqtimo(curvnet);	/* kick off timeout first time */
434191816Szec	in6_mtutimo(curvnet);	/* kick off timeout first time */
43553541Sshin	return 1;
43653541Sshin}
437193731Szec
438193731Szec#ifdef VIMAGE
439193731Szecint
440193731Szecin6_detachhead(void **head, int off)
441193731Szec{
442193731Szec
443193731Szec	callout_drain(&V_rtq_timer6);
444193731Szec	callout_drain(&V_rtq_mtutimer);
445193731Szec	return (1);
446193731Szec}
447193731Szec#endif
448