in6_rmx.c (191816) | in6_rmx.c (193232) |
---|---|
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 191816 2009-05-05 10:56:12Z zec $"); | 76__FBSDID("$FreeBSD: head/sys/netinet6/in6_rmx.c 193232 2009-06-01 15:49:42Z bz $"); |
77 78#include "opt_route.h" 79 80#include <sys/param.h> 81#include <sys/systm.h> 82#include <sys/kernel.h> 83#include <sys/lock.h> 84#include <sys/sysctl.h> --- 199 unchanged lines hidden (view full) --- 284static int rtq_timeout6; 285static struct callout rtq_timer6; 286#endif 287 288static void 289in6_rtqtimo(void *rock) 290{ 291 CURVNET_SET_QUIET((struct vnet *) rock); | 77 78#include "opt_route.h" 79 80#include <sys/param.h> 81#include <sys/systm.h> 82#include <sys/kernel.h> 83#include <sys/lock.h> 84#include <sys/sysctl.h> --- 199 unchanged lines hidden (view full) --- 284static int rtq_timeout6; 285static struct callout rtq_timer6; 286#endif 287 288static void 289in6_rtqtimo(void *rock) 290{ 291 CURVNET_SET_QUIET((struct vnet *) rock); |
292 INIT_VNET_NET(curvnet); | |
293 INIT_VNET_INET6(curvnet); | 292 INIT_VNET_INET6(curvnet); |
294 struct radix_node_head *rnh = V_rt_tables[0][AF_INET6]; | 293 struct radix_node_head *rnh; |
295 struct rtqk_arg arg; 296 struct timeval atv; 297 static time_t last_adjusted_timeout = 0; 298 | 294 struct rtqk_arg arg; 295 struct timeval atv; 296 static time_t last_adjusted_timeout = 0; 297 |
298 rnh = rt_tables_get_rnh(0, AF_INET6); 299 if (rnh == NULL) { 300 CURVNET_RESTORE(); 301 return; 302 } |
|
299 arg.found = arg.killed = 0; 300 arg.rnh = rnh; 301 arg.nextstop = time_uptime + V_rtq_timeout6; 302 arg.draining = arg.updating = 0; 303 RADIX_NODE_HEAD_LOCK(rnh); 304 rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 305 RADIX_NODE_HEAD_UNLOCK(rnh); 306 --- 65 unchanged lines hidden (view full) --- 372} 373 374#define MTUTIMO_DEFAULT (60*1) 375 376static void 377in6_mtutimo(void *rock) 378{ 379 CURVNET_SET_QUIET((struct vnet *) rock); | 303 arg.found = arg.killed = 0; 304 arg.rnh = rnh; 305 arg.nextstop = time_uptime + V_rtq_timeout6; 306 arg.draining = arg.updating = 0; 307 RADIX_NODE_HEAD_LOCK(rnh); 308 rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 309 RADIX_NODE_HEAD_UNLOCK(rnh); 310 --- 65 unchanged lines hidden (view full) --- 376} 377 378#define MTUTIMO_DEFAULT (60*1) 379 380static void 381in6_mtutimo(void *rock) 382{ 383 CURVNET_SET_QUIET((struct vnet *) rock); |
380 INIT_VNET_NET(curvnet); | |
381 INIT_VNET_INET6(curvnet); | 384 INIT_VNET_INET6(curvnet); |
382 struct radix_node_head *rnh = V_rt_tables[0][AF_INET6]; | 385 struct radix_node_head *rnh; |
383 struct mtuex_arg arg; 384 struct timeval atv; 385 | 386 struct mtuex_arg arg; 387 struct timeval atv; 388 |
389 rnh = rt_tables_get_rnh(0, AF_INET6); 390 if (rnh == NULL) { 391 CURVNET_RESTORE(); 392 return; 393 } |
|
386 arg.rnh = rnh; 387 arg.nextstop = time_uptime + MTUTIMO_DEFAULT; 388 RADIX_NODE_HEAD_LOCK(rnh); 389 rnh->rnh_walktree(rnh, in6_mtuexpire, &arg); 390 RADIX_NODE_HEAD_UNLOCK(rnh); 391 392 atv.tv_usec = 0; 393 atv.tv_sec = arg.nextstop - time_uptime; --- 6 unchanged lines hidden (view full) --- 400 CURVNET_RESTORE(); 401} 402 403#if 0 404void 405in6_rtqdrain(void) 406{ 407 INIT_VNET_NET(curvnet); | 394 arg.rnh = rnh; 395 arg.nextstop = time_uptime + MTUTIMO_DEFAULT; 396 RADIX_NODE_HEAD_LOCK(rnh); 397 rnh->rnh_walktree(rnh, in6_mtuexpire, &arg); 398 RADIX_NODE_HEAD_UNLOCK(rnh); 399 400 atv.tv_usec = 0; 401 atv.tv_sec = arg.nextstop - time_uptime; --- 6 unchanged lines hidden (view full) --- 408 CURVNET_RESTORE(); 409} 410 411#if 0 412void 413in6_rtqdrain(void) 414{ 415 INIT_VNET_NET(curvnet); |
408 struct radix_node_head *rnh = V_rt_tables[0][AF_INET6]; | 416 struct radix_node_head *rnh; |
409 struct rtqk_arg arg; 410 | 417 struct rtqk_arg arg; 418 |
419 rnh = rt_tables_get_rnh(0, AF_INET6); 420 if (rnh == NULL) 421 panic("%s: rnh == NULL", __func__); |
|
411 arg.found = arg.killed = 0; 412 arg.rnh = rnh; 413 arg.nextstop = 0; 414 arg.draining = 1; 415 arg.updating = 0; 416 RADIX_NODE_HEAD_LOCK(rnh); 417 rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 418 RADIX_NODE_HEAD_UNLOCK(rnh); --- 5 unchanged lines hidden (view full) --- 424 * XXX MRT When off == 0, we are being called from vfs_export.c 425 * so just set up their table and leave. (we know what the correct 426 * value should be so just use that).. FIX AFTER RELENG_7 is MFC'd 427 * see also comments in in_inithead() vfs_export.c and domain.h 428 */ 429int 430in6_inithead(void **head, int off) 431{ | 422 arg.found = arg.killed = 0; 423 arg.rnh = rnh; 424 arg.nextstop = 0; 425 arg.draining = 1; 426 arg.updating = 0; 427 RADIX_NODE_HEAD_LOCK(rnh); 428 rnh->rnh_walktree(rnh, in6_rtqkill, &arg); 429 RADIX_NODE_HEAD_UNLOCK(rnh); --- 5 unchanged lines hidden (view full) --- 435 * XXX MRT When off == 0, we are being called from vfs_export.c 436 * so just set up their table and leave. (we know what the correct 437 * value should be so just use that).. FIX AFTER RELENG_7 is MFC'd 438 * see also comments in in_inithead() vfs_export.c and domain.h 439 */ 440int 441in6_inithead(void **head, int off) 442{ |
432#ifdef INVARIANTS 433 INIT_VNET_NET(curvnet); 434#endif | |
435 INIT_VNET_INET6(curvnet); 436 struct radix_node_head *rnh; 437 438 if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3)) 439 return 0; /* See above */ 440 441 if (off == 0) /* See above */ 442 return 1; /* only do the rest for the real thing */ 443 444 V_rtq_reallyold6 = 60*60; /* one hour is ``really old'' */ 445 V_rtq_minreallyold6 = 10; /* never automatically crank down to less */ 446 V_rtq_toomany6 = 128; /* 128 cached routes is ``too many'' */ 447 V_rtq_timeout6 = RTQ_TIMEOUT; 448 449 rnh = *head; | 443 INIT_VNET_INET6(curvnet); 444 struct radix_node_head *rnh; 445 446 if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3)) 447 return 0; /* See above */ 448 449 if (off == 0) /* See above */ 450 return 1; /* only do the rest for the real thing */ 451 452 V_rtq_reallyold6 = 60*60; /* one hour is ``really old'' */ 453 V_rtq_minreallyold6 = 10; /* never automatically crank down to less */ 454 V_rtq_toomany6 = 128; /* 128 cached routes is ``too many'' */ 455 V_rtq_timeout6 = RTQ_TIMEOUT; 456 457 rnh = *head; |
450 KASSERT(rnh == V_rt_tables[0][AF_INET6], ("rnh?")); | 458 KASSERT(rnh == rt_tables_get_rnh(0, AF_INET6), ("rnh?")); |
451 rnh->rnh_addaddr = in6_addroute; 452 rnh->rnh_matchaddr = in6_matroute; 453 callout_init(&V_rtq_timer6, CALLOUT_MPSAFE); 454 callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE); 455 in6_rtqtimo(curvnet); /* kick off timeout first time */ 456 in6_mtutimo(curvnet); /* kick off timeout first time */ 457 return 1; 458} | 459 rnh->rnh_addaddr = in6_addroute; 460 rnh->rnh_matchaddr = in6_matroute; 461 callout_init(&V_rtq_timer6, CALLOUT_MPSAFE); 462 callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE); 463 in6_rtqtimo(curvnet); /* kick off timeout first time */ 464 in6_mtutimo(curvnet); /* kick off timeout first time */ 465 return 1; 466} |