From nobody@FreeBSD.org  Mon Aug 25 13:42:59 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95D831065674
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Aug 2008 13:42:59 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 736C48FC17
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Aug 2008 13:42:59 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m7PDgsmi022230
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Aug 2008 13:42:59 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m7PDgrdD022229;
	Mon, 25 Aug 2008 13:42:53 GMT
	(envelope-from nobody)
Message-Id: <200808251342.m7PDgrdD022229@www.freebsd.org>
Date: Mon, 25 Aug 2008 13:42:53 GMT
From: Johann Hugo <jhugo@meraka.csir.co.za>
To: freebsd-gnats-submit@FreeBSD.org
Subject: wpa_supplicant - WPA PSK does not work in adhoc mode. 
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         126822
>Category:       bin
>Synopsis:       wpa_supplicant(8): WPA PSK does not work in adhoc mode.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bschmidt
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 25 13:50:03 UTC 2008
>Closed-Date:    Tue Aug 03 07:17:03 UTC 2010
>Last-Modified:  Tue Aug 03 07:17:03 UTC 2010
>Originator:     Johann Hugo
>Release:        7.0-STABLE
>Organization:
CSIR
>Environment:
mesh-9ddd:~ # uname -a
FreeBSD mesh-9ddd 7.0-STABLE FreeBSD 7.0-STABLE #17: Wed Jul 30 10:02:20 UTC 200
8     jhay@dolphin.meraka.csir.co.za:/usr/obj/usr/src/sys/SMALL  i386
>Description:
PA PSK does not work in adhoc mode.

According to the "wpa_supplicant Reference Manual 0.4.x" it should be possible:
---------------------------------------------
IEEE 802.11 operation mode (Infrastucture/IBSS).
0 = infrastructure (Managed) mode, i.e., associate with an AP.
1 = IBSS (ad-hoc, peer-to-peer)
Note: IBSS can only be used with key_mgmt NONE (plaintext and static WEP) and
key_mgmt=WPA-NONE (?xed group key TKIP/CCMP). In addition, ap_scan has to be
set to 2 for IBSS. WPA-None requires following network block options:
proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP
(or CCMP, but not both), and psk must also be set (either directly or using
ASCII passphrase).
--------------------------------------------

My supplicant file:
mesh-9ddd:~ # more /etc/wpa_supplicant.conf
 ap_scan=2

 network={
   ssid="ptamesh"
   mode=1
   proto=WPA
   key_mgmt=WPA-NONE
   pairwise=NONE
   group=TKIP
   psk="mesh-ipv6"
 }

If I run wpa_supplicant in debug mode it shows that the wireless card
is trying to do a ssid scan, but then it fails because the adapter is
in Adhoc mode.

Debug mode output:
mesh-9ddd:~ # wpa_supplicant -d -i ath0 -c /etc/wpa_supplicant.conf
Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
ap_scan=2
Priority group 0
   id=0 ssid='ptamesh'
Initializing interface (2) 'ath0'
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
Own MAC address: 00:80:48:50:9d:dd
wpa_driver_bsd_set_wpa: enabled=1
wpa_driver_bsd_set_wpa_internal: wpa=3 privacy=1
wpa_driver_bsd_del_key: keyidx=0
wpa_driver_bsd_del_key: keyidx=1
wpa_driver_bsd_del_key: keyidx=2
wpa_driver_bsd_del_key: keyidx=3
wpa_driver_bsd_set_countermeasures: enabled=0
wpa_driver_bsd_set_drop_unencrypted: enabled=1
Setting scan request: 0 sec 100000 usec
Added interface ath0
State: DISCONNECTED -> SCANNING
Trying to associate with SSID 'ptamesh'
Cancelling scan request
WPA: clearing own WPA/RSN IE
Automatic auth_alg selection: 0x1
wpa_driver_bsd_set_auth_alg alg 0x1 authmode 1
WPA: No WPA/RSN IE available from association info
WPA: Set cipher suites based on configuration
WPA: Selected cipher suites: group 8 pairwise 1 key_mgmt 16 proto 1
WPA: clearing AP WPA IE
WPA: clearing AP RSN IE
WPA: using GTK TKIP
WPA: using PTK NONE
WPA: using KEY_MGMT WPA-NONE
WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 00 01 00 00 50 f2 00
No keys have been configured - skip key clearing
wpa_driver_bsd_set_key: alg=TKIP addr=ff:ff:ff:ff:ff:ff key_idx=0 set_tx=1 seq_len=6 key_len=32
wpa_driver_bsd_set_drop_unencrypted: enabled=1
State: SCANNING -> ASSOCIATING
wpa_driver_bsd_associate: ssid 'ptamesh' wpa ie len 24 pairwise 0 group 2 key mgmt 4
ioctl[SIOCS80211, op 22, len 24]: Invalid argument
Association request to the driver failed
wpa_driver_bsd_set_key: alg=TKIP addr=ff:ff:ff:ff:ff:ff key_idx=0 set_tx=1 seq_len=6 key_len=32
Cancelling authentication timeout
State: ASSOCIATING -> COMPLETED
CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (auth) [id=-1 id_str=]
EAPOL: External notification - portControl=ForceAuthorized

>How-To-Repeat:
Create the following wpa_supplicant.conf file and run wpa_supplicant in it's debug mode.

mesh-9ddd:~ # more /etc/wpa_supplicant.conf
 ap_scan=2

 network={
   ssid="ptamesh"
   mode=1
   proto=WPA
   key_mgmt=WPA-NONE
   pairwise=NONE
   group=TKIP
   psk="mesh-ipv6"
 }

wpa_supplicant -d -i ath0 -c /etc/wpa_supplicant.conf

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Aug 27 11:37:04 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126822 
Responsible-Changed-From-To: freebsd-net->bschmidt 
Responsible-Changed-By: bschmidt 
Responsible-Changed-When: Sat Apr 10 14:05:01 UTC 2010 
Responsible-Changed-Why:  
mine. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126822 
State-Changed-From-To: open->feedback 
State-Changed-By: bschmidt 
State-Changed-When: Sat Apr 10 17:35:10 UTC 2010 
State-Changed-Why:  
WPA-None support has been committed to HEAD. I contacted the originator 
and I'm now waiting for reply.  

http://www.freebsd.org/cgi/query-pr.cgi?pr=126822 
State-Changed-From-To: feedback->closed 
State-Changed-By: bschmidt 
State-Changed-When: Tue Aug 3 07:16:46 UTC 2010 
State-Changed-Why:  
feedback timeout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126822 
>Unformatted:
