svn commit: r190154 - stable/7/sbin/ifconfig

Jamie Gritton jamie at FreeBSD.org
Fri Mar 20 06:46:32 PDT 2009


Author: jamie
Date: Fri Mar 20 13:46:30 2009
New Revision: 190154
URL: http://svn.freebsd.org/changeset/base/190154

Log:
  Revert r189970 until its implications get sorted out in CURRENT.
  
  Approved by:	bz(mentor)

Modified:
  stable/7/sbin/ifconfig/   (props changed)
  stable/7/sbin/ifconfig/ifclone.c
  stable/7/sbin/ifconfig/ifconfig.c
  stable/7/sbin/ifconfig/ifgroup.c

Modified: stable/7/sbin/ifconfig/ifclone.c
==============================================================================
--- stable/7/sbin/ifconfig/ifclone.c	Fri Mar 20 13:44:43 2009	(r190153)
+++ stable/7/sbin/ifconfig/ifclone.c	Fri Mar 20 13:46:30 2009	(r190154)
@@ -53,9 +53,9 @@ list_cloners(void)
 	int idx;
 	int s;
 
-	s = socket(AF_LOCAL, SOCK_DGRAM, 0);
+	s = socket(AF_INET, SOCK_DGRAM, 0);
 	if (s == -1)
-		err(1, "socket(AF_LOCAL,SOCK_DGRAM)");
+		err(1, "socket(AF_INET,SOCK_DGRAM)");
 
 	memset(&ifcr, 0, sizeof(ifcr));
 

Modified: stable/7/sbin/ifconfig/ifconfig.c
==============================================================================
--- stable/7/sbin/ifconfig/ifconfig.c	Fri Mar 20 13:44:43 2009	(r190153)
+++ stable/7/sbin/ifconfig/ifconfig.c	Fri Mar 20 13:46:30 2009	(r190154)
@@ -434,22 +434,21 @@ static const struct cmd setifdstaddr_cmd
 	DEF_CMD("ifdstaddr", 0, setifdstaddr);
 
 static int
-ifconfig(int argc, char *const *argv, int iscreate, const struct afswtch *uafp)
+ifconfig(int argc, char *const *argv, int iscreate, const struct afswtch *afp)
 {
-	const struct afswtch *afp, *nafp;
+	const struct afswtch *nafp;
 	struct callback *cb;
 	int s;
 
 	strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
-	afp = uafp != NULL ? uafp : af_getbyname("inet");
 top:
+	if (afp == NULL)
+		afp = af_getbyname("inet");
 	ifr.ifr_addr.sa_family =
 		afp->af_af == AF_LINK || afp->af_af == AF_UNSPEC ?
-		AF_LOCAL : afp->af_af;
+		AF_INET : afp->af_af;
 
-	if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 &&
-	    (uafp != NULL || errno != EPROTONOSUPPORT ||
-	     (s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0))
+	if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
 		err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family);
 
 	while (argc > 0) {
@@ -793,12 +792,11 @@ status(const struct afswtch *afp, const 
 
 	if (afp == NULL) {
 		allfamilies = 1;
-		ifr.ifr_addr.sa_family = AF_LOCAL;
-	} else {
+		afp = af_getbyname("inet");
+	} else
 		allfamilies = 0;
-		ifr.ifr_addr.sa_family =
-		    afp->af_af == AF_LINK ? AF_LOCAL : afp->af_af;
-	}
+
+	ifr.ifr_addr.sa_family = afp->af_af == AF_LINK ? AF_INET : afp->af_af;
 	strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
 
 	s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0);

Modified: stable/7/sbin/ifconfig/ifgroup.c
==============================================================================
--- stable/7/sbin/ifconfig/ifgroup.c	Fri Mar 20 13:44:43 2009	(r190153)
+++ stable/7/sbin/ifconfig/ifgroup.c	Fri Mar 20 13:46:30 2009	(r190154)
@@ -131,9 +131,9 @@ printgroup(const char *groupname)
 	int			 len, cnt = 0;
 	int			 s;
 
-	s = socket(AF_LOCAL, SOCK_DGRAM, 0);
+	s = socket(AF_INET, SOCK_DGRAM, 0);
 	if (s == -1)
-		err(1, "socket(AF_LOCAL,SOCK_DGRAM)");
+		err(1, "socket(AF_INET,SOCK_DGRAM)");
 	bzero(&ifgr, sizeof(ifgr));
 	strlcpy(ifgr.ifgr_name, groupname, sizeof(ifgr.ifgr_name));
 	if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) == -1) {


More information about the svn-src-all mailing list