From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 31 10:09:47 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1D511065676; Mon, 31 Aug 2009 10:09:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 7CA718FC29; Mon, 31 Aug 2009 10:09:47 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 021DA46B0C; Mon, 31 Aug 2009 06:09:47 -0400 (EDT) Date: Mon, 31 Aug 2009 11:09:46 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Qing Li In-Reply-To: <200908302242.n7UMgWW2008517@svn.freebsd.org> Message-ID: References: <200908302242.n7UMgWW2008517@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r196673 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2009 10:09:47 -0000 On Sun, 30 Aug 2009, Qing Li wrote: > In ip_output(), the flow-table module must not try to cache L2/L3 > information for interface of IFF_POINTOPOINT or IFF_LOOPBACK type. > Since the L2 information (rt_lle) is invalid for these interface > types, accidental caching attempt will trigger panic when the invalid > rt_lle reference is accessed. > > When installing a new route, or when updating an existing route, the > user supplied gateway address may be an interface address (this is > particularly true for point-to-point interface related modules such > as ppp, if_tun, if_gif). Currently the routing command handler always > set the RTF_GATEWAY flag if the gateway address is given as part of the > command paramters. Therefore the gateway address must be verified against > interface addresses or else the route would be treated as an indirect > route, thus making that route unusable. With this change, can I mark the following two TODO items as done: * RTM_CHANGE in net/rtsock.c can incorrectly set RTF_GATEWAY (QingLi) (in progress) * flowtable mishandles gateway (G) routes on POINT2POINT interfaces (BrianSomers) (in progress) Also, do we believe your last few commits fix the three issues raised by Sato-san in his IPv6 reports: * IPv6 regression on 8.x (QingLi) (in progress) Thanks! Robert N M Watson Computer Laboratory University of Cambridge > > Reviewed by: kmacy, julian, rwatson > Approved by: re > > Modified: > stable/8/sys/ (props changed) > stable/8/sys/amd64/include/xen/ (props changed) > stable/8/sys/cddl/contrib/opensolaris/ (props changed) > stable/8/sys/contrib/dev/acpica/ (props changed) > stable/8/sys/contrib/pf/ (props changed) > stable/8/sys/dev/xen/xenpci/ (props changed) > stable/8/sys/net/flowtable.c > stable/8/sys/net/rtsock.c > > Modified: stable/8/sys/net/flowtable.c > ============================================================================== > --- stable/8/sys/net/flowtable.c Sun Aug 30 22:39:49 2009 (r196672) > +++ stable/8/sys/net/flowtable.c Sun Aug 30 22:42:32 2009 (r196673) > @@ -692,6 +692,12 @@ uncached: > struct rtentry *rt = ro->ro_rt; > struct ifnet *ifp = rt->rt_ifp; > > + if (ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) { > + RTFREE(rt); > + ro->ro_rt = NULL; > + return (ENOENT); > + } > + > if (rt->rt_flags & RTF_GATEWAY) > l3addr = rt->rt_gateway; > else > > Modified: stable/8/sys/net/rtsock.c > ============================================================================== > --- stable/8/sys/net/rtsock.c Sun Aug 30 22:39:49 2009 (r196672) > +++ stable/8/sys/net/rtsock.c Sun Aug 30 22:42:32 2009 (r196673) > @@ -513,6 +513,39 @@ route_output(struct mbuf *m, struct sock > senderr(error); > } > > + /* > + * The given gateway address may be an interface address. > + * For example, issuing a "route change" command on a route > + * entry that was created from a tunnel, and the gateway > + * address given is the local end point. In this case the > + * RTF_GATEWAY flag must be cleared or the destination will > + * not be reachable even though there is no error message. > + */ > + if (info.rti_info[RTAX_GATEWAY] != NULL && > + info.rti_info[RTAX_GATEWAY]->sa_family != AF_LINK) { > + struct route gw_ro; > + > + bzero(&gw_ro, sizeof(gw_ro)); > + gw_ro.ro_dst = *info.rti_info[RTAX_GATEWAY]; > + rtalloc_ign(&gw_ro, 0); > + /* > + * A host route through the loopback interface is > + * installed for each interface adddress. In pre 8.0 > + * releases the interface address of a PPP link type > + * is not reachable locally. This behavior is fixed as > + * part of the new L2/L3 redesign and rewrite work. The > + * signature of this interface address route is the > + * AF_LINK sa_family type of the rt_gateway, and the > + * rt_ifp has the IFF_LOOPBACK flag set. > + */ > + if (gw_ro.ro_rt != NULL && > + gw_ro.ro_rt->rt_gateway->sa_family == AF_LINK && > + gw_ro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK) > + info.rti_flags &= ~RTF_GATEWAY; > + if (gw_ro.ro_rt != NULL) > + RTFREE(gw_ro.ro_rt); > + } > + > switch (rtm->rtm_type) { > struct rtentry *saved_nrt; > > @@ -714,7 +747,7 @@ route_output(struct mbuf *m, struct sock > RT_UNLOCK(rt); > senderr(error); > } > - rt->rt_flags |= RTF_GATEWAY; > + rt->rt_flags |= (RTF_GATEWAY & info.rti_flags); > } > if (info.rti_ifa != NULL && > info.rti_ifa != rt->rt_ifa) { >