diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2004-09-07 10:14:44 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2004-09-07 10:14:44 +0000 |
commit | 7bfe4501853b6b386a02b63bb5275bba4cc1dc70 (patch) | |
tree | 56b07e7f44f0ef4d81f0dee71cec5932c7d579c9 /sbin/route/route.c | |
parent | 67669065b3bede6fc6ed3d8446251047d3190e3a (diff) |
make -netmask work again; ok henning, mcbride, deraadt
Diffstat (limited to 'sbin/route/route.c')
-rw-r--r-- | sbin/route/route.c | 11 |
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), |