diff options
author | 2015-10-13 10:16:17 +0000 | |
---|---|---|
committer | 2015-10-13 10:16:17 +0000 | |
commit | a7fe36b40b19de7766981ad47d69f44c8eb1466d (patch) | |
tree | 4dd4c147195b8f10a03d75e684a645f8d96f53d7 /sys/netinet/ip_output.c | |
parent | Make sure RTF_LOCAL route entries are UP when added to the tree. (diff) | |
download | wireguard-openbsd-a7fe36b40b19de7766981ad47d69f44c8eb1466d.tar.xz wireguard-openbsd-a7fe36b40b19de7766981ad47d69f44c8eb1466d.zip |
Use rtisivalid(9) to check if the given (cached) route can be used.
Note that after calling rtalloc(9) we only check if a route has been
returned or not and do not check for its validity. This cannot be
improved without a massive refactoring.
The kernel currently *do* use !RTF_UP route due to a mismatch between
the value of ifp->if_link_state and the IFF_UP|IFF_RUNNING code.
I'd explain the RTF_UP flag as follow:
. If a cached route entry w/o RTF_UP is passed to ip{6,}_output(),
. call rtalloc(9) to see if a better entry is present in the tree.
This is enough to support MPATH and route cache invalidation.
ok bluhm@
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 24ecc1b4bdb..11af574b2b4 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -170,9 +170,9 @@ reroute: * 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; } |