From owner-freebsd-current@FreeBSD.ORG Thu Mar 30 14:16:38 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3096D16A400 for ; Thu, 30 Mar 2006 14:16:38 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.200]) by mx1.FreeBSD.org (Postfix) with ESMTP id EAC2D43D5C for ; Thu, 30 Mar 2006 14:16:36 +0000 (GMT) (envelope-from swhetzel@gmail.com) Received: by xproxy.gmail.com with SMTP id s9so294148wxc for ; Thu, 30 Mar 2006 06:16:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=LWV+CfpSndXowmFESraIYJrv7NmNYPWOo/8eKnLP0Dc0mTfLHXs0Ime9GUTmDOm208YYqsItbPHHRZ9uTfn+KSxSw0NlHxeWIGQe22QxaY/0SI39zd02uMtPHPFl9EMnB6TL0reTnj7BkYfEVnEJ/8bq5DFrbao0KgLVFyaZCoA= Received: by 10.70.71.18 with SMTP id t18mr1134097wxa; Thu, 30 Mar 2006 06:16:36 -0800 (PST) Received: by 10.70.27.14 with HTTP; Thu, 30 Mar 2006 06:16:36 -0800 (PST) Message-ID: <790a9fff0603300616y62afae4cp50b448b53112de8c@mail.gmail.com> Date: Thu, 30 Mar 2006 08:16:36 -0600 From: "Scot Hetzel" To: freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Cc: wpaul@freebsd.org, sam@freebsd.org Subject: wpa_supplicant fails to find the NDIS adapter names X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2006 14:16:38 -0000 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=3D"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: =09res =3D PacketGetAdapterNames(names, &len); =09if (!res && len > 8192) { =09=09free(names); =09=09names =3D malloc(len); =09=09if (names =3D=3D NULL) =09=09=09return -1; =09=09memset(names, 0, len); =09=09res =3D PacketGetAdapterNames(names, &len); =09} =09if (!res) { =09=09wpa_printf(MSG_ERROR, "NDIS: Failed to get adapter list " =09=09=09 "(PacketGetAdapterNames)"); =09=09free(names); =09=09return -1; =09} 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=3D/var/run/wpa_supplicant ctrl_intreface_group=3Dwheel network=3D{ ssid=3D"campuswpa" key_mgmt=3DWPA-EAP pairwise=3DTKIP group=3DTKIP eap=3DPEAP identity=3D"" password=3D"" # phase1=3D"peaplabel=3D1" phase2=3D"auth=3DMSCHAPV2" priority=3D1 } 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.