in_rmx.c (215317) | in_rmx.c (215701) |
---|---|
1/*- 2 * Copyright 1994, 1995 Massachusetts Institute of Technology 3 * 4 * Permission to use, copy, modify, and distribute this software and 5 * its documentation for any purpose and without fee is hereby 6 * granted, provided that both the above copyright notice and this 7 * permission notice appear in all copies, that both the above 8 * copyright notice and this permission notice appear in all --- 27 unchanged lines hidden (view full) --- 36 * requested. 37 * 2) When such routes lose all their references, it arranges for them 38 * to be deleted in some random collection of circumstances, so that 39 * a large quantity of stale routing data is not kept in kernel memory 40 * indefinitely. See in_rtqtimo() below for the exact mechanism. 41 */ 42 43#include <sys/cdefs.h> | 1/*- 2 * Copyright 1994, 1995 Massachusetts Institute of Technology 3 * 4 * Permission to use, copy, modify, and distribute this software and 5 * its documentation for any purpose and without fee is hereby 6 * granted, provided that both the above copyright notice and this 7 * permission notice appear in all copies, that both the above 8 * copyright notice and this permission notice appear in all --- 27 unchanged lines hidden (view full) --- 36 * requested. 37 * 2) When such routes lose all their references, it arranges for them 38 * to be deleted in some random collection of circumstances, so that 39 * a large quantity of stale routing data is not kept in kernel memory 40 * indefinitely. See in_rtqtimo() below for the exact mechanism. 41 */ 42 43#include <sys/cdefs.h> |
44__FBSDID("$FreeBSD: head/sys/netinet/in_rmx.c 215317 2010-11-14 20:38:11Z dim $"); | 44__FBSDID("$FreeBSD: head/sys/netinet/in_rmx.c 215701 2010-11-22 19:32:54Z dim $"); |
45 46#include <sys/param.h> 47#include <sys/systm.h> 48#include <sys/kernel.h> 49#include <sys/sysctl.h> 50#include <sys/socket.h> 51#include <sys/mbuf.h> 52#include <sys/syslog.h> --- 74 unchanged lines hidden (view full) --- 127 rt->rt_flags &= ~RTPRF_OURS; 128 rt->rt_rmx.rmx_expire = 0; 129 } 130 RT_UNLOCK(rt); 131 } 132 return rn; 133} 134 | 45 46#include <sys/param.h> 47#include <sys/systm.h> 48#include <sys/kernel.h> 49#include <sys/sysctl.h> 50#include <sys/socket.h> 51#include <sys/mbuf.h> 52#include <sys/syslog.h> --- 74 unchanged lines hidden (view full) --- 127 rt->rt_flags &= ~RTPRF_OURS; 128 rt->rt_rmx.rmx_expire = 0; 129 } 130 RT_UNLOCK(rt); 131 } 132 return rn; 133} 134 |
135STATIC_VNET_DEFINE(int, rtq_reallyold) = 60*60; /* one hour is "really old" */ | 135static VNET_DEFINE(int, rtq_reallyold) = 60*60; /* one hour is "really old" */ |
136#define V_rtq_reallyold VNET(rtq_reallyold) 137SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTEXPIRE, rtexpire, CTLFLAG_RW, 138 &VNET_NAME(rtq_reallyold), 0, 139 "Default expiration time on dynamically learned routes"); 140 141/* never automatically crank down to less */ | 136#define V_rtq_reallyold VNET(rtq_reallyold) 137SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTEXPIRE, rtexpire, CTLFLAG_RW, 138 &VNET_NAME(rtq_reallyold), 0, 139 "Default expiration time on dynamically learned routes"); 140 141/* never automatically crank down to less */ |
142STATIC_VNET_DEFINE(int, rtq_minreallyold) = 10; | 142static VNET_DEFINE(int, rtq_minreallyold) = 10; |
143#define V_rtq_minreallyold VNET(rtq_minreallyold) 144SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, 145 &VNET_NAME(rtq_minreallyold), 0, 146 "Minimum time to attempt to hold onto dynamically learned routes"); 147 148/* 128 cached routes is "too many" */ | 143#define V_rtq_minreallyold VNET(rtq_minreallyold) 144SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, 145 &VNET_NAME(rtq_minreallyold), 0, 146 "Minimum time to attempt to hold onto dynamically learned routes"); 147 148/* 128 cached routes is "too many" */ |
149STATIC_VNET_DEFINE(int, rtq_toomany) = 128; | 149static VNET_DEFINE(int, rtq_toomany) = 128; |
150#define V_rtq_toomany VNET(rtq_toomany) 151SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW, 152 &VNET_NAME(rtq_toomany), 0, 153 "Upper limit on dynamically learned routes"); 154 155/* 156 * On last reference drop, mark the route as belong to us so that it can be 157 * timed out. --- 77 unchanged lines hidden (view full) --- 235 rt->rt_rmx.rmx_expire); 236 } 237 } 238 239 return 0; 240} 241 242#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ | 150#define V_rtq_toomany VNET(rtq_toomany) 151SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW, 152 &VNET_NAME(rtq_toomany), 0, 153 "Upper limit on dynamically learned routes"); 154 155/* 156 * On last reference drop, mark the route as belong to us so that it can be 157 * timed out. --- 77 unchanged lines hidden (view full) --- 235 rt->rt_rmx.rmx_expire); 236 } 237 } 238 239 return 0; 240} 241 242#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ |
243STATIC_VNET_DEFINE(int, rtq_timeout) = RTQ_TIMEOUT; 244STATIC_VNET_DEFINE(struct callout, rtq_timer); | 243static VNET_DEFINE(int, rtq_timeout) = RTQ_TIMEOUT; 244static VNET_DEFINE(struct callout, rtq_timer); |
245 246#define V_rtq_timeout VNET(rtq_timeout) 247#define V_rtq_timer VNET(rtq_timer) 248 249static void in_rtqtimo_one(void *rock); 250 251static void 252in_rtqtimo(void *rock) --- 262 unchanged lines hidden --- | 245 246#define V_rtq_timeout VNET(rtq_timeout) 247#define V_rtq_timer VNET(rtq_timer) 248 249static void in_rtqtimo_one(void *rock); 250 251static void 252in_rtqtimo(void *rock) --- 262 unchanged lines hidden --- |