From owner-svn-src-head@FreeBSD.ORG Tue Jul 14 10:15:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23A54106564A; Tue, 14 Jul 2009 10:15:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id A3C068FC1D; Tue, 14 Jul 2009 10:15:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 8615741C65E; Tue, 14 Jul 2009 12:15:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id XJ7+R2ClRKP7; Tue, 14 Jul 2009 12:15:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id A3F0041C67B; Tue, 14 Jul 2009 12:15:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id BC8204448E6; Tue, 14 Jul 2009 10:10:37 +0000 (UTC) Date: Tue, 14 Jul 2009 10:10:37 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Qing Li In-Reply-To: <200907121920.n6CJKtf1092990@svn.freebsd.org> Message-ID: <20090714100524.P245@maildrop.int.zabbadoz.net> References: <200907121920.n6CJKtf1092990@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195643 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jul 2009 10:15:08 -0000 On Sun, 12 Jul 2009, Qing Li wrote: > Author: qingli > Date: Sun Jul 12 19:20:55 2009 > New Revision: 195643 > URL: http://svn.freebsd.org/changeset/base/195643 > > Log: > This patch adds a host route to an interface address (that is assigned > to a non loopback/ppp link type) through the loopback interface. Prior > to the new L2/L3 rewrite, this host route was explicitly created when > processing the IPv6 address assignment. This loopback host route is > deleted when that IPv6 address is removed from the interface. Thanks a lot for fixing this. Now I am reviewing another patch and I found that this here used to be configurable actually by sysctls: nd6_useloopback for v6 and the v4 version from r192011 used to use useloopback; see the lines following pointing at the 7-STABLE tree to have a tree before new-arp: http://fxr.watson.org/fxr/source/netinet/if_ether.c?v=FREEBSD7#L259 http://fxr.watson.org/fxr/source/netinet6/nd6.c?v=FREEBSD7#L1320 Not sure if we'll want to restore that behaviour or remove the sysctls? /bz > Reviewed by: bz, gnn > Approved by: re > > Modified: > head/sys/netinet6/in6.c > > Modified: head/sys/netinet6/in6.c > ============================================================================== > --- head/sys/netinet6/in6.c Sun Jul 12 17:07:35 2009 (r195642) > +++ head/sys/netinet6/in6.c Sun Jul 12 19:20:55 2009 (r195643) > @@ -1194,6 +1194,25 @@ in6_purgeaddr(struct ifaddr *ifa) > ifa_ref(ifa0); > IF_ADDR_UNLOCK(ifp); > > + if (!(ia->ia_ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { > + struct rt_addrinfo info; > + struct sockaddr_dl null_sdl; > + > + bzero(&null_sdl, sizeof(null_sdl)); > + null_sdl.sdl_len = sizeof(null_sdl); > + null_sdl.sdl_family = AF_LINK; > + null_sdl.sdl_type = V_loif->if_type; > + null_sdl.sdl_index = V_loif->if_index; > + bzero(&info, sizeof(info)); > + info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; > + info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; > + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; > + error = rtrequest1_fib(RTM_DELETE, &info, NULL, 0); > + > + if (error != 0) > + log(LOG_INFO, "in6_purgeaddr: deletion failed\n"); > + } > + > /* stop DAD processing */ > nd6_dad_stop(ifa); > > @@ -1755,6 +1774,33 @@ in6_ifinit(struct ifnet *ifp, struct in6 > ia->ia_flags |= IFA_ROUTE; > } > > + /* > + * add a loopback route to self > + */ > + if (!(ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { > + struct rt_addrinfo info; > + struct rtentry *rt = NULL; > + static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; > + > + bzero(&info, sizeof(info)); > + info.rti_ifp = V_loif; > + info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; > + info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; > + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; > + error = rtrequest1_fib(RTM_ADD, &info, &rt, 0); > + > + if (error == 0 && rt != NULL) { > + RT_LOCK(rt); > + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = > + rt->rt_ifp->if_type; > + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = > + rt->rt_ifp->if_index; > + RT_REMREF(rt); > + RT_UNLOCK(rt); > + } else if (error != 0) > + log(LOG_INFO, "in6_ifinit: insertion failed\n"); > + } > + > /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */ > if (newhost) { > struct llentry *ln; > -- Bjoern A. Zeeb The greatest risk is not taking one.