From nobody@FreeBSD.org  Sun Mar 16 00:09:13 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id A1453236
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 16 Mar 2014 00:09:13 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 740E73E5
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 16 Mar 2014 00:09:13 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s2G09C0B023616
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 16 Mar 2014 00:09:12 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s2G09CD9023613;
	Sun, 16 Mar 2014 00:09:12 GMT
	(envelope-from nobody)
Message-Id: <201403160009.s2G09CD9023613@cgiserv.freebsd.org>
Date: Sun, 16 Mar 2014 00:09:12 GMT
From: Sean Bruno <sbruno@freebsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: WEP and other ciphers do not work if h/w driver does not declare support
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         187624
>Category:       bin
>Synopsis:       [patch] wpa_supplicant(8): WEP and other ciphers do not work if h/w driver does not declare support [regression]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-wireless
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 16 00:10:00 UTC 2014
>Closed-Date:    Mon May 19 18:25:51 UTC 2014
>Last-Modified:  Mon May 19 18:25:51 UTC 2014
>Originator:     Sean Bruno
>Release:        -CURRENT
>Organization:
FreeBSD Project
>Environment:
FreeBSD powernoodle.corp.yahoo.com 11.0-CURRENT FreeBSD 11.0-CURRENT #11 r263173: Sat Mar 15 13:31:08 JST 2014     sbruno@powernoodle.corp.yahoo.com:/usr/obj/usr/src/sys/POWERNOODLE  amd64

>Description:
Discovered that, with the import of wpa_supplicant 2.0, WEP no longer
works with drivers (iwn for example) if the driver does not declare
support for the WEP cipher.

This should be handled by net80211 in s/w if the h/w and driver do not declare support for the appropriate cipher.

This is not a bug in iwn(4) but in the way wpa_supplicant attempts to detect and support h/w that does not have cipher offloading for the requested network.
>How-To-Repeat:
Attempt to use iwn(4) to associate to a WEP network
>Fix:
Use the attached patch (from rpaulo) to declare the cipher's capabilities no matter what.

thanks to Allan Jude for help in diagnosing this at AsiaBSDCon 2014

Patch attached with submission follows:

diff --git a/contrib/wpa/src/drivers/driver_bsd.c b/contrib/wpa/src/drivers/driver_bsd.c
--- a/contrib/wpa/src/drivers/driver_bsd.c
+++ b/contrib/wpa/src/drivers/driver_bsd.c
@@ -1446,6 +1446,7 @@
 		drv->capa.key_mgmt = WPA_DRIVER_CAPA_KEY_MGMT_WPA2 |
 			WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK;
 
+#ifndef __FreeBSD__
 	if (devcaps.dc_cryptocaps & IEEE80211_CRYPTO_WEP)
 		drv->capa.enc |= WPA_DRIVER_CAPA_ENC_WEP40 |
 			WPA_DRIVER_CAPA_ENC_WEP104;
@@ -1453,6 +1454,12 @@
 		drv->capa.enc |= WPA_DRIVER_CAPA_ENC_TKIP;
 	if (devcaps.dc_cryptocaps & IEEE80211_CRYPTO_AES_CCM)
 		drv->capa.enc |= WPA_DRIVER_CAPA_ENC_CCMP;
+#else
+	drv->capa.enc |= WPA_DRIVER_CAPA_ENC_WEP40 |
+	    WPA_DRIVER_CAPA_ENC_WEP104 |
+	    WPA_DRIVER_CAPA_ENC_TKIP |
+	    WPA_DRIVER_CAPA_ENC_CCMP;
+#endif
 
 	if (devcaps.dc_drivercaps & IEEE80211_C_HOSTAP)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_AP;


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-wireless 
Responsible-Changed-By: adrian 
Responsible-Changed-When: Thu Mar 20 19:41:22 UTC 2014 
Responsible-Changed-Why:  
bounce to owner 
http://www.freebsd.org/cgi/query-pr.cgi?pr=187624 
State-Changed-From-To: open->closed 
State-Changed-By: allanjude 
State-Changed-When: Mon May 19 18:24:55 UTC 2014 
State-Changed-Why:  
Fixed in head r263925 
Sean and I discovered this at AsiaBSDCon and a fix was commited by  
rpaulo 

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