summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-06-15 17:10:33 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-06-15 17:10:33 +0000
commitc8c1f30cad287f33c34490748cc874ca8ff16c11 (patch)
treec3abb8aacc4fc7e3ee1ca38edc484350e2990c46 /sbin
parent9a13b2d5e114faf066c473bbac06a7b1b6832d89 (diff)
Cleanup last commit here:
- pass netname4() a struct sockaddr_in * and check it for NULL - netname6() already deals with NULL mask so remove unneeded check in netname() OK deraadt@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/show.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sbin/route/show.c b/sbin/route/show.c
index 6b5caa10481..d5239972eb5 100644
--- a/sbin/route/show.c
+++ b/sbin/route/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.29 2004/06/15 16:55:38 deraadt Exp $ */
+/* $OpenBSD: show.c,v 1.30 2004/06/15 17:10:32 millert Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-static const char rcsid[] = "$OpenBSD: show.c,v 1.29 2004/06/15 16:55:38 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: show.c,v 1.30 2004/06/15 17:10:32 millert Exp $";
#endif
#endif /* not lint */
@@ -511,14 +511,15 @@ routename6(struct sockaddr_in6 *sin6)
* The address is assumed to be that of a net or subnet, not a host.
*/
char *
-netname4(in_addr_t in, in_addr_t mask)
+netname4(in_addr_t in, struct sockaddr_in *maskp)
{
char *cp = NULL;
struct netent *np = NULL;
+ in_addr_t mask;
int mbits;
in = ntohl(in);
- mask = ntohl(mask);
+ mask = maskp ? ntohl(maskp->sin_addr.s_addr) : 0;
if (!nflag && in != INADDR_ANY) {
if ((np = getnetbyaddr(in, AF_INET)) != NULL)
cp = np->n_name;
@@ -654,11 +655,11 @@ netname(struct sockaddr *sa, struct sockaddr *mask)
case AF_INET:
return netname4(((struct sockaddr_in *)sa)->sin_addr.s_addr,
- mask ? ((struct sockaddr_in *)mask)->sin_addr.s_addr : NULL);
+ (struct sockaddr_in *)mask);
#ifdef INET6
case AF_INET6:
return netname6((struct sockaddr_in6 *)sa,
- mask ? (struct sockaddr_in6 *)mask : NULL);
+ (struct sockaddr_in6 *)mask);
#endif
case AF_NS: