summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1998-03-20 02:45:29 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1998-03-20 02:45:29 +0000
commite79efb71d38ed9a25cba805697fde6f368760034 (patch)
tree3f9c469045d3a5b1fc92a2eeec9316e6d6bf8d1f
parent6cb19bb9dafc67b548725f9f7ad34b9ab06f6362 (diff)
Add an explanatory comment, why we keep the interface address and keep
reseting it before each ioctl().
-rw-r--r--sbin/ifconfig/ifconfig.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 6d8a3a59fd5..b5ebabc0204 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.15 1998/03/20 02:22:29 angelos Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.16 1998/03/20 02:45:28 angelos Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#else
-static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.15 1998/03/20 02:22:29 angelos Exp $";
+static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.16 1998/03/20 02:45:28 angelos Exp $";
#endif
#endif /* not lint */
@@ -597,7 +597,15 @@ in_status(force)
}
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
sin = (struct sockaddr_in *)&ifr.ifr_addr;
+
+ /*
+ * We keep the interface address and reset it before each
+ * ioctl() so we can get ifaliases information (as opposed
+ * to the primary interface netmask/dstaddr/broadaddr, if
+ * the ifr_addr field is zero).
+ */
memcpy(&sin2, &ifr.ifr_addr, sizeof(sin2));
+
printf("\tinet %s ", inet_ntoa(sin->sin_addr));
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
if (ioctl(s, SIOCGIFNETMASK, (caddr_t)&ifr) < 0) {