in6_rmx.c revision 181803
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 181803 2008-08-17 23:27:27Z bz $"); 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> 88181803Sbz#include <sys/vimage.h> 8953541Sshin 9053541Sshin#include <net/if.h> 9153541Sshin#include <net/route.h> 9253541Sshin#include <netinet/in.h> 9353541Sshin#include <netinet/ip_var.h> 9453541Sshin#include <netinet/in_var.h> 9553541Sshin 9662587Sitojun#include <netinet/ip6.h> 9753541Sshin#include <netinet6/ip6_var.h> 9853541Sshin 9962587Sitojun#include <netinet/icmp6.h> 100121283Sume#include <netinet6/nd6.h> 10153541Sshin 10253541Sshin#include <netinet/tcp.h> 10353541Sshin#include <netinet/tcp_seq.h> 10453541Sshin#include <netinet/tcp_timer.h> 10553541Sshin#include <netinet/tcp_var.h> 10653541Sshin 107175162Sobrienextern int in6_inithead(void **head, int off); 10853541Sshin 10962587Sitojun#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ 11053541Sshin 11153541Sshin/* 11253541Sshin * Do what we need to do when inserting a route. 11353541Sshin */ 11453541Sshinstatic struct radix_node * 11553541Sshinin6_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, 116171260Sdelphij struct radix_node *treenodes) 11753541Sshin{ 11853541Sshin struct rtentry *rt = (struct rtentry *)treenodes; 11953541Sshin struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt); 12053541Sshin struct radix_node *ret; 12153541Sshin 12253541Sshin if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) 12353541Sshin rt->rt_flags |= RTF_MULTICAST; 12453541Sshin 12553541Sshin /* 12653541Sshin * A little bit of help for both IPv6 output and input: 12753541Sshin * For local addresses, we make sure that RTF_LOCAL is set, 12853541Sshin * with the thought that this might one day be used to speed up 12953541Sshin * ip_input(). 13053541Sshin * 13153541Sshin * We also mark routes to multicast addresses as such, because 13253541Sshin * it's easy to do and might be useful (but this is much more 13353541Sshin * dubious since it's so easy to inspect the address). (This 13453541Sshin * is done above.) 13553541Sshin * 13653541Sshin * XXX 13753541Sshin * should elaborate the code. 13853541Sshin */ 13953541Sshin if (rt->rt_flags & RTF_HOST) { 14053541Sshin if (IN6_ARE_ADDR_EQUAL(&satosin6(rt->rt_ifa->ifa_addr) 14153541Sshin ->sin6_addr, 14253541Sshin &sin6->sin6_addr)) { 14353541Sshin rt->rt_flags |= RTF_LOCAL; 14453541Sshin } 14553541Sshin } 14653541Sshin 147122922Sandre if (!rt->rt_rmx.rmx_mtu && rt->rt_ifp) 148121283Sume rt->rt_rmx.rmx_mtu = IN6_LINKMTU(rt->rt_ifp); 14953541Sshin 15053541Sshin ret = rn_addroute(v_arg, n_arg, head, treenodes); 15153541Sshin if (ret == NULL && rt->rt_flags & RTF_HOST) { 15253541Sshin struct rtentry *rt2; 15353541Sshin /* 15453541Sshin * We are trying to add a host route, but can't. 15553541Sshin * Find out if it is because of an 15653541Sshin * ARP entry and delete it if so. 15753541Sshin */ 158122921Sandre rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_CLONING); 15953541Sshin if (rt2) { 16053541Sshin if (rt2->rt_flags & RTF_LLINFO && 16153541Sshin rt2->rt_flags & RTF_HOST && 16253541Sshin rt2->rt_gateway && 16353541Sshin rt2->rt_gateway->sa_family == AF_LINK) { 164121770Ssam rtexpunge(rt2); 165121770Ssam RTFREE_LOCKED(rt2); 16653541Sshin ret = rn_addroute(v_arg, n_arg, head, 16753541Sshin treenodes); 168121770Ssam } else 169121770Ssam RTFREE_LOCKED(rt2); 17053541Sshin } 17153541Sshin } else if (ret == NULL && rt->rt_flags & RTF_CLONING) { 17253541Sshin struct rtentry *rt2; 17353541Sshin /* 17453541Sshin * We are trying to add a net route, but can't. 17553541Sshin * The following case should be allowed, so we'll make a 17653541Sshin * special check for this: 17753541Sshin * Two IPv6 addresses with the same prefix is assigned 17853541Sshin * to a single interrface. 17953541Sshin * # ifconfig if0 inet6 3ffe:0501::1 prefix 64 alias (*1) 18053541Sshin * # ifconfig if0 inet6 3ffe:0501::2 prefix 64 alias (*2) 18153541Sshin * In this case, (*1) and (*2) want to add the same 18253541Sshin * net route entry, 3ffe:0501:: -> if0. 18353541Sshin * This case should not raise an error. 18453541Sshin */ 185122921Sandre rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_CLONING); 18653541Sshin if (rt2) { 18753541Sshin if ((rt2->rt_flags & (RTF_CLONING|RTF_HOST|RTF_GATEWAY)) 18853541Sshin == RTF_CLONING 18953541Sshin && rt2->rt_gateway 19053541Sshin && rt2->rt_gateway->sa_family == AF_LINK 19153541Sshin && rt2->rt_ifp == rt->rt_ifp) { 19253541Sshin ret = rt2->rt_nodes; 19353541Sshin } 194120727Ssam RTFREE_LOCKED(rt2); 19553541Sshin } 19653541Sshin } 19753541Sshin return ret; 19853541Sshin} 19953541Sshin 20053541Sshin/* 20153541Sshin * This code is the inverse of in6_clsroute: on first reference, if we 20253541Sshin * were managing the route, stop doing so and set the expiration timer 20353541Sshin * back off again. 20453541Sshin */ 20553541Sshinstatic struct radix_node * 20653541Sshinin6_matroute(void *v_arg, struct radix_node_head *head) 20753541Sshin{ 20853541Sshin struct radix_node *rn = rn_match(v_arg, head); 20953541Sshin struct rtentry *rt = (struct rtentry *)rn; 21053541Sshin 21153541Sshin if (rt && rt->rt_refcnt == 0) { /* this is first reference */ 21253541Sshin if (rt->rt_flags & RTPRF_OURS) { 21353541Sshin rt->rt_flags &= ~RTPRF_OURS; 21453541Sshin rt->rt_rmx.rmx_expire = 0; 21553541Sshin } 21653541Sshin } 21753541Sshin return rn; 21853541Sshin} 21953541Sshin 22062604SitojunSYSCTL_DECL(_net_inet6_ip6); 22162604Sitojun 22253541Sshinstatic int rtq_reallyold = 60*60; 22353541Sshin /* one hour is ``really old'' */ 22462604SitojunSYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, 22553541Sshin CTLFLAG_RW, &rtq_reallyold , 0, ""); 226120913Sume 22753541Sshinstatic int rtq_minreallyold = 10; 22853541Sshin /* never automatically crank down to less */ 22962604SitojunSYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, 23053541Sshin CTLFLAG_RW, &rtq_minreallyold , 0, ""); 231120913Sume 23253541Sshinstatic int rtq_toomany = 128; 23353541Sshin /* 128 cached routes is ``too many'' */ 23462604SitojunSYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTMAXCACHE, rtmaxcache, 23553541Sshin CTLFLAG_RW, &rtq_toomany , 0, ""); 23653541Sshin 237120913Sume 23853541Sshin/* 23953541Sshin * On last reference drop, mark the route as belong to us so that it can be 24053541Sshin * timed out. 24153541Sshin */ 24253541Sshinstatic void 24353541Sshinin6_clsroute(struct radix_node *rn, struct radix_node_head *head) 24453541Sshin{ 24553541Sshin struct rtentry *rt = (struct rtentry *)rn; 24653541Sshin 247120727Ssam RT_LOCK_ASSERT(rt); 248120727Ssam 24953541Sshin if (!(rt->rt_flags & RTF_UP)) 25053541Sshin return; /* prophylactic measures */ 25153541Sshin 25253541Sshin if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) 25353541Sshin return; 25453541Sshin 255108250Shsu if ((rt->rt_flags & (RTF_WASCLONED | RTPRF_OURS)) != RTF_WASCLONED) 25653541Sshin return; 25753541Sshin 25853541Sshin /* 25953541Sshin * As requested by David Greenman: 26053541Sshin * If rtq_reallyold is 0, just delete the route without 26153541Sshin * waiting for a timeout cycle to kill it. 26253541Sshin */ 263181803Sbz if (V_rtq_reallyold != 0) { 26453541Sshin rt->rt_flags |= RTPRF_OURS; 265181803Sbz rt->rt_rmx.rmx_expire = time_uptime + V_rtq_reallyold; 26653541Sshin } else { 267121770Ssam rtexpunge(rt); 26853541Sshin } 26953541Sshin} 27053541Sshin 27153541Sshinstruct rtqk_arg { 27253541Sshin struct radix_node_head *rnh; 27353541Sshin int mode; 27453541Sshin int updating; 27553541Sshin int draining; 27653541Sshin int killed; 27753541Sshin int found; 27853541Sshin time_t nextstop; 27953541Sshin}; 28053541Sshin 28153541Sshin/* 28253541Sshin * Get rid of old routes. When draining, this deletes everything, even when 28353541Sshin * the timeout is not expired yet. When updating, this makes sure that 28453541Sshin * nothing has a timeout longer than the current value of rtq_reallyold. 28553541Sshin */ 28653541Sshinstatic int 28753541Sshinin6_rtqkill(struct radix_node *rn, void *rock) 28853541Sshin{ 28953541Sshin struct rtqk_arg *ap = rock; 29053541Sshin struct rtentry *rt = (struct rtentry *)rn; 29153541Sshin int err; 29253541Sshin 29353541Sshin if (rt->rt_flags & RTPRF_OURS) { 29453541Sshin ap->found++; 29553541Sshin 296150351Sandre if (ap->draining || rt->rt_rmx.rmx_expire <= time_uptime) { 29753541Sshin if (rt->rt_refcnt > 0) 29853541Sshin panic("rtqkill route really not free"); 29953541Sshin 30053541Sshin err = rtrequest(RTM_DELETE, 30153541Sshin (struct sockaddr *)rt_key(rt), 30253541Sshin rt->rt_gateway, rt_mask(rt), 30353541Sshin rt->rt_flags, 0); 30453541Sshin if (err) { 30553541Sshin log(LOG_WARNING, "in6_rtqkill: error %d", err); 30653541Sshin } else { 30753541Sshin ap->killed++; 30853541Sshin } 30953541Sshin } else { 31053541Sshin if (ap->updating 311150351Sandre && (rt->rt_rmx.rmx_expire - time_uptime 312181803Sbz > V_rtq_reallyold)) { 313150351Sandre rt->rt_rmx.rmx_expire = time_uptime 314181803Sbz + V_rtq_reallyold; 31553541Sshin } 31653541Sshin ap->nextstop = lmin(ap->nextstop, 31753541Sshin rt->rt_rmx.rmx_expire); 31853541Sshin } 31953541Sshin } 32053541Sshin 32153541Sshin return 0; 32253541Sshin} 32353541Sshin 32453541Sshin#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ 325180088Skanstatic int rtq_timeout6 = RTQ_TIMEOUT; 326180088Skanstatic struct callout rtq_timer6; 32753541Sshin 32853541Sshinstatic void 32953541Sshinin6_rtqtimo(void *rock) 33053541Sshin{ 33153541Sshin struct radix_node_head *rnh = rock; 33253541Sshin struct rtqk_arg arg; 33353541Sshin struct timeval atv; 33453541Sshin static time_t last_adjusted_timeout = 0; 33553541Sshin 33653541Sshin arg.found = arg.killed = 0; 33753541Sshin arg.rnh = rnh; 338181803Sbz arg.nextstop = time_uptime + V_rtq_timeout6; 33953541Sshin arg.draining = arg.updating = 0; 340108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 34153541Sshin rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 342108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 34353541Sshin 34453541Sshin /* 34553541Sshin * Attempt to be somewhat dynamic about this: 34653541Sshin * If there are ``too many'' routes sitting around taking up space, 34753541Sshin * then crank down the timeout, and see if we can't make some more 34853541Sshin * go away. However, we make sure that we will never adjust more 349180084Sjulian * than once in rtq_timeout6 seconds, to keep from cranking down too 35053541Sshin * hard. 35153541Sshin */ 352181803Sbz if ((arg.found - arg.killed > V_rtq_toomany) 353181803Sbz && (time_uptime - last_adjusted_timeout >= V_rtq_timeout6) 354181803Sbz && V_rtq_reallyold > V_rtq_minreallyold) { 355181803Sbz V_rtq_reallyold = 2*V_rtq_reallyold / 3; 356181803Sbz if (V_rtq_reallyold < V_rtq_minreallyold) { 357181803Sbz V_rtq_reallyold = V_rtq_minreallyold; 35853541Sshin } 35953541Sshin 360160123Soleg last_adjusted_timeout = time_uptime; 36153541Sshin#ifdef DIAGNOSTIC 36253541Sshin log(LOG_DEBUG, "in6_rtqtimo: adjusted rtq_reallyold to %d", 363181803Sbz V_rtq_reallyold); 36453541Sshin#endif 36553541Sshin arg.found = arg.killed = 0; 36653541Sshin arg.updating = 1; 367108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 36853541Sshin rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 369108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 37053541Sshin } 37153541Sshin 37253541Sshin atv.tv_usec = 0; 373160123Soleg atv.tv_sec = arg.nextstop - time_uptime; 374181803Sbz callout_reset(&V_rtq_timer6, tvtohz(&atv), in6_rtqtimo, rock); 37553541Sshin} 37653541Sshin 37753541Sshin/* 37853541Sshin * Age old PMTUs. 37953541Sshin */ 38053541Sshinstruct mtuex_arg { 38153541Sshin struct radix_node_head *rnh; 38253541Sshin time_t nextstop; 38353541Sshin}; 384120727Ssamstatic struct callout rtq_mtutimer; 38553541Sshin 38653541Sshinstatic int 38753541Sshinin6_mtuexpire(struct radix_node *rn, void *rock) 38853541Sshin{ 38953541Sshin struct rtentry *rt = (struct rtentry *)rn; 39053541Sshin struct mtuex_arg *ap = rock; 39153541Sshin 39253541Sshin /* sanity */ 39353541Sshin if (!rt) 39453541Sshin panic("rt == NULL in in6_mtuexpire"); 39553541Sshin 39653541Sshin if (rt->rt_rmx.rmx_expire && !(rt->rt_flags & RTF_PROBEMTU)) { 397150351Sandre if (rt->rt_rmx.rmx_expire <= time_uptime) { 39853541Sshin rt->rt_flags |= RTF_PROBEMTU; 39953541Sshin } else { 40053541Sshin ap->nextstop = lmin(ap->nextstop, 40153541Sshin rt->rt_rmx.rmx_expire); 40253541Sshin } 40353541Sshin } 40453541Sshin 40553541Sshin return 0; 40653541Sshin} 40753541Sshin 40853541Sshin#define MTUTIMO_DEFAULT (60*1) 40953541Sshin 41053541Sshinstatic void 41153541Sshinin6_mtutimo(void *rock) 41253541Sshin{ 41353541Sshin struct radix_node_head *rnh = rock; 41453541Sshin struct mtuex_arg arg; 41553541Sshin struct timeval atv; 41653541Sshin 41753541Sshin arg.rnh = rnh; 418160123Soleg arg.nextstop = time_uptime + MTUTIMO_DEFAULT; 419108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 42053541Sshin rnh->rnh_walktree(rnh, in6_mtuexpire, &arg); 421108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 42253541Sshin 42353541Sshin atv.tv_usec = 0; 424160123Soleg atv.tv_sec = arg.nextstop - time_uptime; 425136184Ssuz if (atv.tv_sec < 0) { 42653541Sshin printf("invalid mtu expiration time on routing table\n"); 427160123Soleg arg.nextstop = time_uptime + 30; /* last resort */ 428160123Soleg atv.tv_sec = 30; 42953541Sshin } 430181803Sbz callout_reset(&V_rtq_mtutimer, tvtohz(&atv), in6_mtutimo, rock); 43153541Sshin} 43253541Sshin 43362587Sitojun#if 0 43462587Sitojunvoid 435171259Sdelphijin6_rtqdrain(void) 43662587Sitojun{ 437181803Sbz struct radix_node_head *rnh = V_rt_tables[AF_INET6]; 43862587Sitojun struct rtqk_arg arg; 439120727Ssam 44062587Sitojun arg.found = arg.killed = 0; 44162587Sitojun arg.rnh = rnh; 44262587Sitojun arg.nextstop = 0; 44362587Sitojun arg.draining = 1; 44462587Sitojun arg.updating = 0; 445108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 44662587Sitojun rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 447108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 44862587Sitojun} 44962587Sitojun#endif 45062587Sitojun 45153541Sshin/* 45253541Sshin * Initialize our routing tree. 453178888Sjulian * XXX MRT When off == 0, we are being called from vfs_export.c 454178888Sjulian * so just set up their table and leave. (we know what the correct 455178888Sjulian * value should be so just use that).. FIX AFTER RELENG_7 is MFC'd 456178888Sjulian * see also comments in in_inithead() vfs_export.c and domain.h 45753541Sshin */ 45853541Sshinint 45953541Sshinin6_inithead(void **head, int off) 46053541Sshin{ 46153541Sshin struct radix_node_head *rnh; 46253541Sshin 463178888Sjulian if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3)) 464178888Sjulian return 0; /* See above */ 46553541Sshin 466178888Sjulian if (off == 0) /* See above */ 467178888Sjulian return 1; /* only do the rest for the real thing */ 46853541Sshin 46953541Sshin rnh = *head; 47053541Sshin rnh->rnh_addaddr = in6_addroute; 47153541Sshin rnh->rnh_matchaddr = in6_matroute; 47253541Sshin rnh->rnh_close = in6_clsroute; 473181803Sbz callout_init(&V_rtq_timer6, CALLOUT_MPSAFE); 47453541Sshin in6_rtqtimo(rnh); /* kick off timeout first time */ 475181803Sbz callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE); 47653541Sshin in6_mtutimo(rnh); /* kick off timeout first time */ 47753541Sshin return 1; 47853541Sshin} 479