From owner-p4-projects@FreeBSD.ORG Sun Oct 7 21:54:51 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5F87016A41A; Sun, 7 Oct 2007 21:54:51 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1031F16A421 for ; Sun, 7 Oct 2007 21:54:51 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EEAE113C465 for ; Sun, 7 Oct 2007 21:54:50 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l97Lsohe017008 for ; Sun, 7 Oct 2007 21:54:50 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l97LsoxZ017005 for perforce@freebsd.org; Sun, 7 Oct 2007 21:54:50 GMT (envelope-from kmacy@freebsd.org) Date: Sun, 7 Oct 2007 21:54:50 GMT Message-Id: <200710072154.l97LsoxZ017005@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 127291 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2007 21:54:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=127291 Change 127291 by kmacy@kmacy_home:ethng on 2007/10/07 21:54:41 mark deleted rtentry as expired so that any inpcbs referencing it will free their reference and look it up again Affected files ... .. //depot/projects/ethng/src/sys/net/route.c#7 edit .. //depot/projects/ethng/src/sys/netinet/tcp_output.c#4 edit .. //depot/projects/ethng/src/sys/netinet/udp_usrreq.c#5 edit Differences ... ==== //depot/projects/ethng/src/sys/net/route.c#7 (text+ko) ==== @@ -861,7 +861,12 @@ * when RTFREE(rt) is eventually called. */ rttrash++; - + /* + * If inpcbs hold a reference to this route + * they need to be notified that it is no longer valid + */ + rt->rt_rmx.rmx_expire = time_uptime; + /* * If the caller wants it, then it can have it, * but it's up to it to free the rtentry as we won't be ==== //depot/projects/ethng/src/sys/netinet/tcp_output.c#4 (text+ko) ==== @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -141,6 +142,7 @@ struct sackhole *p; int tso = 0; struct tcpopt to; + struct rtentry *rt; #if 0 int maxburst = TCP_MAXBURST; #endif @@ -1123,9 +1125,10 @@ if (path_mtu_discovery) ip->ip_off |= IP_DF; /* - * XXX need to validate - */ - if (inp->inp_route.ro_rt == NULL) { + * XXX timer wrap? + */ + rt = inp->inp_route.ro_rt; + if (rt == NULL || (rt && rt->rt_rmx.rmx_expire && (rt->rt_rmx.rmx_expire <= time_uptime))) { struct sockaddr_in *dst = (struct sockaddr_in *)&inp->inp_route.ro_dst; struct ip *ip = mtod(m, struct ip *); @@ -1133,7 +1136,10 @@ dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = ip->ip_dst; - + if (rt) { + RTFREE(rt); + inp->inp_route.ro_rt = NULL; + } rtalloc_ign(&inp->inp_route, 0); } ==== //depot/projects/ethng/src/sys/netinet/udp_usrreq.c#5 (text+ko) ==== @@ -767,7 +767,8 @@ int ipflags; u_short fport, lport; int unlock_udbinfo; - + struct rtentry *rt; + /* * udp_output() may need to temporarily bind or connect the current * inpcb. As such, we don't know up front whether we will need the @@ -969,9 +970,10 @@ INP_INFO_WUNLOCK(&udbinfo); /* - * XXX need to validate + * XXX timer wrap? */ - if (inp->inp_route.ro_rt == NULL) { + rt = inp->inp_route.ro_rt; + if (rt == NULL || (rt && rt->rt_rmx.rmx_expire && (rt->rt_rmx.rmx_expire <= time_uptime))) { struct sockaddr_in *dst = (struct sockaddr_in *)&inp->inp_route.ro_dst; struct ip *ip = mtod(m, struct ip *); @@ -979,9 +981,15 @@ dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = ip->ip_dst; - + if (rt) { + RTFREE(rt); + inp->inp_route.ro_rt = NULL; + } rtalloc_ign(&inp->inp_route, 0); - } + } + + + m->m_pkthdr.rss_hash = inp->inp_rss_hash; error = ip_output(m, inp->inp_options, &inp->inp_route, ipflags, inp->inp_moptions, inp);