diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-03 14:59:24 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-03 14:59:24 +0000 |
commit | 24ca63fcc79a94d69934546a1f4e4961d3016dc6 (patch) | |
tree | 1205b96c7d8257ceda368c526032b42f5158e50e /sys/netinet/ip_output.c | |
parent | b5f6f5d227ccf9ec76cc58f32cd6ae3c489f81b5 (diff) |
Revert (again!) the two uses of rtisvalid(9), they break NFS!
Found the hardway by naddy@
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 1436be3f2e5..f13bdd59ad9 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.290 2015/09/03 09:59:59 mpi Exp $ */ +/* $OpenBSD: ip_output.c,v 1.291 2015/09/03 14:59:23 mpi Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -168,13 +168,12 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, dst = satosin(&ro->ro_dst); /* - * If there is a cached route, check that it is to the - * same destination and is still valid. If not, free - * it and try again. + * If there is a cached route, check that it is to the same + * destination and is still up. If not, free it and try again. */ - if (!rtisvalid(ro->ro_rt) || + if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_addr.s_addr != ip->ip_dst.s_addr || - ro->ro_tableid != m->m_pkthdr.ph_rtableid) { + ro->ro_tableid != m->m_pkthdr.ph_rtableid)) { rtfree(ro->ro_rt); ro->ro_rt = NULL; } @@ -196,9 +195,7 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, ro->ro_rt = rtalloc_mpath(&ro->ro_dst, NULL, ro->ro_tableid); - if (!rtisvalid(ro->ro_rt)) { - rtfree(ro->ro_rt); - ro->ro_rt = NULL; + if (ro->ro_rt == NULL) { ipstat.ips_noroute++; error = EHOSTUNREACH; goto bad; @@ -299,13 +296,12 @@ reroute: dst = satosin(&ro->ro_dst); /* - * If there is a cached route, check that it is to the - * same destination and is still valid. If not, free - * it and try again. + * If there is a cached route, check that it is to the same + * destination and is still up. If not, free it and try again. */ - if (!rtisvalid(ro->ro_rt) || + if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_addr.s_addr != ip->ip_dst.s_addr || - ro->ro_tableid != m->m_pkthdr.ph_rtableid) { + ro->ro_tableid != m->m_pkthdr.ph_rtableid)) { rtfree(ro->ro_rt); ro->ro_rt = NULL; } @@ -327,9 +323,7 @@ reroute: ro->ro_rt = rtalloc_mpath(&ro->ro_dst, &ip->ip_src.s_addr, ro->ro_tableid); - if (!rtisvalid(ro->ro_rt)) { - rtfree(ro->ro_rt); - ro->ro_rt = NULL; + if (ro->ro_rt == NULL) { ipstat.ips_noroute++; error = EHOSTUNREACH; goto bad; |