summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2009-04-06 14:27:28 +0000
committerrrs <rrs@FreeBSD.org>2009-04-06 14:27:28 +0000
commit77b8cee3581abed55b8a1518c13a2a7e3280bcca (patch)
tree803c41b4733f713a4b58c6fb98ac7706d19c6b7c /sbin
parent30344f64e2d168d00120d96fad0c2ec4bc1251de (diff)
downloadFreeBSD-src-77b8cee3581abed55b8a1518c13a2a7e3280bcca.zip
FreeBSD-src-77b8cee3581abed55b8a1518c13a2a7e3280bcca.tar.gz
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
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/route.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index f06e205..2962e00 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -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);
OpenPOWER on IntegriCloud