Save some rtcache_getrt() calls.

This commit is contained in:
dyoung 2008-01-10 08:06:11 +00:00
parent a91969dd88
commit 45485bd0b7
3 changed files with 11 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_pcb.c,v 1.91 2007/12/20 19:53:33 dyoung Exp $ */
/* $NetBSD: in6_pcb.c,v 1.92 2008/01/10 08:06:11 dyoung Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.91 2007/12/20 19:53:33 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.92 2008/01/10 08:06:11 dyoung Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -953,7 +953,7 @@ in6_pcbrtentry(struct in6pcb *in6p)
sockaddr_in_init(&u.dst4, &addr, 0);
rtcache_setdst(ro, &u.dst);
rtcache_init(ro);
rt = rtcache_init(ro);
} else
#endif
if (rt == NULL && !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) {
@ -965,9 +965,9 @@ in6_pcbrtentry(struct in6pcb *in6p)
sockaddr_in6_init(&u.dst6, &in6p->in6p_faddr, 0, 0, 0);
rtcache_setdst(ro, &u.dst);
rtcache_init(ro);
rt = rtcache_init(ro);
}
return rtcache_getrt(ro);
return rt;
}
struct in6pcb *

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_forward.c,v 1.59 2007/12/20 19:53:33 dyoung Exp $ */
/* $NetBSD: ip6_forward.c,v 1.60 2008/01/10 08:06:12 dyoung Exp $ */
/* $KAME: ip6_forward.c,v 1.109 2002/09/11 08:10:17 sakane Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.59 2007/12/20 19:53:33 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.60 2008/01/10 08:06:12 dyoung Exp $");
#include "opt_ipsec.h"
#include "opt_pfil_hooks.h"
@ -367,9 +367,7 @@ ip6_forward(struct mbuf *m, int srcrt)
*/
rtcache_check(&ip6_forward_rt);
if (rtcache_getrt(&ip6_forward_rt) == NULL) {
rtcache_init(&ip6_forward_rt);
if (rtcache_getrt(&ip6_forward_rt) == NULL) {
if (rtcache_init(&ip6_forward_rt) == NULL) {
ip6stat.ip6s_noroute++;
/* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_noroute) */
if (mcopy) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_output.c,v 1.124 2007/12/20 19:53:34 dyoung Exp $ */
/* $NetBSD: ip6_output.c,v 1.125 2008/01/10 08:06:12 dyoung Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.124 2007/12/20 19:53:34 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.125 2008/01/10 08:06:12 dyoung Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@ -2598,8 +2598,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m)
sockaddr_in6_init(&u.dst6, &mreq->ipv6mr_multiaddr, 0,
0, 0);
rtcache_setdst(&ro, &u.dst);
rtcache_init(&ro);
ifp = (rt = rtcache_getrt(&ro)) != NULL ? rt->rt_ifp
ifp = (rt = rtcache_init(&ro)) != NULL ? rt->rt_ifp
: NULL;
rtcache_free(&ro);
} else {