Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Dec 2004 23:24:35 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 66373 for review
Message-ID:  <200412032324.iB3NOZld004689@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=66373

Change 66373 by sam@sam_ebb on 2004/12/03 23:24:19

	o identify parameters to socket when a call fails
	o check for AF_UNSPEC when defaulting the address family

Affected files ...

.. //depot/projects/wifi/sbin/ifconfig/ifconfig.c#5 edit

Differences ...

==== //depot/projects/wifi/sbin/ifconfig/ifconfig.c#5 (text+ko) ====

@@ -461,11 +461,13 @@
 
 	if (afp == NULL)
 		afp = af_getbyname("inet");
-	ifr.ifr_addr.sa_family = afp->af_af == AF_LINK ? AF_INET : afp->af_af;
+	ifr.ifr_addr.sa_family =
+		afp->af_af == AF_LINK || afp->af_af == AF_UNSPEC ?
+		AF_INET : afp->af_af;
 	strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
 
 	if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
-		err(1, "socket");
+		err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family);
 
 	while (argc > 0) {
 		const struct cmd *p;
@@ -805,7 +807,7 @@
 
 	s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0);
 	if (s < 0)
-		err(1, "socket");
+		err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family);
 
 	printf("%s: ", name);
 	printb("flags", flags, IFFBITS);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412032324.iB3NOZld004689>