From owner-freebsd-net@FreeBSD.ORG Sat Jan 27 10:08:06 2007 Return-Path: X-Original-To: net@FreeBSD.org Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0F09D16A400; Sat, 27 Jan 2007 10:08:06 +0000 (UTC) (envelope-from eugen@www.svzserv.kemerovo.su) Received: from www.svzserv.kemerovo.su (www.svzserv.kemerovo.su [213.184.65.80]) by mx1.freebsd.org (Postfix) with ESMTP id 7294413C46C; Sat, 27 Jan 2007 10:08:05 +0000 (UTC) (envelope-from eugen@www.svzserv.kemerovo.su) Received: from www.svzserv.kemerovo.su (eugen@localhost [127.0.0.1]) by www.svzserv.kemerovo.su (8.13.8/8.13.8) with ESMTP id l0R9mTck020817; Sat, 27 Jan 2007 16:48:29 +0700 (KRAT) (envelope-from eugen@www.svzserv.kemerovo.su) Received: (from eugen@localhost) by www.svzserv.kemerovo.su (8.13.8/8.13.8/Submit) id l0R9mTPp020814; Sat, 27 Jan 2007 16:48:29 +0700 (KRAT) (envelope-from eugen) Date: Sat, 27 Jan 2007 16:48:29 +0700 From: Eugene Grosbein To: "Bruce M. Simpson" Message-ID: <20070127094829.GA20381@svzserv.kemerovo.su> References: <20070125184146.GA60481@grosbein.pp.ru> <45BA4ABD.5040402@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45BA4ABD.5040402@FreeBSD.org> User-Agent: Mutt/1.4.2.1i Cc: net@FreeBSD.org Subject: Re: interface metric & quagga X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jan 2007 10:08:06 -0000 On Fri, Jan 26, 2007 at 06:38:53PM +0000, Bruce M. Simpson wrote: > >RTM_NEWADDR contains 'metric 0' regardless of interface metric > >value set with ifconfig before. quagga, since version 0.99.3, > >takes metric value from RTM_NEWADDR message and this value overrides > >right interface metric learned by quagga a milisecond before. > >Then it passes zero interface metric to ripd that uses interface > >metric as hop count increment for RIP-learned routes. > >This effectively breaks RIPv2 for FreeBSD (quagga-0.99.2 and older > >versions do not use metric from RTM_NEWADDR and work), perhaps RIPv1 too. > It's a mixed issue. > > FreeBSD does not use the interface metric, so routing daemons shouldn't > use that field. > > However, many routing implementations use a metric or distance of 0 to > indicate a directly-connected route or interface route, so it has > special meaning. > > We could deal with this situation better by explicitly setting the > metric to an invalid value. Quagga checks if metric is zero and changes zero to one for itself in first place. Sadly, it does not perform such sanity check in second place, when it processes RTM_NEWADDR. > If/when we implemented equal-cost multipath, or source address selection > policies, then we should use this field. > >Verified with RELENG_4 and RELENG_6. > >Is it kernel bug or quagga bug? > > > >I also suggest to include next patch to the Ports tree > >if no objections. It restores RIP support. > > > I'd rewrite the patch to wrap the assignment in #ifndef __FreeBSD__ so > that it can be taken upstream more easily. If/when we do equal-cost > multipath or source policy we can bump __FreeBSD_version. Here is version that does not need #ifndef __FreeBSD__ Now (ifam->ifam_metric) is always zero for all FreeBSD versions. --- zebra/kernel_socket.c.orig Fri Jan 26 10:55:03 2007 +++ zebra/kernel_socket.c Fri Jan 26 10:55:35 2007 @@ -585,6 +585,7 @@ if (ifnlen && strncmp (ifp->name, ifname, INTERFACE_NAMSIZ)) isalias = 1; + if (ifam->ifam_metric) ifp->metric = ifam->ifam_metric; /* Add connected address. */ I currently run this patch in production for relatively large RIPv2 network of FreeBSD routers (versions 4.11 and 6.x). Eugene Grosbein