svn commit: r243867 - head/sbin/route

Gleb Smirnoff glebius at FreeBSD.org
Tue Dec 4 20:05:02 UTC 2012


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.
 	 */


More information about the svn-src-all mailing list