Date: Mon, 6 Apr 2009 14:27:29 +0000 (UTC) From: Randall Stewart <rrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r190775 - head/sbin/route Message-ID: <200904061427.n36ERTVF074015@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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. 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904061427.n36ERTVF074015>