summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-09-01 14:33:16 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-09-01 14:33:16 +0000
commitdaea662a51cc223b8a78bbdac4a0605e63d0cc8d (patch)
tree5351f4711a91681bbeb077b1476173b02df3509d /sys/netinet6
parent990a114a1ce6e2dd4f2615dfbca77dc9e4db2ebf (diff)
Convert ip{,6}_output() (cached) route entry checks to rtisvalid(9).
ok bluhm@
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6_src.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 570ce25f623..decbfce762e 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_src.c,v 1.51 2015/06/08 22:19:28 krw Exp $ */
+/* $OpenBSD: in6_src.c,v 1.52 2015/09/01 14:33:15 mpi Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
@@ -247,13 +247,12 @@ in6_selectsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock,
* our src addr is taken from the i/f, else punt.
*/
if (ro) {
- if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
- !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst))) {
+ if (!rtisvalid(ro->ro_rt) ||
+ !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst)) {
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
}
- if (ro->ro_rt == (struct rtentry *)0 ||
- ro->ro_rt->rt_ifp == (struct ifnet *)0) {
+ if (ro->ro_rt == NULL) {
struct sockaddr_in6 *sa6;
/* No route yet, so try to acquire one */
@@ -419,10 +418,9 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
* cached destination, in case of sharing the cache with IPv4.
*/
if (ro) {
- if (ro->ro_rt &&
- (!(ro->ro_rt->rt_flags & RTF_UP) ||
+ if (!rtisvalid(ro->ro_rt) ||
sin6tosa(&ro->ro_dst)->sa_family != AF_INET6 ||
- !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst))) {
+ !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst)) {
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
}