summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2003-11-10 22:45:37 +0000
committeriedowse <iedowse@FreeBSD.org>2003-11-10 22:45:37 +0000
commit14918757c42e8d5cc4e4f71fe11b30232948e1e9 (patch)
treea8ef1917431a1e1afdab5bf68975d433e3384e78 /sys/netinet/in_pcb.c
parent3b1d84afe440bb6a3b51602929717b6f74fa4007 (diff)
downloadFreeBSD-src-14918757c42e8d5cc4e4f71fe11b30232948e1e9.zip
FreeBSD-src-14918757c42e8d5cc4e4f71fe11b30232948e1e9.tar.gz
In in_pcbconnect_setup(), don't use the cached inp->inp_route unless
it is marked as RTF_UP. This appears to fix a crash that was sometimes triggered when dhclient(8) tried to send a packet after an interface had been detatched. Reviewed by: sam
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 6b3d96b..eda8053 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -578,10 +578,10 @@ in_pcbconnect_setup(inp, nam, laddrp, lportp, faddrp, fportp, oinpp, td)
* destination, in case of sharing the cache with IPv6.
*/
ro = &inp->inp_route;
- if (ro->ro_rt &&
- (ro->ro_dst.sa_family != AF_INET ||
- satosin(&ro->ro_dst)->sin_addr.s_addr != faddr.s_addr ||
- inp->inp_socket->so_options & SO_DONTROUTE)) {
+ if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
+ ro->ro_dst.sa_family != AF_INET ||
+ satosin(&ro->ro_dst)->sin_addr.s_addr != faddr.s_addr ||
+ inp->inp_socket->so_options & SO_DONTROUTE)) {
RTFREE(ro->ro_rt);
ro->ro_rt = (struct rtentry *)0;
}
OpenPOWER on IntegriCloud