From patchwork Wed Aug 7 10:08:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peer, Ilan" X-Patchwork-Id: 265475 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 A11A82C0221 for ; Wed, 7 Aug 2013 21:08:20 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C2A9E17C0BB; Wed, 7 Aug 2013 07:08:08 -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 an0T+PK1kPeG; Wed, 7 Aug 2013 07:08:08 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 28A479D40E; Wed, 7 Aug 2013 07:07:17 -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 DF4819D40D for ; Wed, 7 Aug 2013 07:07:15 -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 WYySTcaGZa7Y for ; Wed, 7 Aug 2013 07:07:12 -0400 (EDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BA9D617C06E for ; Wed, 7 Aug 2013 07:06:48 -0400 (EDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 07 Aug 2013 04:06:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,832,1367996400"; d="scan'208";a="377424467" Received: from ipeer-e6430-1.jer.intel.com ([10.12.217.166]) by fmsmga001.fm.intel.com with ESMTP; 07 Aug 2013 04:06:45 -0700 From: Ilan Peer To: hostap@lists.shmoo.com Subject: [PATCH] wpa_supplicant: Fix AP mode frequency initialization Date: Wed, 7 Aug 2013 13:08:43 +0300 Message-Id: <1375870125-27991-7-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1375870125-27991-1-git-send-email-ilan.peer@intel.com> References: <1375870125-27991-1-git-send-email-ilan.peer@intel.com> Cc: Avraham Stern X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Avraham Stern In AP mode the frequency was initialized only after trying to set up the AP which caused failure. Move AP frequency initialization to the right place. Signed-hostap: Avraham Stern --- wpa_supplicant/ap.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index c48a286..c8fc098 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -51,18 +51,12 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s, os_strlcpy(bss->iface, wpa_s->ifname, sizeof(bss->iface)); - if (ssid->frequency == 0) { - /* default channel 11 */ - conf->hw_mode = HOSTAPD_MODE_IEEE80211G; - conf->channel = 11; - } else { - conf->hw_mode = ieee80211_freq_to_chan(ssid->frequency, - &conf->channel); - if (conf->hw_mode == NUM_HOSTAPD_MODES) { - wpa_printf(MSG_ERROR, "Unsupported AP mode frequency: " - "%d MHz", ssid->frequency); - return -1; - } + conf->hw_mode = ieee80211_freq_to_chan(ssid->frequency, + &conf->channel); + if (conf->hw_mode == NUM_HOSTAPD_MODES) { + wpa_printf(MSG_ERROR, "Unsupported AP mode frequency: " + "%d MHz", ssid->frequency); + return -1; } /* TODO: enable HT40 if driver supports it; @@ -461,6 +455,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, params.mode = IEEE80211_MODE_AP; break; } + if (ssid->frequency == 0) + ssid->frequency = 2462; /*default channel 11*/ params.freq = ssid->frequency; params.wpa_proto = ssid->proto;