From patchwork Thu Aug 6 19:04:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Ortiz X-Patchwork-Id: 39674 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n76J2bkv016286 for ; Thu, 6 Aug 2009 19:02:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753279AbZHFTCc (ORCPT ); Thu, 6 Aug 2009 15:02:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753343AbZHFTCc (ORCPT ); Thu, 6 Aug 2009 15:02:32 -0400 Received: from mga10.intel.com ([192.55.52.92]:20648 "EHLO fmsmga102.fm.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753279AbZHFTCc (ORCPT ); Thu, 6 Aug 2009 15:02:32 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 06 Aug 2009 11:52:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,335,1246863600"; d="scan'208";a="481394225" Received: from unknown (HELO sortiz-mobl) ([143.185.76.183]) by fmsmga002.fm.intel.com with ESMTP; 06 Aug 2009 11:55:27 -0700 Date: Thu, 6 Aug 2009 21:04:41 +0200 From: Samuel Ortiz To: "John W. Linville" Cc: "Zhu, Yi" , Johannes Berg , linux-wireless@vger.kernel.org Subject: [PATCH] cfg80211: Set WEP ciphers Message-ID: <20090806190439.GA22647@sortiz.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org With iwconfig there is no way to properly set the ciphers when trying to connect to a WEP SSID. Although mac80211 based drivers dont need it, several fullmac drivers do. This patch basically sets the WEP ciphers whenever they're not set at all. Signed-off-by: Samuel Ortiz --- net/wireless/sme.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 8a7dcbf..b78a111 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -638,14 +638,28 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev, if (connkeys && connkeys->def >= 0) { int idx; + u32 cipher; idx = connkeys->def; + cipher = connkeys->params[idx].cipher; /* If given a WEP key we may need it for shared key auth */ - if (connkeys->params[idx].cipher == WLAN_CIPHER_SUITE_WEP40 || - connkeys->params[idx].cipher == WLAN_CIPHER_SUITE_WEP104) { + if (cipher == WLAN_CIPHER_SUITE_WEP40 || + cipher == WLAN_CIPHER_SUITE_WEP104) { connect->key_idx = idx; connect->key = connkeys->params[idx].key; connect->key_len = connkeys->params[idx].key_len; + + /* + * If ciphers are not set (e.g. when going through + * iwconfig), we have to set them appropriately here. + */ + if (connect->crypto.cipher_group == 0) + connect->crypto.cipher_group = cipher; + + if (connect->crypto.n_ciphers_pairwise == 0) { + connect->crypto.n_ciphers_pairwise = 1; + connect->crypto.ciphers_pairwise[0] = cipher; + } } }