diff options
author | wollman <wollman@FreeBSD.org> | 1995-01-23 02:02:50 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-01-23 02:02:50 +0000 |
commit | 07d192a9fb3aa1cc5911cab5a483a95ec9a8511b (patch) | |
tree | 2aad0a14dc44567bed7a81edb8381fcf4e7efdd1 /sys/netinet/in_rmx.c | |
parent | 8420966a4f917f55b78f5b1cb4e3666d7f2c4543 (diff) | |
download | FreeBSD-src-07d192a9fb3aa1cc5911cab5a483a95ec9a8511b.zip FreeBSD-src-07d192a9fb3aa1cc5911cab5a483a95ec9a8511b.tar.gz |
Change caching strategy somewhat:
1) Don't clone routes to multicast destinations; there is nothing useful
to be gained in this case.
2) Reduce default expiration timer to one hour. Busy sites will still
likely want to reduce this, but for ordinary users this is a reasonable
value to use.
Diffstat (limited to 'sys/netinet/in_rmx.c')
-rw-r--r-- | sys/netinet/in_rmx.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c index a007f71..25fec74 100644 --- a/sys/netinet/in_rmx.c +++ b/sys/netinet/in_rmx.c @@ -4,7 +4,7 @@ * You may copy this file verbatim until I find the official * Institute boilerplate. * - * $Id: in_rmx.c,v 1.6 1994/12/13 22:32:45 wollman Exp $ + * $Id: in_rmx.c,v 1.7 1994/12/21 17:25:52 wollman Exp $ */ /* @@ -45,13 +45,16 @@ in_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, struct radix_node *treenodes) { struct rtentry *rt = (struct rtentry *)treenodes; - struct in_rtq *inr; /* - * For IP, all non-host routes are automatically cloning. + * For IP, all unicast non-host routes are automatically cloning. */ - if(!(rt->rt_flags & (RTF_HOST | RTF_CLONING))) - rt->rt_flags |= RTF_PRCLONING; + if(!(rt->rt_flags & (RTF_HOST | RTF_CLONING))) { + struct sockaddr_in *sin = (struct sockaddr_in *)rt_key(rt); + if(!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) { + rt->rt_flags |= RTF_PRCLONING; + } + } return rn_addroute(v_arg, n_arg, head, treenodes); } @@ -76,19 +79,21 @@ in_matroute(void *v_arg, struct radix_node_head *head) return rn; } -#define RTQ_REALLYOLD 4*60*60 /* four hours is ``really old'' */ +#define RTQ_REALLYOLD 60*60 /* one hour is ``really old'' */ int rtq_reallyold = RTQ_REALLYOLD; /* - * On last reference drop, add the route to the queue so that it can be + * On last reference drop, mark the route as belong to us so that it can be * timed out. */ static void in_clsroute(struct radix_node *rn, struct radix_node_head *head) { struct rtentry *rt = (struct rtentry *)rn; - struct in_rtq *inr; + if(!(rt->rt_flags & RTF_UP)) + return; /* prophylactic measures */ + if((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) return; @@ -100,9 +105,6 @@ in_clsroute(struct radix_node *rn, struct radix_node_head *head) rt->rt_rmx.rmx_expire = time.tv_sec + rtq_reallyold; } -#define RTQ_TIMEOUT 60 /* run once a minute */ -int rtq_timeout = RTQ_TIMEOUT; - struct rtqk_arg { struct radix_node_head *rnh; int draining; @@ -148,6 +150,9 @@ in_rtqkill(struct radix_node *rn, void *rock) return 0; } +#define RTQ_TIMEOUT 600 /* run no less than once every ten minutes */ +int rtq_timeout = RTQ_TIMEOUT; + static void in_rtqtimo(void *rock) { @@ -158,7 +163,7 @@ in_rtqtimo(void *rock) arg.found = arg.killed = 0; arg.rnh = rnh; - arg.nextstop = time.tv_sec + 10*rtq_timeout; + arg.nextstop = time.tv_sec + rtq_timeout; arg.draining = 0; s = splnet(); rnh->rnh_walktree(rnh, in_rtqkill, &arg); |