wpa_supplicant fails to find the NDIS adapter names

From: Scot Hetzel <swhetzel_at_gmail.com>
Date: Thu, 30 Mar 2006 08:16:36 -0600
In setting up my laptop (FreeBSD/amd64 6.1-BETA), I needed to use the
NDIS driver, since FreeBSD doesn't have a driver for my Broadcom card.
 I added ifconfig_ndis0="WPA DHCP", created a /etc/wpa_supplicant.conf
and restarted the network (/etc/rc.d/netif stop|start).  Except I
received this error:

NDIS: Failed to get adapter list (PacketGetAdapterNames)
Failed to initialize driver interface

Running wpa_supplicant manually with the following command, resulted
in the same error.

 # wpa_supplicant -B -q -i ndis0 -D ndis -c /etc/wpa_supplicant.conf -P
/var/run/wpa_supplicant/ndis0.pid

Searching the sources, I found this routine being used in
src/contrib/wpa_supplicant/driver_ndis.c (wpa_driver_ndis_get_names).

In this section of source code:

	res = PacketGetAdapterNames(names, &len);
	if (!res && len > 8192) {
		free(names);
		names = malloc(len);
		if (names == NULL)
			return -1;
		memset(names, 0, len);
		res = PacketGetAdapterNames(names, &len);
	}

	if (!res) {
		wpa_printf(MSG_ERROR, "NDIS: Failed to get adapter list "
			   "(PacketGetAdapterNames)");
		free(names);
		return -1;
	}

I had added a couple of wpa_printf(MSG_DEBUG..); that printed the
value of res and names.  This indicated that PacketGetAdapterNames was
returning with the name of the ndis interface and that res was being
set to zero.

The problem is that PacketGetAdapterNames is returning with a zero
value, which causes wpa_driver_ndis_get_names to print ths error
message and return with a -1.

I then found PacketGetAdapterNames routine in
usr.sbin/wpa/wpa_supplicant/Packet32.c.  After replacing 'return(0)'
with 'return(1)', then recompiling and installing the new
wpa_supplicant, I was able to get wpa_supplicant to use the ndis0
interface.

I also noticed that PacketGetAdapterNames is returning with EIO,
ENOMEM, ENOSPC,  since wpa_driver_ndis_get_names expects a boolean
value for the return code from PacketGetAdapterNames, should these
return values be changed to a zero also?

The only thing I have tested right now is that wpa_supplicant can find
the ndis0 interface.  As I won't be near a wireless network until
tomorrow.  If someone can test if replacing the return value in
Packet32.c works for them with the ndis driver.

NOTE: This problem affects both RELENG_6 and CURRENT since the import
and MFC of wpa_supplicant  to version 0.4.8.

The only thing I'm not sure about is if my /etc/wpa_supplicant.conf
file is set up properly for this wireless network:

ctrl_interface=/var/run/wpa_supplicant
ctrl_intreface_group=wheel

network={
 ssid="campuswpa"
 key_mgmt=WPA-EAP
 pairwise=TKIP
 group=TKIP
 eap=PEAP
 identity="<username>"
 password="<password>"
#  phase1="peaplabel=1"
 phase2="auth=MSCHAPV2"
 priority=1
}

When I connect to this network thru Windows XP, the setup is as follows:

  Network Authentication: WPA
  Data encryption:            TKIP
  EAP Type:                     Protected EAP (PEAP)
  Authentication Method:   Secured password (EAP-MSCHAP v2)
  Fast Reconnect:             Enabled
  Validate server certificate: Unchecked

Scot


--
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.
Received on Thu Mar 30 2006 - 12:16:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:54 UTC