While here add a missing ``rtableid'' check in in_selectsrc().
ok bluhm@
-/* $OpenBSD: in_pcb.c,v 1.183 2015/10/19 08:49:13 vgross Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.184 2015/10/19 12:10:05 mpi Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
ro = &inp->inp_route;
/* check if route is still valid */
- if (ro->ro_rt && (ro->ro_rt->rt_flags & RTF_UP) == 0) {
+ if (!rtisvalid(ro->ro_rt)) {
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
}
* If route is known or can be allocated now,
* our src addr is taken from the i/f, else punt.
*/
- if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
- (satosin(&ro->ro_dst)->sin_addr.s_addr != sin->sin_addr.s_addr))) {
+ if (!rtisvalid(ro->ro_rt) || (ro->ro_tableid != rtableid) ||
+ (satosin(&ro->ro_dst)->sin_addr.s_addr != sin->sin_addr.s_addr)) {
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
}
-/* $OpenBSD: ip_icmp.c,v 1.142 2015/10/19 12:02:11 mpi Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.143 2015/10/19 12:10:05 mpi Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
sin.sin_addr = dst;
rt = rtalloc(sintosa(&sin), RT_REPORT|RT_RESOLVE, rtableid);
- if (rt == NULL)
- return (NULL);
/* Check if the route is actually usable */
- if (rt->rt_flags & (RTF_REJECT | RTF_BLACKHOLE) ||
- (rt->rt_flags & RTF_UP) == 0) {
+ if (!rtisvalid(rt) || (rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE))) {
rtfree(rt);
return (NULL);
}
/* If we didn't get a host route, allocate one */
-
if ((rt->rt_flags & RTF_HOST) == 0) {
struct rtentry *nrt;
struct rt_addrinfo info;
-/* $OpenBSD: ip_output.c,v 1.301 2015/10/13 10:16:17 mpi Exp $ */
+/* $OpenBSD: ip_output.c,v 1.302 2015/10/19 12:10:05 mpi Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
* them, there is no way for one to update all its
* routes when the MTU is changed.
*/
- if (ro->ro_rt != NULL &&
- (ro->ro_rt->rt_flags & (RTF_UP | RTF_HOST)) &&
+ if (rtisvalid(ro->ro_rt) &&
+ ISSET(ro->ro_rt->rt_flags, RTF_HOST) &&
!(ro->ro_rt->rt_rmx.rmx_locks & RTV_MTU) &&
(ro->ro_rt->rt_rmx.rmx_mtu > ifp->if_mtu)) {
ro->ro_rt->rt_rmx.rmx_mtu = ifp->if_mtu;