Deleted Added
full compact
in6_rmx.c (186119) in6_rmx.c (186215)
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 186119 2008-12-15 06:10:57Z qingli $");
76__FBSDID("$FreeBSD: head/sys/netinet6/in6_rmx.c 186215 2008-12-17 10:03:49Z qingli $");
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>

--- 130 unchanged lines hidden (view full) ---

215
216SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMINEXPIRE,
217 rtminexpire, CTLFLAG_RW, rtq_minreallyold6 , 0, "");
218
219SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMAXCACHE,
220 rtmaxcache, CTLFLAG_RW, rtq_toomany6 , 0, "");
221
222
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>

--- 130 unchanged lines hidden (view full) ---

215
216SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMINEXPIRE,
217 rtminexpire, CTLFLAG_RW, rtq_minreallyold6 , 0, "");
218
219SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMAXCACHE,
220 rtmaxcache, CTLFLAG_RW, rtq_toomany6 , 0, "");
221
222
223/*
224 * On last reference drop, mark the route as belong to us so that it can be
225 * timed out.
226 */
227static void
228in6_clsroute(struct radix_node *rn, struct radix_node_head *head)
229{
230 INIT_VNET_INET6(curvnet);
231 struct rtentry *rt = (struct rtentry *)rn;
232
223
233 RT_LOCK_ASSERT(rt);
234
235 if (!(rt->rt_flags & RTF_UP))
236 return; /* prophylactic measures */
237
238 /*
239 * As requested by David Greenman:
240 * If rtq_reallyold6 is 0, just delete the route without
241 * waiting for a timeout cycle to kill it.
242 */
243 if (V_rtq_reallyold6 != 0) {
244 rt->rt_flags |= RTPRF_OURS;
245 rt->rt_rmx.rmx_expire = time_uptime + V_rtq_reallyold6;
246 } else {
247 rtexpunge(rt);
248 }
249}
250
251struct rtqk_arg {
252 struct radix_node_head *rnh;
253 int mode;
254 int updating;
255 int draining;
256 int killed;
257 int found;
258 time_t nextstop;

--- 205 unchanged lines hidden (view full) ---

464 V_rtq_reallyold6 = 60*60; /* one hour is ``really old'' */
465 V_rtq_minreallyold6 = 10; /* never automatically crank down to less */
466 V_rtq_toomany6 = 128; /* 128 cached routes is ``too many'' */
467 V_rtq_timeout6 = RTQ_TIMEOUT;
468
469 rnh = *head;
470 rnh->rnh_addaddr = in6_addroute;
471 rnh->rnh_matchaddr = in6_matroute;
224struct rtqk_arg {
225 struct radix_node_head *rnh;
226 int mode;
227 int updating;
228 int draining;
229 int killed;
230 int found;
231 time_t nextstop;

--- 205 unchanged lines hidden (view full) ---

437 V_rtq_reallyold6 = 60*60; /* one hour is ``really old'' */
438 V_rtq_minreallyold6 = 10; /* never automatically crank down to less */
439 V_rtq_toomany6 = 128; /* 128 cached routes is ``too many'' */
440 V_rtq_timeout6 = RTQ_TIMEOUT;
441
442 rnh = *head;
443 rnh->rnh_addaddr = in6_addroute;
444 rnh->rnh_matchaddr = in6_matroute;
472 rnh->rnh_close = in6_clsroute;
473 callout_init(&V_rtq_timer6, CALLOUT_MPSAFE);
474 in6_rtqtimo(rnh); /* kick off timeout first time */
475 callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE);
476 in6_mtutimo(rnh); /* kick off timeout first time */
477 return 1;
478}
445 callout_init(&V_rtq_timer6, CALLOUT_MPSAFE);
446 in6_rtqtimo(rnh); /* kick off timeout first time */
447 callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE);
448 in6_mtutimo(rnh); /* kick off timeout first time */
449 return 1;
450}