From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 26 06:50:57 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9CEB816A407; Thu, 26 Oct 2006 06:50:57 +0000 (UTC) (envelope-from jan@melen.org) Received: from foxgw.melen.org (Savi-Mel.dna.fi [83.143.60.138]) by mx1.FreeBSD.org (Postfix) with ESMTP id EBDD343D4C; Thu, 26 Oct 2006 06:50:56 +0000 (GMT) (envelope-from jan@melen.org) Received: from localhost ([IPv6:2001:14b8:400:f00::ffff]) (authenticated bits=0) by foxgw.melen.org (8.13.8/8.13.7) with ESMTP id k9Q6odKq079375 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 26 Oct 2006 09:50:54 +0300 (EEST) (envelope-from jan@melen.org) From: Jan Mikael Melen To: freebsd-hackers@freebsd.org, freebsd-net@freebsd.org Date: Thu, 26 Oct 2006 09:52:09 +0300 User-Agent: KMail/1.9.4 References: <200608092157.07573.jan@melen.org> In-Reply-To: <200608092157.07573.jan@melen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610260952.10413.jan@melen.org> X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on foxgw.melen.org X-Virus-Status: Clean X-Mailman-Approved-At: Thu, 26 Oct 2006 12:46:21 +0000 Cc: Subject: Re: Problem with routes when configuring IPv6 addresses X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2006 06:50:57 -0000 Hi, Just answering my own mail. Here is small patch that fixes this problem for us in 6.1. --- nd6_rtr.c.orig Mon Mar 20 18:23:08 2006 +++ nd6_rtr.c Thu Oct 26 09:48:59 2006 @@ -1409,12 +1409,20 @@ if (pr->ndpr_raf_onlink == 0) continue; - if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 && + /* For some reason nd6 tries to find a active + * advertising router also for prefixes that are + * statically configured which shouldn't be the case + */ + if (pr->ndpr_vltime == ND6_INFINITE_LIFETIME) { + pr->ndpr_stateflags &= ~NDPRF_DETACHED; + } else { + if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 && find_pfxlist_reachable_router(pr) == NULL) pr->ndpr_stateflags |= NDPRF_DETACHED; if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 && find_pfxlist_reachable_router(pr) != 0) pr->ndpr_stateflags &= ~NDPRF_DETACHED; + } } } else { /* there is no prefix that has a reachable router */ On Wednesday 09 August 2006 21:57, Jan Mikael Melen wrote: > Hello, > > I previously already sent this to the freebsd-net list but didn't get any > response so let's try the hackers list instead. > > I have a problem with routes in 6.1 when configuring IPv6 address using > both autoconfigured addresses at the same time with statically configured > addresses from different prefixes. > > If the host is not accepting router advertisements everything seems to work > fine: > # sysctl -a | grep rtad > net.inet6.ip6.accept_rtadv: 0 > # ifconfig fxp0 inet6 3ffe:101::1 prefixlen 64 > > # netstat -rn -f inet6 | grep 3ffe:101 > 3ffe:101::/64 link#1 UC > fxp0 > 3ffe:101::1 00:12:3f:71:3e:ef UHL > lo0 > # > > As you can see I have two routes one for the loopback and one for the > prefix as it should GREAT! > > Now if I'll set the host to accept router advertisements then the route for > the 3ffe:101:: prefix will be deleted as the first router advertisement is > received. The router advertises prefix 3ffe:14b8:400:101::/64. > > # sysctl net.inet6.ip6.accept_rtadv=1 > net.inet6.ip6.accept_rtadv: 0 -> 1 > # rtsol -a > # netstat -rn -f inet6 | grep 3ffe:101 > 3ffe:101::1 00:12:3f:71:3e:ef UHL > lo0 > # > > It seems that the route is deleted because in function > pfxlist_onlink_check() there is a check that if the state has changed to > DETACHED the > nd6_prefix_offlink will be called which then removes the route: > if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 && > (pr->ndpr_stateflags & NDPRF_ONLINK) != 0) { > if ((e = nd6_prefix_offlink(pr)) != 0) { > nd6log((LOG_ERR, > "pfxlist_onlink_check: failed to " > "make %s/%d offlink, errno=%d\n", > ip6_sprintf(&pr->ndpr_prefix.sin6_addr), > pr->ndpr_plen, e)); > } > } > > This far I digged in to the code but then ran out of steam :-( Obviously > the state should not be set to DETACHED for manually configured prefixes > but the question is rather where it should be done. > > Before somebody asks, if I first do the autoconfiguration part and then > after I have the autoconfigured address add the manually configured address > the result is that there wont be any route for the manually configured > prefix (3ffe:101::/64). > > Regards, > Jan > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"