From 9c3b235f46730a012b48e480b32b566753afd0e6 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Wed, 7 May 1997 04:28:26 +0000 Subject: [PATCH] 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 --- sbin/ifconfig/ifconfig.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 8b2fa42077fd..4c165a9e291a 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 @@ -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