From patchwork Thu Feb 2 21:48:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 139235 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id C95FE104785 for ; Fri, 3 Feb 2012 08:47:43 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 927299D214; Thu, 2 Feb 2012 16:47:40 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KoPhFrJ1i85S; Thu, 2 Feb 2012 16:47:40 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7E01717C025; Thu, 2 Feb 2012 16:47:36 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 15A7B17C023 for ; Thu, 2 Feb 2012 16:47:35 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KWDWK-6HPlhM for ; Thu, 2 Feb 2012 16:47:29 -0500 (EST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2E0E417C025 for ; Thu, 2 Feb 2012 16:47:27 -0500 (EST) Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q12LlQPK015635 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 2 Feb 2012 16:47:26 -0500 Received: from [10.3.234.236] (vpn-234-236.phx2.redhat.com [10.3.234.236]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q12LlN0L031386; Thu, 2 Feb 2012 16:47:25 -0500 Message-ID: <1328219311.14368.29.camel@dcbw.foobar.com> Subject: [RFC] [PATCH] Try fallback drivers if global init for preferred drivers fails From: Dan Williams To: hostap@lists.shmoo.com Date: Thu, 02 Feb 2012 15:48:31 -0600 Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Cc: Jouni Malinen X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Driver global init was considered a hard failure. Thus if, for example, you used the Broadcom STA driver and didn't have nl80211 or cfg80211 loaded into the kernel, and specified a driver value of "nl80211,wext", the nl80211 driver's global init would fail with the following message: nl80211: 'nl80211' generic netlink not found Failed to initialize driver 'nl80211' but since global init was a hard failure, creating the supplicant interface would fail and the WEXT driver would not be tried. Give other drivers a chance instead. Signed-hostap: Dan Williams --- * Only compile tested; does this look like the right thing to do here? Relevant bug is: https://bugzilla.redhat.com/show_bug.cgi?id=783712 wpa_supplicant/wpa_supplicant.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index ee5ca8d..6320918 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1941,8 +1941,11 @@ static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s, for (i = 0; wpa_drivers[i]; i++) { if (os_strlen(wpa_drivers[i]->name) == len && os_strncmp(driver, wpa_drivers[i]->name, len) == - 0) - return select_driver(wpa_s, i); + 0) { + /* First driver that succeeds wins */ + if (select_driver(wpa_s, i) == 0) + return 0; + } } driver = pos + 1;