summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2012-03-06 12:44:18 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2012-03-06 12:44:18 +0000
commit46538b53f57a0d60ef3ed51bb8baab5bae430b5b (patch)
treed2c42be2b52a3d77304c6de9cd45cf8bfb9652d1
parent7733315367d2f7a9605abe896dae98b03a7d1d7c (diff)
Check if route is still valid when getting the cached rt entry of a pcb.
While there make sure we do the lookup in the correct routing table. OK mikeb, henning and phessler
-rw-r--r--sys/netinet/in_pcb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index bd368dc1f00..c5eda674760 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.125 2012/01/11 17:45:05 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.126 2012/03/06 12:44:17 claudio Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -748,6 +748,12 @@ 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) {
+ RTFREE(ro->ro_rt);
+ ro->ro_rt = NULL;
+ }
+
/*
* No route yet, so try to acquire one.
*/
@@ -767,6 +773,7 @@ in_pcbrtentry(struct inpcb *inp)
ro->ro_dst.sa_len = sizeof(struct sockaddr_in6);
((struct sockaddr_in6 *) &ro->ro_dst)->sin6_addr =
inp->inp_faddr6;
+ ro->ro_tableid = inp->inp_rtableid;
rtalloc_mpath(ro, &inp->inp_laddr6.s6_addr32[0]);
break;
#endif /* INET6 */