Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/netstat adjust to the netname4 prototype.
details: https://anonhg.NetBSD.org/src/rev/9d2650d260b2
branches: trunk
changeset: 335465:9d2650d260b2
user: christos <christos%NetBSD.org@localhost>
date: Wed Jan 07 22:43:01 2015 +0000
description:
adjust to the netname4 prototype.
diffstat:
usr.bin/netstat/if.c | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)
diffs (55 lines):
diff -r 51193b5f9f43 -r 9d2650d260b2 usr.bin/netstat/if.c
--- a/usr.bin/netstat/if.c Wed Jan 07 22:38:32 2015 +0000
+++ b/usr.bin/netstat/if.c Wed Jan 07 22:43:01 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.80 2014/11/06 21:30:09 christos Exp $ */
+/* $NetBSD: if.c,v 1.81 2015/01/07 22:43:01 christos Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
-__RCSID("$NetBSD: if.c,v 1.80 2014/11/06 21:30:09 christos Exp $");
+__RCSID("$NetBSD: if.c,v 1.81 2015/01/07 22:43:01 christos Exp $");
#endif
#endif /* not lint */
@@ -337,7 +337,7 @@
const int niflag = NI_NUMERICHOST;
struct sockaddr_in6 *sin6, *netmask6;
#endif
- in_addr_t netmask;
+ struct sockaddr_in netmask;
struct sockaddr_in *sin;
char *cp;
int n, m;
@@ -349,24 +349,13 @@
break;
case AF_INET:
sin = (struct sockaddr_in *)sa;
-#ifdef notdef
- /*
- * can't use inet_makeaddr because kernel
- * keeps nets unshifted.
- */
- in = inet_makeaddr(ifaddr.in.ia_subnet,
- INADDR_ANY);
- cp = netname4(in.s_addr,
- ifaddr.in.ia_subnetmask, nflag);
-#else
if (use_sysctl) {
- netmask = ((struct sockaddr_in *)rtinfo[RTAX_NETMASK])->sin_addr.s_addr;
+ netmask = *((struct sockaddr_in *)rtinfo[RTAX_NETMASK]);
} else {
struct in_ifaddr *ifaddr_in = (void *)rtinfo;
- netmask = ifaddr_in->ia_subnetmask;
+ netmask.sin_addr.s_addr = ifaddr_in->ia_subnetmask;
}
- cp = netname4(sin->sin_addr.s_addr, netmask, nflag);
-#endif
+ cp = netname4(sin, &netmask, nflag);
if (vflag)
n = strlen(cp) < 13 ? 13 : strlen(cp);
else
Home |
Main Index |
Thread Index |
Old Index