Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2012 20:05:02 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r243867 - head/sbin/route
Message-ID:  <201212042005.qB4K52fL044755@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Tue Dec  4 20:05:01 2012
New Revision: 243867
URL: http://svnweb.freebsd.org/changeset/base/243867

Log:
  Fix fallout from r243019, which broke parsing of shortened network
  prefixes.
  
  Reported and tested by:	delphij

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==============================================================================
--- head/sbin/route/route.c	Tue Dec  4 17:12:23 2012	(r243866)
+++ head/sbin/route/route.c	Tue Dec  4 20:05:01 2012	(r243867)
@@ -1033,6 +1033,13 @@ inet_makenetandmask(u_long net, struct s
 	rtm_addrs |= RTA_NETMASK;
 
 	/*
+	 * MSB of net should be meaningful. 0/0 is exception.
+	 */
+	if (net > 0)
+		while ((net & 0xff000000) == 0)
+			net <<= 8;
+
+	/*
 	 * If no /xx was specified we must calculate the
 	 * CIDR address.
 	 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212042005.qB4K52fL044755>