aboutsummaryrefslogtreecommitdiff
path: root/sbin/route/route.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2012-12-04 20:05:01 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2012-12-04 20:05:01 +0000
commit7c283ae8603134c3aa4352b6ee5d5f879f7c3af5 (patch)
tree0086aeb08a19e81ff260bf0d6ff0689787344fb2 /sbin/route/route.c
parent5c9fa630f66e0e8a54074c21b66a526503d9509f (diff)
downloadsrc-7c283ae8603134c3aa4352b6ee5d5f879f7c3af5.tar.gz
src-7c283ae8603134c3aa4352b6ee5d5f879f7c3af5.zip
Fix fallout from r243019, which broke parsing of shortened network
prefixes. Reported and tested by: delphij
Notes
Notes: svn path=/head/; revision=243867
Diffstat (limited to 'sbin/route/route.c')
-rw-r--r--sbin/route/route.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index b63ce6377451..809dc9f08404 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1033,6 +1033,13 @@ inet_makenetandmask(u_long net, struct sockaddr_in *sin, u_long bits)
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.
*/