Use rtcache_validate() instead of rtcache_getrt().

This commit is contained in:
dyoung 2008-01-14 04:17:35 +00:00
parent 19dd9ed4a7
commit 688ff775ce
6 changed files with 27 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: clnp_er.c,v 1.23 2007/12/20 19:53:34 dyoung Exp $ */
/* $NetBSD: clnp_er.c,v 1.24 2008/01/14 04:17:35 dyoung Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -59,7 +59,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clnp_er.c,v 1.23 2007/12/20 19:53:34 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: clnp_er.c,v 1.24 2008/01/14 04:17:35 dyoung Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@ -370,7 +370,7 @@ clnp_emit_er(m, reason)
/* send packet */
INCSTAT(cns_er_outhist[clnp_er_index(reason)]);
(void) (*ifp->if_output) (ifp, m, first_hop, rtcache_getrt(&route));
(void) (*ifp->if_output) (ifp, m, first_hop, rtcache_validate(&route));
goto done;
bad:

View File

@ -1,4 +1,4 @@
/* $NetBSD: clnp_output.c,v 1.21 2007/12/20 19:53:34 dyoung Exp $ */
/* $NetBSD: clnp_output.c,v 1.22 2008/01/14 04:17:35 dyoung Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -59,7 +59,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clnp_output.c,v 1.21 2007/12/20 19:53:34 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: clnp_output.c,v 1.22 2008/01/14 04:17:35 dyoung Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@ -243,7 +243,7 @@ clnp_output(struct mbuf *m0, ...)
printf("\tclc_dst %s\n", clnp_iso_addrp(&clcp->clc_dst));
printf("\tisop_opts %p, clc_opts %p\n",
isop->isop_options, clcp->clc_options);
if ((rt = rtcache_getrt(&isop->isop_route)) != NULL)
if ((rt = rtcache_validate(&isop->isop_route)) != NULL)
printf("\trt %p, rt_flags x%x\n",
rt, rt->rt_flags);
printf("\tflags x%x, clc_flags x%x\n", flags,
@ -255,7 +255,7 @@ clnp_output(struct mbuf *m0, ...)
if ((clcp != NULL) && /* cache exists */
(isop->isop_options == clcp->clc_options) && /* same options */
(iso_addrmatch1(dst, &clcp->clc_dst)) && /* dst still same */
(rt = rtcache_getrt(&isop->isop_route)) != NULL && /* route exists */
(rt = rtcache_validate(&isop->isop_route)) != NULL && /* route exists */
rt == clcp->clc_rt && /* and is cached */
(rt->rt_flags & RTF_UP) && /* route still up */
(flags == clcp->clc_flags) && /* same flags */
@ -459,7 +459,7 @@ clnp_output(struct mbuf *m0, ...)
#endif
goto bad;
}
clcp->clc_rt = rtcache_getrt(&isop->isop_route);/* XXX */
clcp->clc_rt = rtcache_validate(&isop->isop_route);/* XXX */
clcp->clc_ifp = clcp->clc_ifa->ia_ifp; /* XXX */
#ifdef ARGO_DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: clnp_subr.c,v 1.30 2007/12/20 19:53:34 dyoung Exp $ */
/* $NetBSD: clnp_subr.c,v 1.31 2008/01/14 04:17:35 dyoung Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -59,7 +59,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clnp_subr.c,v 1.30 2007/12/20 19:53:34 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: clnp_subr.c,v 1.31 2008/01/14 04:17:35 dyoung Exp $");
#include "opt_iso.h"
@ -263,6 +263,7 @@ clnp_forward(
struct ifnet *ifp; /* ptr to outgoing interface */
struct iso_ifaddr *ia = 0; /* ptr to iso name for ifp */
struct route route; /* filled in by clnp_route */
struct rtentry *rt;
extern int iso_systype;
clnp = mtod(m, struct clnp_fixed *);
@ -346,7 +347,7 @@ clnp_forward(
*/
if ((iso_systype & SNPA_IS) && (inbound_shp) &&
(ifp == inbound_shp->snh_ifp))
esis_rdoutput(inbound_shp, m, oidx, dst, rtcache_getrt(&route));
esis_rdoutput(inbound_shp, m, oidx, dst, rtcache_validate(&route));
/*
* If options are present, update them
*/
@ -391,11 +392,13 @@ clnp_forward(
/*
* Dispatch the datagram if it is small enough, otherwise fragment
*/
if (len <= SN_MTU(ifp, rtcache_getrt(&route))) {
if ((rt = rtcache_validate(&route)) == NULL)
;
else if (len <= SN_MTU(ifp, rt)) {
iso_gen_csum(m, CLNP_CKSUM_OFF, (int) clnp->cnf_hdr_len);
(void) (*ifp->if_output) (ifp, m, next_hop, rtcache_getrt(&route));
(void) (*ifp->if_output) (ifp, m, next_hop, rt);
} else {
(void) clnp_fragment(ifp, m, next_hop, len, seg_off, /* flags */ 0, rtcache_getrt(&route));
(void) clnp_fragment(ifp, m, next_hop, len, seg_off, /* flags */ 0, rt);
}
done:

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_eon.c,v 1.64 2008/01/10 08:04:44 dyoung Exp $ */
/* $NetBSD: if_eon.c,v 1.65 2008/01/14 04:17:35 dyoung Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -67,7 +67,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_eon.c,v 1.64 2008/01/10 08:04:44 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_eon.c,v 1.65 2008/01/14 04:17:35 dyoung Exp $");
#include "opt_eon.h"
@ -302,7 +302,7 @@ eonrtrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
}
el->el_flags |= RTF_UP;
eoniphdr(&el->el_ei, ipaddrloc, &el->el_iproute, EON_NORMAL_ADDR);
if ((nrt = rtcache_getrt(&el->el_iproute)) != NULL)
if ((nrt = rtcache_validate(&el->el_iproute)) != NULL)
rt->rt_rmx.rmx_mtu = nrt->rt_rmx.rmx_mtu - sizeof(el->el_ei);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iso_pcb.c,v 1.41 2007/12/20 19:53:35 dyoung Exp $ */
/* $NetBSD: iso_pcb.c,v 1.42 2008/01/14 04:17:35 dyoung Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -62,7 +62,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iso_pcb.c,v 1.41 2007/12/20 19:53:35 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: iso_pcb.c,v 1.42 2008/01/14 04:17:35 dyoung Exp $");
#include "opt_iso.h"
@ -334,7 +334,7 @@ iso_pcbconnect(void *v, struct mbuf *nam, struct lwp *l)
#ifdef ARGO_DEBUG
if (argo_debug[D_ISO]) {
printf("iso_pcbconnect localzero 2, rt %p",
rtcache_getrt(&isop->isop_route));
rtcache_validate(&isop->isop_route));
printf(" ia %p\n", ia);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: tp_subr2.c,v 1.36 2007/12/20 19:53:35 dyoung Exp $ */
/* $NetBSD: tp_subr2.c,v 1.37 2008/01/14 04:17:35 dyoung Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -66,7 +66,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tp_subr2.c,v 1.36 2007/12/20 19:53:35 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: tp_subr2.c,v 1.37 2008/01/14 04:17:35 dyoung Exp $");
/*
* this def'n is to cause the expansion of this macro in the routine
@ -510,7 +510,7 @@ tp_mss(struct tp_pcb *tpcb, int nhdr_size)
else
mss = 1 << tpcb->tp_tpdusize;
so = tpcb->tp_sock;
if ((rt = rtcache_getrt(tpcb->tp_routep)) == NULL) {
if ((rt = rtcache_validate(tpcb->tp_routep)) == NULL) {
bufsize = so->so_rcv.sb_hiwat;
goto punt_route;
}
@ -680,7 +680,7 @@ tp_route_to(struct mbuf *m, struct tp_pcb *tpcb, void *channel)
tpcb->tp_netservice = ISO_CLNS;
if (clnp_route(&siso->siso_addr, &isop->isop_route,
flags, NULL, NULL) == 0) {
rt = rtcache_getrt(&isop->isop_route);
rt = rtcache_validate(&isop->isop_route);
if (rt && rt->rt_flags & RTF_PROTO1)
tpcb->tp_netservice = ISO_CONS;
}