bin/94735: [patch] NDIS driver plus wpa_supplicant does not work

Rudolf Cejka cejkar at fit.vutbr.cz
Mon Mar 20 15:30:15 UTC 2006


>Number:         94735
>Category:       bin
>Synopsis:       [patch] NDIS driver plus wpa_supplicant does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 20 15:30:12 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Rudolf Cejka
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
FIT, Brno University of Technology, Czech Republic
>Environment:

FreeBSD 7.0-current Mar 17 2006

>Description:

Function PacketGetAdapterNames() in usr.sbin/wpa/wpa_supplicant/Packet32.c
has different semantics, than is expected by wpa_supplicant, which takes
result == 0 as an error and result != 0 as a success. Unfortunately
PacketGetAdapterNames() behaves in exactly different way.

>How-To-Repeat:
>Fix:

--- usr.sbin/wpa/wpa_supplicant/Packet32.c.orig	Mon Mar 20 16:07:18 2006
+++ usr.sbin/wpa/wpa_supplicant/Packet32.c	Mon Mar 20 16:07:50 2006
@@ -246,15 +246,15 @@
 	mib[5] = 0;             /* no flags */
 
 	if (sysctl (mib, 6, NULL, &needed, NULL, 0) < 0)
-		return(EIO);
+		return(0);
 
 	buf = malloc (needed);
 	if (buf == NULL)
-		return(ENOMEM);
+		return(0);
 
 	if (sysctl (mib, 6, buf, &needed, NULL, 0) < 0) {
 		free(buf);
-		return(EIO);
+		return(0);
 	}
 
 	lim = buf + needed;
@@ -269,7 +269,7 @@
 			if (strnstr(sdl->sdl_data, "ndis", sdl->sdl_nlen)) {
 				if ((spc + sdl->sdl_nlen) > *len) {
 					free(buf);
-					return(ENOSPC);
+					return(0);
 				}
 				strncpy(plist, sdl->sdl_data, sdl->sdl_nlen);
 				plist += (sdl->sdl_nlen + 1);
@@ -302,7 +302,7 @@
 			if (strnstr(sdl->sdl_data, "ndis", sdl->sdl_nlen)) {
 				if ((spc + sdl->sdl_nlen) > *len) {
 					free(buf);
-					return(ENOSPC);
+					return(0);
 				}
 				strncpy(plist, sdl->sdl_data, sdl->sdl_nlen);
 				plist += (sdl->sdl_nlen + 1);
@@ -317,7 +317,7 @@
 
 	*len = spc + 1;
 
-	return(0);
+	return(1);
 }
 
 void

PS: Here is another patch, if the bug is considered in wpa_supplicant:

--- contrib/wpa_supplicant/driver_ndis.c.orig	Mon Mar 20 16:00:40 2006
+++ contrib/wpa_supplicant/driver_ndis.c	Mon Mar 20 16:01:40 2006
@@ -1429,7 +1429,7 @@
 	memset(names, 0, len);
 
 	res = PacketGetAdapterNames(names, &len);
-	if (!res && len > 8192) {
+	if (res && len > 8192) {
 		free(names);
 		names = malloc(len);
 		if (names == NULL)
@@ -1438,7 +1438,7 @@
 		res = PacketGetAdapterNames(names, &len);
 	}
 
-	if (!res) {
+	if (res) {
 		wpa_printf(MSG_ERROR, "NDIS: Failed to get adapter list "
 			   "(PacketGetAdapterNames)");
 		free(names);
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list