summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2004-09-07 10:14:43 +0000
committermarkus <markus@openbsd.org>2004-09-07 10:14:43 +0000
commitd99e8c86921e3a76b8284286cc5bcf78ed98d7bd (patch)
treed5525610767cf200f678286b808d2af458d02cd3
parentProperly put ktrsyscall (and scdebug_foo) into biglock, inspired from NetBSD (diff)
downloadwireguard-openbsd-d99e8c86921e3a76b8284286cc5bcf78ed98d7bd.tar.xz
wireguard-openbsd-d99e8c86921e3a76b8284286cc5bcf78ed98d7bd.zip
make -netmask work again; ok henning, mcbride, deraadt
-rw-r--r--sbin/route/route.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index cd771abd969..d1c36438e4e 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.72 2004/08/03 11:23:11 henning Exp $ */
+/* $OpenBSD: route.c,v 1.73 2004/09/07 10:14:43 markus Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94";
#else
-static const char rcsid[] = "$OpenBSD: route.c,v 1.72 2004/08/03 11:23:11 henning Exp $";
+static const char rcsid[] = "$OpenBSD: route.c,v 1.73 2004/09/07 10:14:43 markus Exp $";
#endif
#endif /* not lint */
@@ -553,6 +553,8 @@ newroute(int argc, char **argv)
ishost = 1;
if (forcenet)
ishost = 0;
+ if (forcenet && !(rtm_addrs & RTA_NETMASK))
+ errx(1, "netmask missing");
flags |= RTF_UP;
if (mpath)
flags |= RTF_MPATH;
@@ -866,11 +868,8 @@ getaddr(int which, char *s, struct hostent **hpp)
if ((which == RTA_DST || which == RTA_SRC) && !forcehost) {
bits = inet_net_pton(AF_INET, s, &su->sin.sin_addr,
sizeof(su->sin.sin_addr));
- if (bits == 32) {
- if (forcenet)
- errx(1, "%s: not a network", s);
+ if (bits == 32)
return (1);
- }
if (bits >= 0) {
inet_makenetandmask(ntohl(
su->sin.sin_addr.s_addr),