From patchwork Fri Sep 21 16:53:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 185835 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 A53642C0085 for ; Sat, 22 Sep 2012 02:50:13 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 462099D2DE; Fri, 21 Sep 2012 12:50:10 -0400 (EDT) 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 FXTROeEkORdb; Fri, 21 Sep 2012 12:50:10 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 177019D2F1; Fri, 21 Sep 2012 12:49:59 -0400 (EDT) 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 823CC9D2FE for ; Fri, 21 Sep 2012 12:49:57 -0400 (EDT) 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 v4gCBU7ociST for ; Fri, 21 Sep 2012 12:49:52 -0400 (EDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id F21949D2F1 for ; Fri, 21 Sep 2012 12:49:51 -0400 (EDT) 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 q8LGnntq026132 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Sep 2012 12:49:49 -0400 Received: from [10.3.225.149] (vpn-225-149.phx2.redhat.com [10.3.225.149]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8LGnlGc010904; Fri, 21 Sep 2012 12:49:49 -0400 Message-ID: <1348246391.1338.3.camel@dcbw.foobar.com> Subject: [PATCH] supplicant: set state to DISCONNECTED on AP creation errors From: Dan Williams To: hostap@lists.shmoo.com Date: Fri, 21 Sep 2012 11:53:11 -0500 Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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 If the AP creation failed (missing freq= or driver error) the supplicant would previously stay in SCANNING state forever. Instead, it should handle the error a bit better and drop back to DISCONNECTED so clients know something went wrong. Signed-hostap: Dan Williams intended-for: hostap-2 intended-for: hostap-1 --- wpa_supplicant/wpa_supplicant.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c212ed2..a036f3e 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1246,7 +1246,10 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, "mode"); return; } - wpa_supplicant_create_ap(wpa_s, ssid); + if (wpa_supplicant_create_ap(wpa_s, ssid) < 0) { + wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); + return; + } wpa_s->current_bss = bss; #else /* CONFIG_AP */ wpa_msg(wpa_s, MSG_ERROR, "AP mode support not included in "