diff options
author | glebius <glebius@FreeBSD.org> | 2012-12-04 20:05:01 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-12-04 20:05:01 +0000 |
commit | e3194b87ca5c4f35638ebd27dfe4f3c8a2344e58 (patch) | |
tree | 0086aeb08a19e81ff260bf0d6ff0689787344fb2 | |
parent | db5359d69a9ec06842730b8af2a30072a38b5aa1 (diff) | |
download | FreeBSD-src-e3194b87ca5c4f35638ebd27dfe4f3c8a2344e58.zip FreeBSD-src-e3194b87ca5c4f35638ebd27dfe4f3c8a2344e58.tar.gz |
Fix fallout from r243019, which broke parsing of shortened network
prefixes.
Reported and tested by: delphij
-rw-r--r-- | sbin/route/route.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index b63ce63..809dc9f 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. */ |