-/* $OpenBSD: ip_output.c,v 1.300 2015/10/07 14:52:45 deraadt Exp $ */
+/* $OpenBSD: ip_output.c,v 1.301 2015/10/13 10:16:17 mpi Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
* 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 (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
+ if (!rtisvalid(ro->ro_rt) ||
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;
}
-/* $OpenBSD: in6_src.c,v 1.62 2015/09/18 14:26:22 mpi Exp $ */
+/* $OpenBSD: in6_src.c,v 1.63 2015/10/13 10:16:17 mpi Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
* 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 */
* 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;
}