in6_rmx.c (196019) | in6_rmx.c (207369) |
---|---|
1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 59 unchanged lines hidden (view full) --- 68 * requested. 69 * 2) When such routes lose all their references, it arranges for them 70 * to be deleted in some random collection of circumstances, so that 71 * a large quantity of stale routing data is not kept in kernel memory 72 * indefinitely. See in6_rtqtimo() below for the exact mechanism. 73 */ 74 75#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 59 unchanged lines hidden (view full) --- 68 * requested. 69 * 2) When such routes lose all their references, it arranges for them 70 * to be deleted in some random collection of circumstances, so that 71 * a large quantity of stale routing data is not kept in kernel memory 72 * indefinitely. See in6_rtqtimo() below for the exact mechanism. 73 */ 74 75#include <sys/cdefs.h> |
76__FBSDID("$FreeBSD: head/sys/netinet6/in6_rmx.c 196019 2009-08-01 19:26:27Z rwatson $"); | 76__FBSDID("$FreeBSD: head/sys/netinet6/in6_rmx.c 207369 2010-04-29 11:52:42Z bz $"); |
77 78#include <sys/param.h> 79#include <sys/systm.h> 80#include <sys/kernel.h> 81#include <sys/lock.h> 82#include <sys/sysctl.h> 83#include <sys/queue.h> 84#include <sys/socket.h> --- 114 unchanged lines hidden (view full) --- 199 rt->rt_rmx.rmx_expire = 0; 200 } 201 } 202 return rn; 203} 204 205SYSCTL_DECL(_net_inet6_ip6); 206 | 77 78#include <sys/param.h> 79#include <sys/systm.h> 80#include <sys/kernel.h> 81#include <sys/lock.h> 82#include <sys/sysctl.h> 83#include <sys/queue.h> 84#include <sys/socket.h> --- 114 unchanged lines hidden (view full) --- 199 rt->rt_rmx.rmx_expire = 0; 200 } 201 } 202 return rn; 203} 204 205SYSCTL_DECL(_net_inet6_ip6); 206 |
207static VNET_DEFINE(int, rtq_reallyold6); 208static VNET_DEFINE(int, rtq_minreallyold6); 209static VNET_DEFINE(int, rtq_toomany6); 210 | 207static VNET_DEFINE(int, rtq_reallyold6) = 60*60; 208 /* one hour is ``really old'' */ |
211#define V_rtq_reallyold6 VNET(rtq_reallyold6) | 209#define V_rtq_reallyold6 VNET(rtq_reallyold6) |
212#define V_rtq_minreallyold6 VNET(rtq_minreallyold6) 213#define V_rtq_toomany6 VNET(rtq_toomany6) 214 | |
215SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, CTLFLAG_RW, 216 &VNET_NAME(rtq_reallyold6) , 0, ""); 217 | 210SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, CTLFLAG_RW, 211 &VNET_NAME(rtq_reallyold6) , 0, ""); 212 |
213static VNET_DEFINE(int, rtq_minreallyold6) = 10; 214 /* never automatically crank down to less */ 215#define V_rtq_minreallyold6 VNET(rtq_minreallyold6) |
|
218SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, 219 &VNET_NAME(rtq_minreallyold6) , 0, ""); 220 | 216SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, 217 &VNET_NAME(rtq_minreallyold6) , 0, ""); 218 |
219static VNET_DEFINE(int, rtq_toomany6) = 128; 220 /* 128 cached routes is ``too many'' */ 221#define V_rtq_toomany6 VNET(rtq_toomany6) |
|
221SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW, 222 &VNET_NAME(rtq_toomany6) , 0, ""); 223 224struct rtqk_arg { 225 struct radix_node_head *rnh; 226 int mode; 227 int updating; 228 int draining; --- 43 unchanged lines hidden (view full) --- 272 rt->rt_rmx.rmx_expire); 273 } 274 } 275 276 return 0; 277} 278 279#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ | 222SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW, 223 &VNET_NAME(rtq_toomany6) , 0, ""); 224 225struct rtqk_arg { 226 struct radix_node_head *rnh; 227 int mode; 228 int updating; 229 int draining; --- 43 unchanged lines hidden (view full) --- 273 rt->rt_rmx.rmx_expire); 274 } 275 } 276 277 return 0; 278} 279 280#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ |
280static VNET_DEFINE(int, rtq_timeout6); | 281static VNET_DEFINE(int, rtq_timeout6) = RTQ_TIMEOUT; |
281static VNET_DEFINE(struct callout, rtq_timer6); 282 283#define V_rtq_timeout6 VNET(rtq_timeout6) 284#define V_rtq_timer6 VNET(rtq_timer6) 285 286static void 287in6_rtqtimo(void *rock) 288{ --- 52 unchanged lines hidden (view full) --- 341 342/* 343 * Age old PMTUs. 344 */ 345struct mtuex_arg { 346 struct radix_node_head *rnh; 347 time_t nextstop; 348}; | 282static VNET_DEFINE(struct callout, rtq_timer6); 283 284#define V_rtq_timeout6 VNET(rtq_timeout6) 285#define V_rtq_timer6 VNET(rtq_timer6) 286 287static void 288in6_rtqtimo(void *rock) 289{ --- 52 unchanged lines hidden (view full) --- 342 343/* 344 * Age old PMTUs. 345 */ 346struct mtuex_arg { 347 struct radix_node_head *rnh; 348 time_t nextstop; 349}; |
349 | |
350static VNET_DEFINE(struct callout, rtq_mtutimer); 351#define V_rtq_mtutimer VNET(rtq_mtutimer) 352 353static int 354in6_mtuexpire(struct radix_node *rn, void *rock) 355{ 356 struct rtentry *rt = (struct rtentry *)rn; 357 struct mtuex_arg *ap = rock; --- 59 unchanged lines hidden (view full) --- 417 struct radix_node_head *rnh; 418 419 if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3)) 420 return 0; /* See above */ 421 422 if (off == 0) /* See above */ 423 return 1; /* only do the rest for the real thing */ 424 | 350static VNET_DEFINE(struct callout, rtq_mtutimer); 351#define V_rtq_mtutimer VNET(rtq_mtutimer) 352 353static int 354in6_mtuexpire(struct radix_node *rn, void *rock) 355{ 356 struct rtentry *rt = (struct rtentry *)rn; 357 struct mtuex_arg *ap = rock; --- 59 unchanged lines hidden (view full) --- 417 struct radix_node_head *rnh; 418 419 if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3)) 420 return 0; /* See above */ 421 422 if (off == 0) /* See above */ 423 return 1; /* only do the rest for the real thing */ 424 |
425 V_rtq_reallyold6 = 60*60; /* one hour is ``really old'' */ 426 V_rtq_minreallyold6 = 10; /* never automatically crank down to less */ 427 V_rtq_toomany6 = 128; /* 128 cached routes is ``too many'' */ 428 V_rtq_timeout6 = RTQ_TIMEOUT; 429 | |
430 rnh = *head; 431 KASSERT(rnh == rt_tables_get_rnh(0, AF_INET6), ("rnh?")); 432 rnh->rnh_addaddr = in6_addroute; 433 rnh->rnh_matchaddr = in6_matroute; 434 callout_init(&V_rtq_timer6, CALLOUT_MPSAFE); 435 callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE); 436 in6_rtqtimo(curvnet); /* kick off timeout first time */ 437 in6_mtutimo(curvnet); /* kick off timeout first time */ --- 13 unchanged lines hidden --- | 425 rnh = *head; 426 KASSERT(rnh == rt_tables_get_rnh(0, AF_INET6), ("rnh?")); 427 rnh->rnh_addaddr = in6_addroute; 428 rnh->rnh_matchaddr = in6_matroute; 429 callout_init(&V_rtq_timer6, CALLOUT_MPSAFE); 430 callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE); 431 in6_rtqtimo(curvnet); /* kick off timeout first time */ 432 in6_mtutimo(curvnet); /* kick off timeout first time */ --- 13 unchanged lines hidden --- |