diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-10-19 12:10:06 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-10-19 12:10:06 +0000 |
commit | 4f78e3787ba6462d3053a56c381eb5f6df17e6b8 (patch) | |
tree | b2c68d3af5d11c705a8d5d90bc9182f4326cf837 /sys/netinet/in_pcb.c | |
parent | 91969f116bff1306d0f983edd5ac64cb2c7ca830 (diff) |
Stop checking for RTF_UP directly, call rtisvalid(9) instead.
While here add a missing ``rtableid'' check in in_selectsrc().
ok bluhm@
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 699d44ccd90..b7aa013330a 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -764,7 +764,7 @@ in_pcbrtentry(struct inpcb *inp) 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; } @@ -857,8 +857,8 @@ in_selectsrc(struct in_addr **insrc, struct sockaddr_in *sin, * 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; } |