in6_rmx.c revision 174510
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 174510 2007-12-10 16:03:40Z obrien $"); 77174510Sobrien 7853541Sshin#include <sys/param.h> 7953541Sshin#include <sys/systm.h> 8053541Sshin#include <sys/kernel.h> 8153541Sshin#include <sys/sysctl.h> 8253541Sshin#include <sys/queue.h> 8353541Sshin#include <sys/socket.h> 8453541Sshin#include <sys/socketvar.h> 8553541Sshin#include <sys/mbuf.h> 8653541Sshin#include <sys/syslog.h> 87120727Ssam#include <sys/callout.h> 8853541Sshin 8953541Sshin#include <net/if.h> 9053541Sshin#include <net/route.h> 9153541Sshin#include <netinet/in.h> 9253541Sshin#include <netinet/ip_var.h> 9353541Sshin#include <netinet/in_var.h> 9453541Sshin 9562587Sitojun#include <netinet/ip6.h> 9653541Sshin#include <netinet6/ip6_var.h> 9753541Sshin 9862587Sitojun#include <netinet/icmp6.h> 99121283Sume#include <netinet6/nd6.h> 10053541Sshin 10153541Sshin#include <netinet/tcp.h> 10253541Sshin#include <netinet/tcp_seq.h> 10353541Sshin#include <netinet/tcp_timer.h> 10453541Sshin#include <netinet/tcp_var.h> 10553541Sshin 10653541Sshinextern int in6_inithead __P((void **head, int off)); 10753541Sshin 10862587Sitojun#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ 10953541Sshin 11053541Sshin/* 11153541Sshin * Do what we need to do when inserting a route. 11253541Sshin */ 11353541Sshinstatic struct radix_node * 11453541Sshinin6_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, 115171260Sdelphij struct radix_node *treenodes) 11653541Sshin{ 11753541Sshin struct rtentry *rt = (struct rtentry *)treenodes; 11853541Sshin struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt); 11953541Sshin struct radix_node *ret; 12053541Sshin 12153541Sshin if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) 12253541Sshin rt->rt_flags |= RTF_MULTICAST; 12353541Sshin 12453541Sshin /* 12553541Sshin * A little bit of help for both IPv6 output and input: 12653541Sshin * For local addresses, we make sure that RTF_LOCAL is set, 12753541Sshin * with the thought that this might one day be used to speed up 12853541Sshin * ip_input(). 12953541Sshin * 13053541Sshin * We also mark routes to multicast addresses as such, because 13153541Sshin * it's easy to do and might be useful (but this is much more 13253541Sshin * dubious since it's so easy to inspect the address). (This 13353541Sshin * is done above.) 13453541Sshin * 13553541Sshin * XXX 13653541Sshin * should elaborate the code. 13753541Sshin */ 13853541Sshin if (rt->rt_flags & RTF_HOST) { 13953541Sshin if (IN6_ARE_ADDR_EQUAL(&satosin6(rt->rt_ifa->ifa_addr) 14053541Sshin ->sin6_addr, 14153541Sshin &sin6->sin6_addr)) { 14253541Sshin rt->rt_flags |= RTF_LOCAL; 14353541Sshin } 14453541Sshin } 14553541Sshin 146122922Sandre if (!rt->rt_rmx.rmx_mtu && rt->rt_ifp) 147121283Sume rt->rt_rmx.rmx_mtu = IN6_LINKMTU(rt->rt_ifp); 14853541Sshin 14953541Sshin ret = rn_addroute(v_arg, n_arg, head, treenodes); 15053541Sshin if (ret == NULL && rt->rt_flags & RTF_HOST) { 15153541Sshin struct rtentry *rt2; 15253541Sshin /* 15353541Sshin * We are trying to add a host route, but can't. 15453541Sshin * Find out if it is because of an 15553541Sshin * ARP entry and delete it if so. 15653541Sshin */ 157122921Sandre rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_CLONING); 15853541Sshin if (rt2) { 15953541Sshin if (rt2->rt_flags & RTF_LLINFO && 16053541Sshin rt2->rt_flags & RTF_HOST && 16153541Sshin rt2->rt_gateway && 16253541Sshin rt2->rt_gateway->sa_family == AF_LINK) { 163121770Ssam rtexpunge(rt2); 164121770Ssam RTFREE_LOCKED(rt2); 16553541Sshin ret = rn_addroute(v_arg, n_arg, head, 16653541Sshin treenodes); 167121770Ssam } else 168121770Ssam RTFREE_LOCKED(rt2); 16953541Sshin } 17053541Sshin } else if (ret == NULL && rt->rt_flags & RTF_CLONING) { 17153541Sshin struct rtentry *rt2; 17253541Sshin /* 17353541Sshin * We are trying to add a net route, but can't. 17453541Sshin * The following case should be allowed, so we'll make a 17553541Sshin * special check for this: 17653541Sshin * Two IPv6 addresses with the same prefix is assigned 17753541Sshin * to a single interrface. 17853541Sshin * # ifconfig if0 inet6 3ffe:0501::1 prefix 64 alias (*1) 17953541Sshin * # ifconfig if0 inet6 3ffe:0501::2 prefix 64 alias (*2) 18053541Sshin * In this case, (*1) and (*2) want to add the same 18153541Sshin * net route entry, 3ffe:0501:: -> if0. 18253541Sshin * This case should not raise an error. 18353541Sshin */ 184122921Sandre rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_CLONING); 18553541Sshin if (rt2) { 18653541Sshin if ((rt2->rt_flags & (RTF_CLONING|RTF_HOST|RTF_GATEWAY)) 18753541Sshin == RTF_CLONING 18853541Sshin && rt2->rt_gateway 18953541Sshin && rt2->rt_gateway->sa_family == AF_LINK 19053541Sshin && rt2->rt_ifp == rt->rt_ifp) { 19153541Sshin ret = rt2->rt_nodes; 19253541Sshin } 193120727Ssam RTFREE_LOCKED(rt2); 19453541Sshin } 19553541Sshin } 19653541Sshin return ret; 19753541Sshin} 19853541Sshin 19953541Sshin/* 20053541Sshin * This code is the inverse of in6_clsroute: on first reference, if we 20153541Sshin * were managing the route, stop doing so and set the expiration timer 20253541Sshin * back off again. 20353541Sshin */ 20453541Sshinstatic struct radix_node * 20553541Sshinin6_matroute(void *v_arg, struct radix_node_head *head) 20653541Sshin{ 20753541Sshin struct radix_node *rn = rn_match(v_arg, head); 20853541Sshin struct rtentry *rt = (struct rtentry *)rn; 20953541Sshin 21053541Sshin if (rt && rt->rt_refcnt == 0) { /* this is first reference */ 21153541Sshin if (rt->rt_flags & RTPRF_OURS) { 21253541Sshin rt->rt_flags &= ~RTPRF_OURS; 21353541Sshin rt->rt_rmx.rmx_expire = 0; 21453541Sshin } 21553541Sshin } 21653541Sshin return rn; 21753541Sshin} 21853541Sshin 21962604SitojunSYSCTL_DECL(_net_inet6_ip6); 22062604Sitojun 22153541Sshinstatic int rtq_reallyold = 60*60; 22253541Sshin /* one hour is ``really old'' */ 22362604SitojunSYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, 22453541Sshin CTLFLAG_RW, &rtq_reallyold , 0, ""); 225120913Sume 22653541Sshinstatic int rtq_minreallyold = 10; 22753541Sshin /* never automatically crank down to less */ 22862604SitojunSYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, 22953541Sshin CTLFLAG_RW, &rtq_minreallyold , 0, ""); 230120913Sume 23153541Sshinstatic int rtq_toomany = 128; 23253541Sshin /* 128 cached routes is ``too many'' */ 23362604SitojunSYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTMAXCACHE, rtmaxcache, 23453541Sshin CTLFLAG_RW, &rtq_toomany , 0, ""); 23553541Sshin 236120913Sume 23753541Sshin/* 23853541Sshin * On last reference drop, mark the route as belong to us so that it can be 23953541Sshin * timed out. 24053541Sshin */ 24153541Sshinstatic void 24253541Sshinin6_clsroute(struct radix_node *rn, struct radix_node_head *head) 24353541Sshin{ 24453541Sshin struct rtentry *rt = (struct rtentry *)rn; 24553541Sshin 246120727Ssam RT_LOCK_ASSERT(rt); 247120727Ssam 24853541Sshin if (!(rt->rt_flags & RTF_UP)) 24953541Sshin return; /* prophylactic measures */ 25053541Sshin 25153541Sshin if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) 25253541Sshin return; 25353541Sshin 254108250Shsu if ((rt->rt_flags & (RTF_WASCLONED | RTPRF_OURS)) != RTF_WASCLONED) 25553541Sshin return; 25653541Sshin 25753541Sshin /* 25853541Sshin * As requested by David Greenman: 25953541Sshin * If rtq_reallyold is 0, just delete the route without 26053541Sshin * waiting for a timeout cycle to kill it. 26153541Sshin */ 26253541Sshin if (rtq_reallyold != 0) { 26353541Sshin rt->rt_flags |= RTPRF_OURS; 264150351Sandre rt->rt_rmx.rmx_expire = time_uptime + rtq_reallyold; 26553541Sshin } else { 266121770Ssam rtexpunge(rt); 26753541Sshin } 26853541Sshin} 26953541Sshin 27053541Sshinstruct rtqk_arg { 27153541Sshin struct radix_node_head *rnh; 27253541Sshin int mode; 27353541Sshin int updating; 27453541Sshin int draining; 27553541Sshin int killed; 27653541Sshin int found; 27753541Sshin time_t nextstop; 27853541Sshin}; 27953541Sshin 28053541Sshin/* 28153541Sshin * Get rid of old routes. When draining, this deletes everything, even when 28253541Sshin * the timeout is not expired yet. When updating, this makes sure that 28353541Sshin * nothing has a timeout longer than the current value of rtq_reallyold. 28453541Sshin */ 28553541Sshinstatic int 28653541Sshinin6_rtqkill(struct radix_node *rn, void *rock) 28753541Sshin{ 28853541Sshin struct rtqk_arg *ap = rock; 28953541Sshin struct rtentry *rt = (struct rtentry *)rn; 29053541Sshin int err; 29153541Sshin 29253541Sshin if (rt->rt_flags & RTPRF_OURS) { 29353541Sshin ap->found++; 29453541Sshin 295150351Sandre if (ap->draining || rt->rt_rmx.rmx_expire <= time_uptime) { 29653541Sshin if (rt->rt_refcnt > 0) 29753541Sshin panic("rtqkill route really not free"); 29853541Sshin 29953541Sshin err = rtrequest(RTM_DELETE, 30053541Sshin (struct sockaddr *)rt_key(rt), 30153541Sshin rt->rt_gateway, rt_mask(rt), 30253541Sshin rt->rt_flags, 0); 30353541Sshin if (err) { 30453541Sshin log(LOG_WARNING, "in6_rtqkill: error %d", err); 30553541Sshin } else { 30653541Sshin ap->killed++; 30753541Sshin } 30853541Sshin } else { 30953541Sshin if (ap->updating 310150351Sandre && (rt->rt_rmx.rmx_expire - time_uptime 31153541Sshin > rtq_reallyold)) { 312150351Sandre rt->rt_rmx.rmx_expire = time_uptime 31353541Sshin + rtq_reallyold; 31453541Sshin } 31553541Sshin ap->nextstop = lmin(ap->nextstop, 31653541Sshin rt->rt_rmx.rmx_expire); 31753541Sshin } 31853541Sshin } 31953541Sshin 32053541Sshin return 0; 32153541Sshin} 32253541Sshin 32353541Sshin#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ 32453541Sshinstatic int rtq_timeout = RTQ_TIMEOUT; 325120727Ssamstatic struct callout rtq_timer; 32653541Sshin 32753541Sshinstatic void 32853541Sshinin6_rtqtimo(void *rock) 32953541Sshin{ 33053541Sshin struct radix_node_head *rnh = rock; 33153541Sshin struct rtqk_arg arg; 33253541Sshin struct timeval atv; 33353541Sshin static time_t last_adjusted_timeout = 0; 33453541Sshin 33553541Sshin arg.found = arg.killed = 0; 33653541Sshin arg.rnh = rnh; 337160123Soleg arg.nextstop = time_uptime + rtq_timeout; 33853541Sshin arg.draining = arg.updating = 0; 339108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 34053541Sshin rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 341108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 34253541Sshin 34353541Sshin /* 34453541Sshin * Attempt to be somewhat dynamic about this: 34553541Sshin * If there are ``too many'' routes sitting around taking up space, 34653541Sshin * then crank down the timeout, and see if we can't make some more 34753541Sshin * go away. However, we make sure that we will never adjust more 34853541Sshin * than once in rtq_timeout seconds, to keep from cranking down too 34953541Sshin * hard. 35053541Sshin */ 35153541Sshin if ((arg.found - arg.killed > rtq_toomany) 352160123Soleg && (time_uptime - last_adjusted_timeout >= rtq_timeout) 35353541Sshin && rtq_reallyold > rtq_minreallyold) { 35453541Sshin rtq_reallyold = 2*rtq_reallyold / 3; 35553541Sshin if (rtq_reallyold < rtq_minreallyold) { 35653541Sshin rtq_reallyold = rtq_minreallyold; 35753541Sshin } 35853541Sshin 359160123Soleg last_adjusted_timeout = time_uptime; 36053541Sshin#ifdef DIAGNOSTIC 36153541Sshin log(LOG_DEBUG, "in6_rtqtimo: adjusted rtq_reallyold to %d", 36253541Sshin rtq_reallyold); 36353541Sshin#endif 36453541Sshin arg.found = arg.killed = 0; 36553541Sshin arg.updating = 1; 366108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 36753541Sshin rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 368108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 36953541Sshin } 37053541Sshin 37153541Sshin atv.tv_usec = 0; 372160123Soleg atv.tv_sec = arg.nextstop - time_uptime; 373120727Ssam callout_reset(&rtq_timer, tvtohz(&atv), in6_rtqtimo, rock); 37453541Sshin} 37553541Sshin 37653541Sshin/* 37753541Sshin * Age old PMTUs. 37853541Sshin */ 37953541Sshinstruct mtuex_arg { 38053541Sshin struct radix_node_head *rnh; 38153541Sshin time_t nextstop; 38253541Sshin}; 383120727Ssamstatic struct callout rtq_mtutimer; 38453541Sshin 38553541Sshinstatic int 38653541Sshinin6_mtuexpire(struct radix_node *rn, void *rock) 38753541Sshin{ 38853541Sshin struct rtentry *rt = (struct rtentry *)rn; 38953541Sshin struct mtuex_arg *ap = rock; 39053541Sshin 39153541Sshin /* sanity */ 39253541Sshin if (!rt) 39353541Sshin panic("rt == NULL in in6_mtuexpire"); 39453541Sshin 39553541Sshin if (rt->rt_rmx.rmx_expire && !(rt->rt_flags & RTF_PROBEMTU)) { 396150351Sandre if (rt->rt_rmx.rmx_expire <= time_uptime) { 39753541Sshin rt->rt_flags |= RTF_PROBEMTU; 39853541Sshin } else { 39953541Sshin ap->nextstop = lmin(ap->nextstop, 40053541Sshin rt->rt_rmx.rmx_expire); 40153541Sshin } 40253541Sshin } 40353541Sshin 40453541Sshin return 0; 40553541Sshin} 40653541Sshin 40753541Sshin#define MTUTIMO_DEFAULT (60*1) 40853541Sshin 40953541Sshinstatic void 41053541Sshinin6_mtutimo(void *rock) 41153541Sshin{ 41253541Sshin struct radix_node_head *rnh = rock; 41353541Sshin struct mtuex_arg arg; 41453541Sshin struct timeval atv; 41553541Sshin 41653541Sshin arg.rnh = rnh; 417160123Soleg arg.nextstop = time_uptime + MTUTIMO_DEFAULT; 418108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 41953541Sshin rnh->rnh_walktree(rnh, in6_mtuexpire, &arg); 420108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 42153541Sshin 42253541Sshin atv.tv_usec = 0; 423160123Soleg atv.tv_sec = arg.nextstop - time_uptime; 424136184Ssuz if (atv.tv_sec < 0) { 42553541Sshin printf("invalid mtu expiration time on routing table\n"); 426160123Soleg arg.nextstop = time_uptime + 30; /* last resort */ 427160123Soleg atv.tv_sec = 30; 42853541Sshin } 429120727Ssam callout_reset(&rtq_mtutimer, tvtohz(&atv), in6_mtutimo, rock); 43053541Sshin} 43153541Sshin 43262587Sitojun#if 0 43362587Sitojunvoid 434171259Sdelphijin6_rtqdrain(void) 43562587Sitojun{ 43662587Sitojun struct radix_node_head *rnh = rt_tables[AF_INET6]; 43762587Sitojun struct rtqk_arg arg; 438120727Ssam 43962587Sitojun arg.found = arg.killed = 0; 44062587Sitojun arg.rnh = rnh; 44162587Sitojun arg.nextstop = 0; 44262587Sitojun arg.draining = 1; 44362587Sitojun arg.updating = 0; 444108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 44562587Sitojun rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 446108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 44762587Sitojun} 44862587Sitojun#endif 44962587Sitojun 45053541Sshin/* 45153541Sshin * Initialize our routing tree. 45253541Sshin */ 45353541Sshinint 45453541Sshinin6_inithead(void **head, int off) 45553541Sshin{ 45653541Sshin struct radix_node_head *rnh; 45753541Sshin 45853541Sshin if (!rn_inithead(head, off)) 45953541Sshin return 0; 46053541Sshin 46153541Sshin if (head != (void **)&rt_tables[AF_INET6]) /* BOGUS! */ 46253541Sshin return 1; /* only do this for the real routing table */ 46353541Sshin 46453541Sshin rnh = *head; 46553541Sshin rnh->rnh_addaddr = in6_addroute; 46653541Sshin rnh->rnh_matchaddr = in6_matroute; 46753541Sshin rnh->rnh_close = in6_clsroute; 468120727Ssam callout_init(&rtq_timer, CALLOUT_MPSAFE); 46953541Sshin in6_rtqtimo(rnh); /* kick off timeout first time */ 470120727Ssam callout_init(&rtq_mtutimer, CALLOUT_MPSAFE); 47153541Sshin in6_mtutimo(rnh); /* kick off timeout first time */ 47253541Sshin return 1; 47353541Sshin} 474