From owner-svn-src-head@FreeBSD.ORG Mon Apr 6 16:21:32 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 6098F1065726; Mon, 6 Apr 2009 16:21:32 +0000 (UTC) (envelope-from rrs@lakerest.net) Received: from lakerest.net (unknown [IPv6:2001:240:585:2:203:6dff:fe1a:4ddc]) by mx1.freebsd.org (Postfix) with ESMTP id D55B78FC18; Mon, 6 Apr 2009 16:21:31 +0000 (UTC) (envelope-from rrs@lakerest.net) Received: from [10.1.1.53] ([10.1.1.53]) (authenticated bits=0) by lakerest.net (8.14.3/8.14.3) with ESMTP id n36GLUmo048556 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Mon, 6 Apr 2009 12:21:30 -0400 (EDT) (envelope-from rrs@lakerest.net) DKIM-Signature: a=rsa-sha1; c=simple/simple; d=lakerest.net; s=mail; t=1239034890; h=Cc:Message-Id:From:To:In-Reply-To:Content-Type: Content-Transfer-Encoding:Mime-Version:Subject:Date:References: X-Mailer; b=zbRWAexh1Ddu34VFd96WVNto3zaw7QS4sXQQbM/7/T1De3L3xTVcqB2 wblQFhHy2eiXEIhy01SLoMb/0nnMBpg== Message-Id: <5EEC0668-D1C4-45E8-AFC1-959AE3E8715E@lakerest.net> From: Randall Stewart To: Coleman Kane In-Reply-To: <1239030459.1946.4.camel@localhost> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Mon, 6 Apr 2009 12:21:30 -0400 References: <200904061427.n36ERTVF074015@svn.freebsd.org> <1239030459.1946.4.camel@localhost> X-Mailer: Apple Mail (2.930.3) Cc: svn-src-head@FreeBSD.org, Randall Stewart , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r190775 - head/sbin/route 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: Mon, 06 Apr 2009 16:21:33 -0000 On Apr 6, 2009, at 11:07 AM, Coleman Kane wrote: > On Mon, 2009-04-06 at 14:27 +0000, Randall Stewart wrote: >> Author: rrs >> Date: Mon Apr 6 14:27:28 2009 >> New Revision: 190775 >> URL: http://svn.freebsd.org/changeset/base/190775 >> >> Log: >> Ok, looking at the solution a bit closer, the level >> calculation was too agressive. Instead we should only >> look at each nibble. This makes it so we make >> 10.2.0.0 become 10.2/16 NOT 10.2/17. > > I presume you meant "NOT 10.2/15" here? Correct me if I'm wrong, but > that's what I gathered by the discussion of "the bug" in the previous > thread. > It would have actually done any number of ones... basically looking at the bottom number of 0 bits and that would be the / value. So depending on what number you put with 10.x (for x) you could get a variety of results.. 10.2 would == 10.2/17 10.4 would == 10.2/18 etc. This is not the correct behavior.. even though it might be technically right with regard to CIDR. Now as far as the old class based routings go.. this is a problem since the two schemes are at odds. We have for a long time had doing route add -net 10.2.0.0 be equal to adding 10.2/16 But if you follow the old Class based routing then the upper 4 bits of the address needs to be examined to determine if its a /8, /16 etc. That is incorrect in a CIDR world.. but I don't see a way to make the two schemes work together. And since previous to 7.1 the above worked.. I think this last fix is the right approach.. R >> >> Need to explore the non-cidr address issue. The two >> may not be seperable.. >> >> MFC after: 1 week >> >> Modified: >> head/sbin/route/route.c >> >> Modified: head/sbin/route/route.c >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- head/sbin/route/route.c Mon Apr 6 14:12:22 2009 (r190774) >> +++ head/sbin/route/route.c Mon Apr 6 14:27:28 2009 (r190775) >> @@ -808,15 +808,15 @@ inet_makenetandmask(net, sin, bits) >> * CIDR address. >> */ >> if ((bits == 0) && (addr != 0)) { >> - int i, j; >> - for(i=0,j=1; i<32; i++) { >> + u_long i, j; >> + for(i=0,j=0xff; i<4; i++) { >> if (addr & j) { >> break; >> } >> - j <<= 1; >> + j <<= 8; >> } >> /* i holds the first non zero bit */ >> - bits = 32 - i; >> + bits = 32 - (i*8); >> } >> mask = 0xffffffff << (32 - bits); >> > > -- > Coleman Kane ------------------------------ Randall Stewart 803-317-4952 (cell) 803-345-0391(direct)