summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-05-07 04:28:26 +0000
committerpeter <peter@FreeBSD.org>1997-05-07 04:28:26 +0000
commitc54176b4c3fca4f46121bf74f15b33df068dd3be (patch)
tree8bd23bc0046bb6e51e658a44949b72b0a9717091 /sbin
parent379be4bd6976e0978a3a320598eacd98708ee1f2 (diff)
downloadFreeBSD-src-c54176b4c3fca4f46121bf74f15b33df068dd3be.zip
FreeBSD-src-c54176b4c3fca4f46121bf74f15b33df068dd3be.tar.gz
Restore unintentially lost backwards compat behavior of defaulting to
family inet if not specified. (eg: "ifconfig ed0" down would fail because no family was specified, even though the up/down status is not per family) Pointed out by: Wolfgang Helbig <helbig@MX.BA-Stuttgart.De>
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifconfig.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 8b2fa42..4c165a9 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
*/
static const char rcsid[] =
- "$Id: ifconfig.c,v 1.26 1997/05/04 06:14:47 peter Exp $";
+ "$Id: ifconfig.c,v 1.27 1997/05/04 06:27:45 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -381,8 +381,7 @@ main(argc, argv)
break;
}
if (afp->af_name == NULL)
- usage();
- /* leave with afp non-zero */
+ afp = NULL; /* not a family, NULL */
}
mib[0] = CTL_NET;
@@ -472,10 +471,9 @@ ifconfig(argc, argv, rafp)
int s;
strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
- if (rafp)
- ifr.ifr_addr.sa_family = rafp->af_af;
- else
- ifr.ifr_addr.sa_family = afs[0].af_af;
+ if (rafp == NULL)
+ rafp = &afs[0];
+ ifr.ifr_addr.sa_family = rafp->af_af;
if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0) {
perror("ifconfig: socket");
@@ -493,7 +491,7 @@ ifconfig(argc, argv, rafp)
mtu = ifr.ifr_mtu;
if (argc == 0) {
- status();
+ status(); /* uses global afp */
#ifdef USE_IF_MEDIA
media_status(s);
#endif
OpenPOWER on IntegriCloud