Deleted Added
sdiff udiff text old ( 196019 ) new ( 207369 )
full compact
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 $");
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
211#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
218SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW,
219 &VNET_NAME(rtq_minreallyold6) , 0, "");
220
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 */
280static VNET_DEFINE(int, rtq_timeout6);
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};
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
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 ---