in6_rmx.c revision 231852
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 231852 2012-02-17 02:39:58Z bz $"); 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 */ 171231852Sbz rt2 = in6_rtalloc1((struct sockaddr *)sin6, 0, RTF_RNH_LOCKED, 172231852Sbz rt->rt_fibnum); 17353541Sshin if (rt2) { 174186119Sqingli if (((rt2->rt_flags & (RTF_HOST|RTF_GATEWAY)) == 0) 17553541Sshin && rt2->rt_gateway 17653541Sshin && rt2->rt_gateway->sa_family == AF_LINK 17753541Sshin && rt2->rt_ifp == rt->rt_ifp) { 17853541Sshin ret = rt2->rt_nodes; 17953541Sshin } 180120727Ssam RTFREE_LOCKED(rt2); 18153541Sshin } 18253541Sshin } 183186119Sqingli return (ret); 18453541Sshin} 18553541Sshin 18653541Sshin/* 18753541Sshin * This code is the inverse of in6_clsroute: on first reference, if we 18853541Sshin * were managing the route, stop doing so and set the expiration timer 18953541Sshin * back off again. 19053541Sshin */ 19153541Sshinstatic struct radix_node * 19253541Sshinin6_matroute(void *v_arg, struct radix_node_head *head) 19353541Sshin{ 19453541Sshin struct radix_node *rn = rn_match(v_arg, head); 19553541Sshin struct rtentry *rt = (struct rtentry *)rn; 19653541Sshin 197213225Sdelphij if (rt) { 198213225Sdelphij RT_LOCK(rt); 19953541Sshin if (rt->rt_flags & RTPRF_OURS) { 20053541Sshin rt->rt_flags &= ~RTPRF_OURS; 20153541Sshin rt->rt_rmx.rmx_expire = 0; 20253541Sshin } 203213225Sdelphij RT_UNLOCK(rt); 20453541Sshin } 20553541Sshin return rn; 20653541Sshin} 20753541Sshin 20862604SitojunSYSCTL_DECL(_net_inet6_ip6); 20962604Sitojun 210215701Sdimstatic VNET_DEFINE(int, rtq_reallyold6) = 60*60; 211207369Sbz /* one hour is ``really old'' */ 212195727Srwatson#define V_rtq_reallyold6 VNET(rtq_reallyold6) 213195699SrwatsonSYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, CTLFLAG_RW, 214195699Srwatson &VNET_NAME(rtq_reallyold6) , 0, ""); 215120913Sume 216215701Sdimstatic VNET_DEFINE(int, rtq_minreallyold6) = 10; 217207369Sbz /* never automatically crank down to less */ 218207369Sbz#define V_rtq_minreallyold6 VNET(rtq_minreallyold6) 219195699SrwatsonSYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, 220195699Srwatson &VNET_NAME(rtq_minreallyold6) , 0, ""); 22153541Sshin 222215701Sdimstatic VNET_DEFINE(int, rtq_toomany6) = 128; 223207369Sbz /* 128 cached routes is ``too many'' */ 224207369Sbz#define V_rtq_toomany6 VNET(rtq_toomany6) 225195699SrwatsonSYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW, 226195699Srwatson &VNET_NAME(rtq_toomany6) , 0, ""); 227120913Sume 22853541Sshinstruct rtqk_arg { 22953541Sshin struct radix_node_head *rnh; 23053541Sshin int mode; 23153541Sshin int updating; 23253541Sshin int draining; 23353541Sshin int killed; 23453541Sshin int found; 23553541Sshin time_t nextstop; 23653541Sshin}; 23753541Sshin 23853541Sshin/* 23953541Sshin * Get rid of old routes. When draining, this deletes everything, even when 24053541Sshin * the timeout is not expired yet. When updating, this makes sure that 241181832Sbz * nothing has a timeout longer than the current value of rtq_reallyold6. 24253541Sshin */ 24353541Sshinstatic int 24453541Sshinin6_rtqkill(struct radix_node *rn, void *rock) 24553541Sshin{ 24653541Sshin struct rtqk_arg *ap = rock; 24753541Sshin struct rtentry *rt = (struct rtentry *)rn; 24853541Sshin int err; 24953541Sshin 250188963Srwatson RADIX_NODE_HEAD_WLOCK_ASSERT(ap->rnh); 251188963Srwatson 25253541Sshin if (rt->rt_flags & RTPRF_OURS) { 25353541Sshin ap->found++; 25453541Sshin 255150351Sandre if (ap->draining || rt->rt_rmx.rmx_expire <= time_uptime) { 25653541Sshin if (rt->rt_refcnt > 0) 25753541Sshin panic("rtqkill route really not free"); 25853541Sshin 259231852Sbz err = in6_rtrequest(RTM_DELETE, 26053541Sshin (struct sockaddr *)rt_key(rt), 26153541Sshin rt->rt_gateway, rt_mask(rt), 262231852Sbz rt->rt_flags|RTF_RNH_LOCKED, 0, 263231852Sbz rt->rt_fibnum); 26453541Sshin if (err) { 26553541Sshin log(LOG_WARNING, "in6_rtqkill: error %d", err); 26653541Sshin } else { 26753541Sshin ap->killed++; 26853541Sshin } 26953541Sshin } else { 27053541Sshin if (ap->updating 271150351Sandre && (rt->rt_rmx.rmx_expire - time_uptime 272181832Sbz > V_rtq_reallyold6)) { 273150351Sandre rt->rt_rmx.rmx_expire = time_uptime 274181832Sbz + V_rtq_reallyold6; 27553541Sshin } 27653541Sshin ap->nextstop = lmin(ap->nextstop, 27753541Sshin rt->rt_rmx.rmx_expire); 27853541Sshin } 27953541Sshin } 28053541Sshin 28153541Sshin return 0; 28253541Sshin} 28353541Sshin 28453541Sshin#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ 285215701Sdimstatic VNET_DEFINE(int, rtq_timeout6) = RTQ_TIMEOUT; 286215701Sdimstatic VNET_DEFINE(struct callout, rtq_timer6); 28753541Sshin 288195727Srwatson#define V_rtq_timeout6 VNET(rtq_timeout6) 289195727Srwatson#define V_rtq_timer6 VNET(rtq_timer6) 290195699Srwatson 29153541Sshinstatic void 292231852Sbzin6_rtqtimo_one(struct radix_node_head *rnh) 29353541Sshin{ 29453541Sshin struct rtqk_arg arg; 29553541Sshin static time_t last_adjusted_timeout = 0; 29653541Sshin 29753541Sshin arg.found = arg.killed = 0; 29853541Sshin arg.rnh = rnh; 299181803Sbz arg.nextstop = time_uptime + V_rtq_timeout6; 30053541Sshin arg.draining = arg.updating = 0; 301108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 30253541Sshin rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 303108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 30453541Sshin 30553541Sshin /* 30653541Sshin * Attempt to be somewhat dynamic about this: 30753541Sshin * If there are ``too many'' routes sitting around taking up space, 30853541Sshin * then crank down the timeout, and see if we can't make some more 30953541Sshin * go away. However, we make sure that we will never adjust more 310180084Sjulian * than once in rtq_timeout6 seconds, to keep from cranking down too 31153541Sshin * hard. 31253541Sshin */ 313181832Sbz if ((arg.found - arg.killed > V_rtq_toomany6) 314181803Sbz && (time_uptime - last_adjusted_timeout >= V_rtq_timeout6) 315181832Sbz && V_rtq_reallyold6 > V_rtq_minreallyold6) { 316181832Sbz V_rtq_reallyold6 = 2*V_rtq_reallyold6 / 3; 317181832Sbz if (V_rtq_reallyold6 < V_rtq_minreallyold6) { 318181832Sbz V_rtq_reallyold6 = V_rtq_minreallyold6; 31953541Sshin } 32053541Sshin 321160123Soleg last_adjusted_timeout = time_uptime; 32253541Sshin#ifdef DIAGNOSTIC 323181832Sbz log(LOG_DEBUG, "in6_rtqtimo: adjusted rtq_reallyold6 to %d", 324181832Sbz V_rtq_reallyold6); 32553541Sshin#endif 32653541Sshin arg.found = arg.killed = 0; 32753541Sshin arg.updating = 1; 328108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 32953541Sshin rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 330108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 33153541Sshin } 332231852Sbz} 33353541Sshin 334231852Sbzstatic void 335231852Sbzin6_rtqtimo(void *rock) 336231852Sbz{ 337231852Sbz CURVNET_SET_QUIET((struct vnet *) rock); 338231852Sbz struct radix_node_head *rnh; 339231852Sbz struct timeval atv; 340231852Sbz u_int fibnum; 341231852Sbz 342231852Sbz for (fibnum = 0; fibnum < rt_numfibs; fibnum++) { 343231852Sbz rnh = rt_tables_get_rnh(fibnum, AF_INET6); 344231852Sbz if (rnh != NULL) 345231852Sbz in6_rtqtimo_one(rnh); 346231852Sbz } 347231852Sbz 34853541Sshin atv.tv_usec = 0; 349231852Sbz atv.tv_sec = V_rtq_timeout6; 350181803Sbz callout_reset(&V_rtq_timer6, tvtohz(&atv), in6_rtqtimo, rock); 351183550Szec CURVNET_RESTORE(); 35253541Sshin} 35353541Sshin 35453541Sshin/* 35553541Sshin * Age old PMTUs. 35653541Sshin */ 35753541Sshinstruct mtuex_arg { 35853541Sshin struct radix_node_head *rnh; 35953541Sshin time_t nextstop; 36053541Sshin}; 361215701Sdimstatic VNET_DEFINE(struct callout, rtq_mtutimer); 362195727Srwatson#define V_rtq_mtutimer VNET(rtq_mtutimer) 363195699Srwatson 36453541Sshinstatic int 36553541Sshinin6_mtuexpire(struct radix_node *rn, void *rock) 36653541Sshin{ 36753541Sshin struct rtentry *rt = (struct rtentry *)rn; 36853541Sshin struct mtuex_arg *ap = rock; 36953541Sshin 37053541Sshin /* sanity */ 37153541Sshin if (!rt) 37253541Sshin panic("rt == NULL in in6_mtuexpire"); 37353541Sshin 37453541Sshin if (rt->rt_rmx.rmx_expire && !(rt->rt_flags & RTF_PROBEMTU)) { 375150351Sandre if (rt->rt_rmx.rmx_expire <= time_uptime) { 37653541Sshin rt->rt_flags |= RTF_PROBEMTU; 37753541Sshin } else { 37853541Sshin ap->nextstop = lmin(ap->nextstop, 37953541Sshin rt->rt_rmx.rmx_expire); 38053541Sshin } 38153541Sshin } 38253541Sshin 38353541Sshin return 0; 38453541Sshin} 38553541Sshin 38653541Sshin#define MTUTIMO_DEFAULT (60*1) 38753541Sshin 38853541Sshinstatic void 389231852Sbzin6_mtutimo_one(struct radix_node_head *rnh) 39053541Sshin{ 39153541Sshin struct mtuex_arg arg; 39253541Sshin 39353541Sshin arg.rnh = rnh; 394160123Soleg arg.nextstop = time_uptime + MTUTIMO_DEFAULT; 395108250Shsu RADIX_NODE_HEAD_LOCK(rnh); 39653541Sshin rnh->rnh_walktree(rnh, in6_mtuexpire, &arg); 397108250Shsu RADIX_NODE_HEAD_UNLOCK(rnh); 398231852Sbz} 39953541Sshin 400231852Sbzstatic void 401231852Sbzin6_mtutimo(void *rock) 402231852Sbz{ 403231852Sbz CURVNET_SET_QUIET((struct vnet *) rock); 404231852Sbz struct radix_node_head *rnh; 405231852Sbz struct timeval atv; 406231852Sbz u_int fibnum; 407231852Sbz 408231852Sbz for (fibnum = 0; fibnum < rt_numfibs; fibnum++) { 409231852Sbz rnh = rt_tables_get_rnh(fibnum, AF_INET6); 410231852Sbz if (rnh != NULL) 411231852Sbz in6_mtutimo_one(rnh); 412231852Sbz } 413231852Sbz 414231852Sbz atv.tv_sec = MTUTIMO_DEFAULT; 41553541Sshin atv.tv_usec = 0; 416181803Sbz callout_reset(&V_rtq_mtutimer, tvtohz(&atv), in6_mtutimo, rock); 417183550Szec CURVNET_RESTORE(); 41853541Sshin} 41953541Sshin 42053541Sshin/* 42153541Sshin * Initialize our routing tree. 422178888Sjulian * XXX MRT When off == 0, we are being called from vfs_export.c 423178888Sjulian * so just set up their table and leave. (we know what the correct 424178888Sjulian * value should be so just use that).. FIX AFTER RELENG_7 is MFC'd 425178888Sjulian * see also comments in in_inithead() vfs_export.c and domain.h 42653541Sshin */ 427231852Sbzstatic VNET_DEFINE(int, _in6_rt_was_here); 428231852Sbz#define V__in6_rt_was_here VNET(_in6_rt_was_here) 429231852Sbz 43053541Sshinint 43153541Sshinin6_inithead(void **head, int off) 43253541Sshin{ 43353541Sshin struct radix_node_head *rnh; 43453541Sshin 435178888Sjulian if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3)) 436178888Sjulian return 0; /* See above */ 43753541Sshin 438178888Sjulian if (off == 0) /* See above */ 439178888Sjulian return 1; /* only do the rest for the real thing */ 44053541Sshin 44153541Sshin rnh = *head; 44253541Sshin rnh->rnh_addaddr = in6_addroute; 44353541Sshin rnh->rnh_matchaddr = in6_matroute; 444231852Sbz 445231852Sbz if (V__in6_rt_was_here == 0) { 446231852Sbz callout_init(&V_rtq_timer6, CALLOUT_MPSAFE); 447231852Sbz callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE); 448231852Sbz in6_rtqtimo(curvnet); /* kick off timeout first time */ 449231852Sbz in6_mtutimo(curvnet); /* kick off timeout first time */ 450231852Sbz V__in6_rt_was_here = 1; 451231852Sbz } 452231852Sbz 45353541Sshin return 1; 45453541Sshin} 455193731Szec 456193731Szec#ifdef VIMAGE 457193731Szecint 458193731Szecin6_detachhead(void **head, int off) 459193731Szec{ 460193731Szec 461193731Szec callout_drain(&V_rtq_timer6); 462193731Szec callout_drain(&V_rtq_mtutimer); 463193731Szec return (1); 464193731Szec} 465193731Szec#endif 466231852Sbz 467231852Sbz/* 468231852Sbz * Extended API for IPv6 FIB support. 469231852Sbz */ 470231852Sbzvoid 471231852Sbzin6_rtredirect(struct sockaddr *dst, struct sockaddr *gw, struct sockaddr *nm, 472231852Sbz int flags, struct sockaddr *src, u_int fibnum) 473231852Sbz{ 474231852Sbz 475231852Sbz rtredirect_fib(dst, gw, nm, flags, src, fibnum); 476231852Sbz} 477231852Sbz 478231852Sbzint 479231852Sbzin6_rtrequest(int req, struct sockaddr *dst, struct sockaddr *gw, 480231852Sbz struct sockaddr *mask, int flags, struct rtentry **ret_nrt, u_int fibnum) 481231852Sbz{ 482231852Sbz 483231852Sbz return (rtrequest_fib(req, dst, gw, mask, flags, ret_nrt, fibnum)); 484231852Sbz} 485231852Sbz 486231852Sbzvoid 487231852Sbzin6_rtalloc(struct route_in6 *ro, u_int fibnum) 488231852Sbz{ 489231852Sbz 490231852Sbz rtalloc_ign_fib((struct route *)ro, 0ul, fibnum); 491231852Sbz} 492231852Sbz 493231852Sbzvoid 494231852Sbzin6_rtalloc_ign(struct route_in6 *ro, u_long ignflags, u_int fibnum) 495231852Sbz{ 496231852Sbz 497231852Sbz rtalloc_ign_fib((struct route *)ro, ignflags, fibnum); 498231852Sbz} 499231852Sbz 500231852Sbzstruct rtentry * 501231852Sbzin6_rtalloc1(struct sockaddr *dst, int report, u_long ignflags, u_int fibnum) 502231852Sbz{ 503231852Sbz 504231852Sbz return (rtalloc1_fib(dst, report, ignflags, fibnum)); 505231852Sbz} 506